Overview
OpenAI’s GPT-4 and GPT-3.5 models are reliable, well-documented AI coding assistants. Known for consistency, strong general-purpose capabilities, and excellent documentation generation.GPT-4 Turbo offers the best balance of performance and cost for most coding tasks.
Quick Start
1
Get API Key
- Go to platform.openai.com
- Sign up or log in
- Navigate to API Keys
- Click Create new secret key
- Copy your API key (starts with
sk-)
2
Add Credits
OpenAI requires prepaid credits:
- Go to Billing → Add payment method
- Add credit card
- Purchase credits ($5+ recommended)
3
Configure Forge
Edit
.forge/config.json:4
Test Connection
Available Models
GPT-4 Family
Best overall GPT-4 model
- Context: 128K tokens
- Speed: Fast
- Cost: 30/MTok output
- Best for: Complex coding tasks
Original GPT-4 (legacy)
- Context: 8K tokens
- Speed: Slower
- Cost: 60/MTok output
- Best for: Nothing (use Turbo instead)
GPT-3.5 Family
Fast and affordable
- Context: 16K tokens
- Speed: Very fast
- Cost: 1.50/MTok output
- Best for: Simple tasks, quick fixes
Model Comparison
Configuration
Basic Setup
Advanced Configuration
Your OpenAI organization ID (for enterprise accounts)
Maximum tokens in response (1-4096)
Randomness (0-2)
- 0 = Deterministic
- 1 = Balanced
- 2 = Creative
OpenAI’s Strengths
Consistency
GPT-4 produces reliable, consistent results:General Purpose
Good at everything, great at nothing:Documentation
Excellent at writing clear documentation:Large Ecosystem
Most tools integrate with OpenAI:- Extensive docs
- Large community
- Many examples
- Well-tested
OpenAI’s Weaknesses
Expensive
GPT-4 is one of the most expensive options:Not Exceptional
Jack of all trades, master of none:- Claude better at reasoning
- Gemini faster and cheaper
- Cursor better at UI
Requires Prepaid Credits
Can’t pay-as-you-go:- Must purchase credits upfront
- Minimum $5
- Credits expire (usually 1 year)
Pricing
Per-Token Costs
Prepaid Credits
Best Use Cases
Documentation
General Coding
Testing
Consistency-Critical Tasks
When you need predictable results:Integration with Forge
Using in Tasks
Multiple OpenAI Configs
Configure both GPT-4 and GPT-3.5:Cost Optimization
Use GPT-3.5 for Simple Tasks
Reduce Context
Lower Max Tokens
Monitor Spending
Troubleshooting
401 Invalid API Key
401 Invalid API Key
Error: “Incorrect API key provided”Solutions:
- Verify API key from platform.openai.com
- Check for extra spaces
- Ensure key hasn’t been deleted
- Generate new key
429 Rate Limit
429 Rate Limit
Error: “Rate limit reached”Solutions:
- Wait a few seconds
- Reduce concurrent requests
- Upgrade tier (Tier 1 → Tier 2)
- Use exponential backoff
Insufficient Credits
Insufficient Credits
Error: “You exceeded your current quota”Solutions:
- Add more credits: platform.openai.com/billing
- Check billing dashboard
- Verify payment method
Slow responses
Slow responses
Issue: GPT-4 taking too longSolutions:
- Use GPT-4 Turbo (not regular GPT-4)
- Use GPT-3.5 for simple tasks
- Reduce maxTokens
- Check OpenAI status page
Context length error
Context length error
Error: “This model’s maximum context length is…”Solutions:
- Use GPT-4 Turbo (128K context)
- Reduce input context
- Split task into smaller pieces
Rate Limits
By Tier
RPM = Requests per minute
TPM = Tokens per minute
Check your tier: platform.openai.com/account/limits
Best Practices
Use GPT-3.5 for Simple Tasks
Monitor Usage
Set Budget Alerts
On OpenAI dashboard:
- Set hard limit ($50/month)
- Email alerts at 75%, 90%
Use for Documentation
GPT-4 excels at docs:
OpenAI vs Other Agents
Choose OpenAI for: Documentation, consistency, general purpose
Choose Claude for: Complex reasoning, architecture
Choose Gemini for: Speed, cost, large context
Choose Cursor for: UI/UX, frontend
Real-World Examples
Example 1: API Documentation
Example 2: Test Generation
Next Steps
Get Started
Create your first GPT-4 task
Other Agents
Compare with other AI agents
Cost Optimization
Reduce OpenAI spending
OpenAI Platform
Manage your API keys and billing

