Agent skill
openai-api
OpenAI REST API integration guide. Use when: making direct HTTP calls to OpenAI API, understanding API structure without SDK, debugging API requests, learning request/response formats, handling errors and rate limits. Covers: authentication, Chat Completions, Embeddings, Images (DALL-E), Audio (Whisper/TTS), error handling, streaming.
Install this agent skill to your Project
npx add-skill https://github.com/timequity/vibe-coder/tree/main/skills/openai-api
SKILL.md
OpenAI REST API
Direct HTTP integration with OpenAI API. For SDK usage, see openai-sdk skill.
Base URL & Authentication
Base URL: https://api.openai.com/v1
curl https://api.openai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{...}'
Optional headers:
OpenAI-Organization: org-xxx— for multi-org accountsOpenAI-Project: proj-xxx— for project-specific billing
Core Endpoints
| Endpoint | Method | Use Case |
|---|---|---|
/chat/completions |
POST | Text generation, chat |
/embeddings |
POST | Vector embeddings |
/images/generations |
POST | DALL-E image creation |
/audio/transcriptions |
POST | Whisper speech-to-text |
/audio/speech |
POST | TTS text-to-speech |
/models |
GET | List available models |
Quick Reference
Chat Completions (most common)
curl https://api.openai.com/v1/chat/completions \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
]
}'
Response structure:
{
"id": "chatcmpl-xxx",
"choices": [{
"message": {"role": "assistant", "content": "Hi! How can I help?"},
"finish_reason": "stop"
}],
"usage": {"prompt_tokens": 10, "completion_tokens": 8, "total_tokens": 18}
}
Embeddings
curl https://api.openai.com/v1/embeddings \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "text-embedding-3-small", "input": "Hello world"}'
Streaming
Add "stream": true to request. Response is SSE:
data: {"choices":[{"delta":{"content":"Hello"}}]}
data: {"choices":[{"delta":{"content":" world"}}]}
data: [DONE]
References
- authentication.md — API keys, organization/project IDs
- chat-completions.md — Full Chat Completions API
- models.md — Model list, capabilities, pricing tiers
- errors.md — Error codes, retry strategies, rate limits
Official Documentation
For latest/complete docs, fetch:
https://cdn.openai.com/API/docs/txt/llms-api-reference.txthttps://cdn.openai.com/API/docs/txt/llms-guides.txt
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
mvp-help
Help and documentation for Idea to MVP plugin. Use when: user asks about building MVPs, vibe coding, or available commands. Triggers: "help", "what can you do", "mvp help", "how to build".
verification-gate
Hidden quality gate that runs before showing "Done!" to user - ensures all tests pass, build succeeds, and requirements met before claiming completion
brainstorming
Refine ideas into detailed designs through Socratic dialogue. Use when: user has rough idea, needs to clarify requirements, explore approaches. Triggers: "brainstorm", "discuss idea", "I'm thinking about", "what if", "help me think through", "explore options", "/brainstorm".
subagent-creator
Guide for creating effective subagents (custom agents). Use when users want to create a new subagent that can be dispatched via Task tool for autonomous work. Covers frontmatter fields (name, description, tools, model, permissionMode, skills), prompt design, and when to use subagents vs skills.
backend-rust
Modern Rust backend with Axum, SQLx, tokio + CI/CD automation. Use when: building Rust APIs, high-performance services, or needing build/test/lint/audit automation. Triggers: "axum", "rust backend", "rust api", "sqlx", "tokio", "cargo build", "cargo test", "clippy", "rustfmt", "cargo-audit", "cross-compile", "rust ci", "release build", "rust security", "shuttle", "actix".
test-driven-development
Write failing test first, then minimal code to pass. Red-Green-Refactor cycle. Use when: implementing features, fixing bugs, refactoring code. Triggers: "implement", "add feature", "fix bug", "tdd", "test first", "write tests", "test-driven".
Didn't find tool you were looking for?