openai-api
openai-api
Purpose
This skill provides direct access to the OpenAI API for tasks like generating text completions, handling function calls, managing assistants, and creating embeddings. It's designed for AI agents to integrate OpenAI's capabilities into workflows.
When to Use
Use this skill when you need dynamic text generation (e.g., for chatbots), embeddings for semantic search, or function calling for tool integration. Apply it in scenarios requiring real-time AI responses, such as code generation, content summarization, or data analysis. Avoid it for simple tasks; reserve for complex AI-driven operations where OpenAI's models outperform local alternatives.
Key Capabilities
- Text completions: Use the /completions endpoint for basic prompt-based generation with models like text-davinci-003.
- Chat completions: Leverage /chat/completions for conversational AI, supporting role-based messages and tools.
- Function calling: Enable tools via /chat/completions by defining functions in the request body for dynamic API interactions.
- Assistants: Manage custom assistants through /assistants endpoints for persistent AI agents with tools and files.
- Embeddings: Generate vector representations via /embeddings for applications like similarity search.
- Fine-tuning: Access /fine-tunes for customizing models, though this requires specific input formats like JSONL files.
Usage Patterns
Always set the API key via environment variable: export OPENAI_API_KEY=your_api_key. Make requests to the base URL https://api.openai.com/v1/. For CLI or script usage, use tools like curl or OpenAI's SDK. Structure requests with JSON payloads, including parameters like model (e.g., gpt-3.5-turbo) and max_tokens (e.g., 150). Handle rate limits by implementing retry logic with exponential backoff. To use function calling, include a "tools" array in your request and check the response for "tool_calls".
More from alphaonedev/openclaw-graph
playwright-scraper
Playwright web scraping: dynamic content, auth flows, pagination, data extraction, screenshots
1.4Kgcp-iam
Manages identity and access control for Google Cloud resources using IAM policies and roles.
370humanize-ai-text
AI text humanization: reduce AI-detection patterns, natural phrasing, tone adjustment
260macos-automation
AppleScript, JXA, Shortcuts, Automator, osascript, System Events, accessibility API
173tavily-web-search
Tavily: web search optimized for AI agents, answer synthesis, domain filtering, depth control
154clawflows
OpenClaw workflow automation: multi-step task chains, conditional logic, triggers, schedule
102