Setup
Get your API key
- Go to platform.openai.com/api-keys
- Sign in with your OpenAI account
- Click Create new secret key
- Give it a name (e.g., “Craft Agents”)
- Copy your API key (starts with
sk-proj-orsk-)
Add connection in Craft Agents
- Open Settings → AI Connections
- Click Add Connection
- Select OpenAI (API Key)
- Paste your API key
- Choose your default model (e.g.,
gpt-5orgpt-4o) - Click Save
Available Models
Craft Agents automatically detects GPT models available on your API key:Model availability depends on your OpenAI account tier and API access. GPT-5 models may require special access.
packages/shared/src/config/llm-connections.ts:410-416
Using Pi Unified API
OpenAI connections in Craft Agents use the Pi unified LLM API as the backend. This provides:- Automatic credential management - API keys are securely stored and injected
- Model detection - Automatically lists available models
- Error handling - User-friendly error messages for common issues
- Tool support - MCP servers, APIs, and built-in tools
packages/shared/src/config/llm-connections.ts:49-58
Pricing
OpenAI pricing is based on input and output tokens. Current rates (as of March 2026):| Model | Input | Output | Context Window |
|---|---|---|---|
| GPT-5.2 | $30/M tokens | $120/M tokens | 200K |
| GPT-5 | $15/M tokens | $60/M tokens | 200K |
| GPT-4o | $2.50/M tokens | $10/M tokens | 128K |
| o4-mini | $3/M tokens | $12/M tokens | 128K |
| o3 | $10/M tokens | $40/M tokens | 200K |
OpenAI requires a paid account with credits or a valid payment method. Free trial credits are available for new accounts.
Vision and Multimodal
GPT-4o and newer models support vision and multimodal inputs:- Images: Drag and drop PNG, JPEG, WebP, GIF files
- Documents: PDF (automatically converted to images)
Example
Troubleshooting
Authentication failed
Authentication failed
Error:
Authentication failed. Check your API key or OAuth token.Solutions:- Verify your API key starts with
sk-orsk-proj-and has no extra whitespace - Check that your OpenAI account is active and has credits
- Ensure you’re not using an old/revoked API key
- Try creating a new API key in the OpenAI dashboard
Rate limits
Rate limits
Error:
Rate limited or quota exceeded. Try again later.OpenAI enforces rate limits based on your tier:- Tier 1 (new accounts): 500 requests/day
- Tier 5 (high usage): 10,000 requests/minute
Insufficient credits
Insufficient credits
Error:
Billing issue. Check your account credits or payment method.Your OpenAI account has run out of credits:- Go to platform.openai.com/settings/organization/billing
- Add a payment method or purchase more credits
- Wait a few minutes for the changes to take effect
Model not available
Model not available
Error:
Model not found. Check the connection configuration.Some models require special access:- GPT-5 requires waitlist approval from OpenAI
- o4-mini/o3 require Tier 3+ API access
- Check your account’s model availability
OpenAI vs ChatGPT Plus
Craft Agents supports two ways to use OpenAI models:| Feature | OpenAI API Key | ChatGPT Plus OAuth |
|---|---|---|
| Cost | Pay-per-use (tokens) | $20/month subscription |
| Models | All GPT models | Same as API |
| Rate limits | Based on tier | Higher limits |
| Setup | API key | One-click OAuth |
| Billing | Per-token | Flat monthly fee |
ChatGPT Plus OAuth uses the Codex auth provider (
openai-codex) which provides higher rate limits than standard API keys.- Open Settings → AI Connections
- Click Add Connection
- Select ChatGPT Plus (OAuth)
- Sign in with your OpenAI account
apps/electron/src/renderer/hooks/useOnboarding.ts:549-551
Comparing OpenAI to Claude
| Feature | OpenAI (GPT) | Anthropic (Claude) |
|---|---|---|
| Reasoning | o3, o4-mini (strong) | Claude Opus 4.6 (excellent) |
| Speed | gpt-4o (fast) | Claude Haiku 4.5 (faster) |
| Context | 128K-200K | 200K |
| Vision | GPT-4o (excellent) | Claude (excellent) |
| Pricing | 30/M tokens | 15/M tokens |
| Tool use | Good | Excellent |
Next Steps
Add Claude
Compare with Claude models
GitHub Copilot
Use your Copilot subscription