Skip to main content
OpenAI provides the GPT family and o-series reasoning models. Access via API key or through OpenAI Codex OAuth.

Setup

Get your API key from the OpenAI Platform.
export OPENAI_API_KEY=sk-...

Config

{
  "providers": {
    "openai": "${OPENAI_API_KEY}"
  }
}

Use it

{
  "agents": [
    { "name": "coder", "model": "openai:gpt-4o" }
  ]
}
Polpo auto-infers openai from gpt-, o1-, o3-, o4-, chatgpt-, and codex- prefixes.

Models

GPT-5 Series

ModelBest forContextReasoning
gpt-5.2Latest flagship — fast reasoning, strong codingYes
gpt-5.1Great for coding and agentic tasksYes
gpt-5Flagship general-purposeYes
gpt-5-miniSmaller 5-series, cost-effectiveYes

GPT-4 Series

ModelBest forContextReasoning
gpt-4oMultimodal — text, vision, audio128KNo
gpt-4.1Improved instruction following1MNo
gpt-4o-miniCheap and fast for simple tasks128KNo

O-Series (Reasoning)

ModelBest forContextReasoning
o3Deep reasoning, complex logic and math200KYes
o3-proMore compute for harder problems200KYes
o4-miniFast reasoning at lower cost200KYes
o3-miniSmall reasoning model200KYes
Also available: gpt-5-nano, gpt-5-pro, gpt-5.1-codex, gpt-5.1-codex-max, gpt-5.2-codex, gpt-4.1-mini, gpt-4.1-nano, codex-mini-latest
The o-series models (o3, o4-mini) use chain-of-thought reasoning. They’re slower but significantly better at complex logic, math, and multi-step planning. Good choice for the orchestrator model or a reviewer agent.

Features

FeatureSupported
StreamingYes
Tool useYes
Vision (images)Yes (GPT-4o, GPT-4.1, GPT-5.x)
ReasoningYes (o-series, GPT-5.x)

Pricing

ModelInput (per 1M tokens)Output (per 1M tokens)
gpt-5.2$1.75$14.00
gpt-5$2.00$8.00
gpt-4o$2.50$10.00
gpt-4.1$2.00$8.00
o3$10.00$40.00
o4-mini$1.10$4.40
gpt-4o-mini$0.15$0.60

Provider Details

Provider IDopenai
Env variableOPENAI_API_KEY
API typeOpenAI Responses API
Auto-infer prefixesgpt-, o1-, o3-, o4-, chatgpt-, codex-
Base URL overrideSupported

OAuth: Use Your ChatGPT Subscription (Codex)

If you have a ChatGPT Plus or Pro subscription, you can use it directly via the OpenAI Codex OAuth flow — no separate API key or billing account needed.

Supported Subscriptions

PlanWorksNotes
ChatGPT ProYesHighest rate limits
ChatGPT PlusYesStandard rate limits
ChatGPT FreeNoInsufficient API access

Login

polpo auth login openai-codex
OpenAI Codex uses an Auth Code + PKCE flow with a localhost callback server:
  1. Polpo opens a browser window for authorization
  2. Log in with your OpenAI/ChatGPT account
  3. The callback server on localhost:1455 captures the token automatically
  4. If the callback fails, you can paste the redirect URL manually
Logging in to OpenAI Codex (ChatGPT Plus/Pro)...

Opening browser for authorization...
Waiting for callback on localhost:1455...

Login successful!
Profile saved as: openai-codex:user@gmail.com
Stored in ~/.polpo/auth-profiles.json
Port 1455 must be available on your machine. If another service is using it, the callback will fail — in that case, paste the redirect URL manually when prompted.

Provider ID

When using Codex OAuth, the provider ID is openai-codex (not openai):
{
  "agents": [
    { "name": "coder", "model": "openai-codex:gpt-4o" }
  ]
}
The same OpenAI models are available through both openai (API key) and openai-codex (OAuth). Polpo resolves whichever has a valid credential.

Token Refresh

OAuth tokens expire. Polpo handles this automatically:
  • Before each API call, Polpo checks if the token is expired
  • If expired and a refresh token exists, it refreshes silently
  • If no refresh token is available, the profile is skipped and Polpo falls back to other credentials

Multiple Accounts & Profile Rotation

You can log in with multiple OpenAI accounts. Each gets its own profile:
openai-codex:user@personal.com
openai-codex:user@work.com
Polpo rotates between them using the same algorithm as all providers: oldest lastUsed first, skipping profiles in cooldown or billing disable.

Billing Disable

If your ChatGPT subscription quota is exceeded, the profile enters billing disable — a longer backoff (5h → 10h → 20h → 24h cap) than regular rate-limit cooldown. Other Codex profiles or openai API keys continue working normally.

Session Pinning

Pin a specific Codex profile for the session:
/model openai-codex/gpt-4o@openai-codex:user@work.com
Reset with /model reset.

Resolution Order

1. polpo.json providers.openai.apiKey       (config wins)
2. OPENAI_API_KEY environment variable       (env var)
3. Stored openai-codex OAuth profiles        (auto-refresh)
For the full authentication system — all OAuth providers, CLI commands, profile rotation algorithm, and security details — see the Authentication guide.

Notes

  • The GPT-5 series represents OpenAI’s latest generation with built-in reasoning and vision.
  • GPT-4.1 has a 1M token context window — useful for large codebase tasks.
  • Use gpt-4o-mini for the “fast-worker” pattern: assign it formatting, boilerplate, and simple refactoring where speed and cost matter more than peak quality.
  • o3 is the strongest standalone reasoning model from OpenAI — consider it for reviewer agents and complex planning tasks.
  • Codex variants (gpt-5.1-codex, gpt-5.2-codex) are optimized for long-running agentic coding tasks.