skills/openai-sdk/SKILL.md
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.
npx skillsauth add timequity/vibe-coder openai-sdkInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Official 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 SDKdevelopment
Hidden quality gate that runs before showing "Done!" to user - ensures all tests pass, build succeeds, and requirements met before claiming completion
data-ai
Use when about to claim work is complete or fixed - requires running verification commands and confirming output before making any success claims
tools
Generate UI components from natural language descriptions. Use when: user asks for a page, component, or UI element. Triggers: "create page", "add component", "show form", "make button", "страница", "компонент", "форма".
content-media
10 ready-to-use themes with colors and fonts for consistent styling. Use when: applying visual themes to pages, components, or design systems. Triggers: "theme", "color palette", "color scheme", "fonts", "branding", "visual identity", "design system colors".