OpenAI official SDK usage (Python, Node.js). Use when: writing code that calls OpenAI API, implementing chat/embeddings/images/audio features, handling streaming responses, async patterns, error handling with SDK. For raw HTTP/REST calls, see `openai-api` skill.
/plugin marketplace add timequity/vibe-coder/plugin install vibe-coder@vibe-coderThis skill inherits all available tools. When active, it can use any tool Claude has access to.
references/nodejs.mdreferences/python.mdreferences/streaming.mdOfficial SDKs for Python and Node.js. Handles auth, retries, types automatically.
pip install openai
from openai import OpenAI
client = OpenAI() # Uses OPENAI_API_KEY env var
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
npm install openai
import OpenAI from "openai";
const client = new OpenAI(); // Uses OPENAI_API_KEY env var
const response = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);
export OPENAI_API_KEY="sk-..."
export OPENAI_ORG_ID="org-..." # Optional
export OPENAI_PROJECT_ID="proj-..." # Optional
| Feature | Python | Node.js |
|---|---|---|
| Sync client | OpenAI() | new OpenAI() |
| Async client | AsyncOpenAI() | Same (async/await) |
| Streaming | stream=True | stream: true |
| Auto-retry | Built-in | Built-in |
| Timeout | timeout=60 | timeout: 60000 |
| Types | Full typing | TypeScript |
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hi"}]
)
stream = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hi"}],
stream=True
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")
response = client.embeddings.create(
model="text-embedding-3-small",
input="Hello world"
)
vector = response.data[0].embedding
response = client.images.generate(
model="dall-e-3",
prompt="A sunset over mountains",
size="1024x1024"
)
url = response.data[0].url
with open("audio.mp3", "rb") as f:
transcript = client.audio.transcriptions.create(
model="whisper-1",
file=f
)
print(transcript.text)
from openai import OpenAI, APIError, RateLimitError
client = OpenAI()
try:
response = client.chat.completions.create(...)
except RateLimitError:
# Retry with backoff
except APIError as e:
print(f"API error: {e.status_code}")
openai-api skill — Raw REST API without SDKThis skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.