Setup guide - Documented by Aider
Use OpenAI in Aider
Aider works with OpenAI's models via OPENAI_API_KEY (or --api-key openai=<key>) and aider --model <model-name> for any OpenAI model.
Last verified 4 steps2 official sources
Steps
- Step 1.
Install aider.
Terminalpython -m pip install aider-install aider-install - Step 2.
Configure your API key.
Terminalexport OPENAI_API_KEY=<key> # Mac/Linux setx OPENAI_API_KEY <key> # Windows, restart shell after setx - Step 3.
Start aider in your codebase with an OpenAI model. Aider documents that aider --model <model-name> works for any other OpenAI model.
Terminal# Change directory into your codebase cd /to/your/project aider --model <model-name> - Step 4.
List models available from OpenAI.
Terminalaider --list-models openai/
Caveats
- Aider's OpenAI page examples are older models (o3-mini, o1-mini, gpt-4o); the GPT-6 ids come from OpenAI's model catalog. Confirm with aider --list-models openai/.
- Reasoning models may need aider's reasoning model settings (and --reasoning-effort) if you see temperature or system prompt errors.
More setup guides
Same tool, other providers
Related reading
- 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.
- OpenAI Pando: The Git Backend Built for Codex-Scale PushesOpenAI built Pando, a Git-compatible backend, after Codex flooded its monorepo with pushes. What it changed, the trade-offs, and what it means for your agent fleet.
- GPT-6.1 Terra: $1/$5 Pricing, Benchmarks, and When to Pick ItGPT-6.1 Terra is OpenAI's new $1/$5 per million token model: 50.3% on Terminal-Bench 4.0 (vendor-reported), half Sol's price, and who should route to it.
- Codex CLI 0.164: /presets and Inline /model FlagsCodex CLI 0.164.0 adds ten /presets slots, inline /model and /permissions arguments, and credential masking for remote commands. What to try and what to check.
- Codex Reset: Banked vs Automatic vs Paid, and When to Use EachCodex has three kinds of usage reset - banked, automatic and paid - and they move your weekly refresh date in different ways. What OpenAI documents, the 80% rule, and what to do Monday.
- OpenAI Models on Google Cloud: What Changes for DevelopersOpenAI and Google Cloud put GPT-6 Astra, GPT-6.1 Sol and GPT-6 Luna into Model Garden in private preview, with Codex pointed at Gemini inference. What is live, what is "coming soon", and what to do before general availability.
FAQ
How do I use OpenAI in Aider?
Aider works with OpenAI's models via OPENAI_API_KEY (or --api-key openai=<key>) and aider --model <model-name> for any OpenAI model.
Which OpenAI model ids work in Aider?
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 Aider setup?
Aider documents this setup in its own docs. It was last checked against 2 official pages on October 17, 2026.
Sources
Last verified against 2 official pages.
- aider.chathttps://aider.chat/docs/llms/openai.html
- 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.