Skip to content

OpenAI Configuration

OpenAI GPT Configuration

OpenCode Configuration

Add to your opencode.json:

{
"providers": {
"openai": {
"apiKey": "${OPENAI_API_KEY}",
"models": {
"gpt-4o": {
"maxTokens": 4096
},
"gpt-4o-mini": {
"maxTokens": 4096
},
"gpt-4-turbo": {
"maxTokens": 4096
}
}
}
}
}

Environment Variables

Terminal window
export OPENAI_API_KEY="your-api-key"

Model Names for Agents

Use these model identifiers:

  • gpt-4o - Best quality and multimodal
  • gpt-4o-mini - Fast and affordable
  • gpt-4-turbo - Legacy high-performance

Rate Limits

ModelTier 1Tier 2Tier 3Tier 4Tier 5
gpt-4o500 RPM5000 RPM10000 RPM30000 RPM30000 RPM
gpt-4o-mini500 RPM5000 RPM10000 RPM30000 RPM30000 RPM

RPM = Requests Per Minute. Tier based on total spend.