Setup guide - Documented by Kilo Code
Use OpenAI in Kilo Code
Kilo Code supports the official OpenAI API with an API key in both the VS Code extension (Settings > Providers) and the CLI (OPENAI_API_KEY or kilo.json). A separate ChatGPT subscription connection is also documented.
Last verified 5 steps2 official sources
Steps
- Step 1.
Create a key on the OpenAI Platform API keys page (https://platform.openai.com/api-keys) and copy it immediately.
- Step 2.
VS Code: open Settings (gear icon), go to the Providers tab, add OpenAI and enter your API key. The extension stores this in your kilo.json config file.
- Step 3.
CLI: set the API key as an environment variable.
Terminalexport OPENAI_API_KEY="your-api-key" - Step 4.
Or configure it in your config file (~/.config/kilo/kilo.json or ./kilo.json).
JSON{ "provider": { "openai": { "env": ["OPENAI_API_KEY"], }, }, } - Step 5.
Then set your default model. Kilo's docs example uses openai/gpt-4.1; substitute a current OpenAI model id in the same provider/model format.
JSON{ "model": "openai/gpt-4.1", }
Caveats
- Kilo's own example model is openai/gpt-4.1; the openai/gpt-6.* ids combine Kilo's documented provider/model format with model ids from OpenAI's catalog.
- An OpenAI API key uses your OpenAI Platform billing account, not your ChatGPT subscription; the ChatGPT subscription is a separate connection.
- Use Kilo's native azure provider for Azure OpenAI rather than a generic OpenAI-compatible provider.
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 Kilo Code?
Kilo Code supports the official OpenAI API with an API key in both the VS Code extension (Settings > Providers) and the CLI (OPENAI_API_KEY or kilo.json). A separate ChatGPT subscription connection is also documented.
Which OpenAI model ids work in Kilo Code?
The official docs read for this guide list openai/gpt-6.1-sol, openai/gpt-6-astra and openai/gpt-6-luna.
Is this an official OpenAI and Kilo Code setup?
Kilo Code documents this setup in its own docs. It was last checked against 2 official pages on November 8, 2026.
Sources
Last verified against 2 official pages.
- kilo.aihttps://kilo.ai/docs/ai-providers/openai
- 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.