/major-ai-skills:openai-apifrom major-ai-skills
Integrate OpenAI Responses (preferred) and Chat Completions with structured outputs, tools, embeddings, retries, and store/privacy controls agents routinely miss.
Ships in major-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Official OpenAI Python/TS SDKs call HTTP APIs for text, tools, embeddings, and media. Prefer the Responses API for new work (agentic tools, simpler multi-turn, better cache behavior); Chat Completions remains supported for existing integrations. Auth via OPENAI_API_KEY (or Azure/base_url overrides). Pin model ids, set timeouts, bound max output tokens, validate tool calls, and treat store as a privacy control (Responses defaults can retain application state ~30 days unless store=false or org ZDR).
┌─────────────────────────────────────────────────────────────┐
│ OpenAI client stack │
│ │
│ SDK (timeouts, retries) │
│ ├── Responses (/v1/responses) — preferred for new apps │
│ ├── Chat Completions (/v1/chat/completions) — legacy OK │
│ ├── Embeddings (/v1/embeddings) │
│ └── Tools / structured outputs (json_schema / parse) │
│ │
│ Cross-cutting │
│ ├── Rate limits (RPM/TPM) + Retry-After │
│ ├── usage accounting + request ids │
│ └── store / ZDR / prompt-cache retention policy │
└─────────────────────────────────────────────────────────────┘
Use when
@qdrant / @chromadb / @llamaindex / @langchain.Do not use when
@langchain (LangGraph).@llamaindex (still use this skill for the provider call).OPENAI_API_KEY); never commit keys or paste into source.client.responses.create / .parse) for new code; keep Completions only when migrating incrementally.gpt-4.1-mini, gpt-4.1, etc.); log model + response/request id with usage.timeout; honor Retry-After on 429; exponential backoff + jitter; do not retry billing/quota errors; avoid nested app+SDK retry storms.responses.parse(..., text_format=Model) or Completions .parse — prefer over “JSON mode” alone.store=false when product/compliance must not retain Responses application state; confirm org Zero Data Retention if required.tools, not prompt-injected pseudo-JSON.import os
from openai import OpenAI
from pydantic import BaseModel, Field
client = OpenAI(
api_key=os.environ["OPENAI_API_KEY"],
timeout=60.0,
max_retries=2, # account for these if you also retry in-app
)
class RefundAnswer(BaseModel):
window_days: int = Field(description="Refund window in days")
applies_to: str
uncertain: bool
resp = client.responses.parse(
model="gpt-4.1-mini",
store=False, # do not retain response state unless product needs it
input=[
{"role": "system", "content": "Extract refund policy facts. Set uncertain=true if missing."},
{"role": "user", "content": "Annual plans: 14-day refund from purchase date."},
],
text_format=RefundAnswer,
)
print(resp.output_parsed)
print(resp.usage)
emb = client.embeddings.create(
model="text-embedding-3-small",
input=["Annual plans: 14-day refund from purchase date."],
)
vector = emb.data[0].embedding
assert len(vector) == 1536
completion = client.chat.completions.create(
model="gpt-4.1-mini",
temperature=0,
messages=[
{"role": "system", "content": "Be concise. Cite uncertainty."},
{"role": "user", "content": "Summarize our refund window in one sentence."},
],
)
print(completion.choices[0].message.content)
print(completion.id, completion.usage)
Validation loop:
python -c "from openai import OpenAI; c=OpenAI(); print(c.models.list().data[0].id)"
# Smoke: one Responses call with store=false; assert usage tokens > 0
| Signature | Likely cause | Fix path |
|---|---|---|
| 401 / invalid_api_key | Missing/wrong key or project | Fix env; verify project access |
| 429 rate_limit | RPM/TPM burst; nested retries | Honor Retry-After; backoff+jitter; pace; raise limits |
| 429 / insufficient_quota | Billing/quota exhausted | Do not blind-retry; fix billing |
| Truncated / cut-off output | Low max output tokens / context overflow | Raise output cap; shorten input; summarize history |
| Schema validation errors | Loose prompting without Structured Outputs | Use .parse + Pydantic/JSON Schema |
| Tool args invalid / unsafe | Model freestyle | Strict schema; server-side validate; allowlist |
| “Data retained” compliance alarm | Responses store default true | Set store=false or enable ZDR |
| Azure mismatch | Wrong base_url / deployment name | Azure OpenAI client config; deployment ≠ model nickname |
| Embedding dim mismatch vs vector DB | Model or dimensions changed | Recreate collection; re-embed (@qdrant) |
usage (input/output tokens) in @mlflow or your metrics stack; alert on cost spikes.openai package.@ai-evaluation-dataset).@anthropic-api — Claude Messages API@langchain / @llamaindex — orchestration / RAG layers@qdrant / @chromadb — embedding stores@mlflow — usage/cost experiments@ai-evaluation-dataset — golden evalsMANDATORY: Keys from environment only. Prefer Responses for new integrations; set
store=falsewhen retention is not required. Pin models; use Structured Outputs for mechanical parsing; allowlist/validate tools. Honor Retry-After on 429; never retry quota/billing failures in a tight loop. Log usage + ids; redact secrets from logs.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub alivirgo/major-ai-skills --plugin major-ai-skills412 skills in this plugin
/3d-slicerAutomate 3D Slicer research workflows with MRML, VTK/ITK, DICOM data, and Segment Editor. Use for software workflows, not clinical interpretation./abbreviated-git-statusInspect Git branch, staging, and working-tree changes with short or porcelain status output when a compact repository check is needed./ableton-liveAutomate Ableton Live sessions with Python MIDI Remote Scripts, Max for Live, AbletonOSC, and Link synchronization./act-as-a-personal-tutorExplain a subject step by step, assess prior knowledge, and use short exercises to check understanding before advancing.Other plugins' skills for the same job