Setup guide - Documented by Zed
Use OpenAI in Zed
Zed has a first-class OpenAI API provider for the Zed Agent, Inline Assistant and other Zed AI features, using an API key saved in the keychain or OPENAI_API_KEY, with custom model ids added under language_models.openai.available_models.
Last verified 3 steps3 official sources
Steps
- Step 1.
Create an API key on the OpenAI platform and make sure the account has credits or billing enabled.
- Step 2.
Open Agent Settings with agent: open settings, go to the OpenAI section and enter your OpenAI API key. Zed also reads OPENAI_API_KEY from the local Zed process environment.
- Step 3.
Add custom OpenAI models in your settings file when you need alternate model ids (example verbatim from Zed's docs; replace name with a current model id and set max_tokens to that model's context window).
JSON{ "language_models": { "openai": { "available_models": [ { "name": "gpt-5.2", "display_name": "gpt-5.2 high", "reasoning_effort": "high", "max_tokens": 272000, "max_completion_tokens": 20000 } ] } } }
Caveats
- Zed's example uses gpt-5.2; GPT-6 ids and their 1.05M context window come from OpenAI's model catalog, combined with Zed's documented custom-model config.
- You must provide the model's context window in max_tokens; for reasoning models set max_completion_tokens to avoid high reasoning-token costs.
- ChatGPT Plus and Pro subscriptions use a separate setup path (Use an Existing Subscription). Model access paths do not configure External Agents or Terminal Threads, which usually own their own model access.
More setup guides
Same tool, other providers
Related reading
- Droid vs Codex (2026): Factory vs OpenAI for Terminal Coding AgentsFactory Droid vs OpenAI Codex compared on models, pricing, headless CI, multi-agent work, extensibility and openness, with a clear recommendation for each kind of developer.
- The One Number That Predicts What AI Can Do NextOpenAI's chief scientist Jakub Pachocki says perplexity, how well a model predicts the next token, tracks every big jump in AI, and wants every lab to publish it.
- Codex CLI 0.171: codex exec --remote, Workspace On by DefaultCodex CLI 0.171.0 adds codex exec --remote to run headless sessions on an existing app server, turns on the TUI workspace by default and picks GPT-6.2 Sol.
- GPT-6.2 Astra and Sol: Pricing, Benchmarks and What to SwitchGPT-6.2 Astra costs $8/$40 per MTok (20% under GPT-6 Astra), Sol stays $2/$10. Vendor-reported benchmarks, cache rates, Codex setup and who should switch.
- Codex CLI 0.169: codex exec Trust, Side Chats and Model ProvidersCodex CLI 0.169.0 keeps project config and MCP servers off in untrusted directories under codex exec, adds --trust, side-chat tabs and a model provider picker.
- Codex Training Setting Re-Enabled? Two Switches to CheckDevelopers report Codex model training turning itself back on. What OpenAI documents, the second "Include environments" switch most people miss, and a five-minute check.
FAQ
How do I use OpenAI in Zed?
Zed has a first-class OpenAI API provider for the Zed Agent, Inline Assistant and other Zed AI features, using an API key saved in the keychain or OPENAI_API_KEY, with custom model ids added under language_models.openai.available_models.
Which OpenAI model ids work in Zed?
The official docs read for this guide list gpt-6.1-sol, gpt-6-astra and gpt-6-luna.
Is this an official OpenAI and Zed setup?
Zed documents this setup in its own docs. It was last checked against 3 official pages on November 8, 2026.
Sources
Last verified against 3 official pages.
- zed.devhttps://zed.dev/docs/ai/use-api-access
- zed.devhttps://zed.dev/docs/ai/llm-providers
- developers.openai.comhttps://developers.openai.com/api/docs/models
Newsletter
New models, set up the day they ship
One email per week. New model releases, the coding tools that support them and how to wire them up.