openai-api
Use when integrating OpenAI models via the openai Node.js SDK — Chat Completions, tool use/function calling, structured outputs, vision, image generation (gpt-image-1), embeddings, streaming, or the Responses API. Also use when choosing between OpenAI models or migrating from the Assistants API.
| Model | Source |
|---|---|
| sonnet | pack: ai |
Full Reference
┏━ 🔧 openai-api ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Use when integrating OpenAI models via the ope… ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
OpenAI API
Section titled “OpenAI API”Direct OpenAI API access via the openai SDK. Chat Completions is the primary interface; the Responses API is the modern replacement for Assistants.
Quick Reference
Section titled “Quick Reference”| Item | Value |
|---|---|
| Install | npm install openai |
| SDK version | v4.x |
| Node.js minimum | 18+ |
| Env var | OPENAI_API_KEY |
| Default model | gpt-4o-mini (best value) |
| Code model | gpt-4.1 |
| Reasoning model | o4-mini |
| Embeddings model | text-embedding-3-small |
| Image generation | gpt-image-1 (DALL-E 3 deprecated May 2026) |
| Assistants API sunset | August 26, 2026 — use Responses API |
Reference Index
Section titled “Reference Index”| I want to… | File |
|---|---|
| Install the SDK and initialize the client | reference/setup.md |
| Choose the right model for my use case | reference/models.md |
| Send messages, stream responses, or build multi-turn chats | reference/chat-completions.md |
| Define tools and handle function calls | reference/tool-use.md |
| Guarantee JSON schema-conformant outputs | reference/structured-outputs.md |
| Send images or analyze visual content | reference/vision.md |
| Generate or edit images | reference/image-generation.md |
| Create vector embeddings for RAG or semantic search | reference/embeddings.md |
| Use the Responses API (Assistants replacement) | reference/responses-api.md |
| Handle errors, retry on rate limits, understand finish_reason | reference/error-handling.md |
Usage: Read the reference file matching your current task from the index above. Each file is self-contained with code examples and inline gotchas.
Related Skills
Section titled “Related Skills”vercel-ai-sdk— Multi-provider abstraction (wraps OpenAI + Anthropic + Gemini)anthropic-api— Claude alternativegoogle-genai— Gemini alternativepostgresql-pgvector— Store and query OpenAI embeddings in Postgres