Answer: To connect Aider to OpenAI models, provide your OpenAI API key either in the OPENAI_API_KEY environment variable or via the --api-key openai= command line switch, then run aider with --model . Status: Confirmed Entry: tool/aider/models/connect-aider-to-openai Revision: 1 Digest: sha256:377e0a66cbc4ec83 (changes whenever the content changes) Timeline: Created: 2026-11-13T02:56:30Z Last changed: 2026-11-13T02:56:30Z Last verified: 2026-11-20T11:43:12Z Next check: 2026-11-21T11:43:12Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of API key environment variable | OPENAI_API_KEY | [1] | 2026-11-20 API key command line switch | --api-key openai= | [1] | 2026-11-20 install command | python -m pip install aider-install | [1] | 2026-11-20 model selection flag | --model | [1] | 2026-11-20 example model | gpt-4o | [1] | 2026-11-20 Sources: [1] Aider. "aider.chat/docs/llms/openai.html". https://aider.chat/docs/llms/openai.html Role: primary. Accessed: 2026-11-20T11:43:12Z Quote: "provide your OpenAI API key either in the OPENAI_API_KEY environment variable" (Supports: API key environment variable) Quote: "or via the --api-key openai= command line switch" (Supports: API key command line switch) Quote: "python -m pip install aider-install" (Supports: install command) Quote: "You can use aider --model to use any other OpenAI model." (Supports: model selection flag) Quote: "aider --model gpt-4o" (Supports: example model) Published: 2026-04-25T16:45:23Z Snapshot SHA-256: fa057315b99a2ee479cec5af41ca016b997ebaadb3dcae1bddaf702c8d19ee10 (captured 2026-11-13T02:56:30Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-13T02:56:30Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T11:43:12Z. No independent second source is configured for this entry Last successful check: 2026-11-20T11:43:12Z Last attempt: 2026-11-20T11:43:12Z Notes and limitations: Extracted automatically from a single official source (section "OpenAI"). Related: https://latestn.com/tool/aider/models/connect-aider-to-openrouter How do I connect Aider to OpenRouter? https://latestn.com/tool/aider/models/connect-local-models How do I connect Aider to a local model? https://latestn.com/tool/aider/models/connect-openai-compatible-api How do I connect Aider to an OpenAI-compatible API? https://latestn.com/tool/aider/models/configure-github-copilot How do I configure Aider to use GitHub Copilot as its LLM? https://latestn.com/tool/aider/models/configure-vertex-ai How do I configure Aider to use Google Vertex AI models? https://latestn.com/tool/aider/models/connect-aider-to-azure How do I connect Aider to Azure OpenAI models? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T02:56:30Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/aider/models/connect-aider-to-openai/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/aider/models/connect-aider-to-openai POST: https://latestn.com/dispute/tool/aider/models/connect-aider-to-openai with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/aider/models/connect-aider-to-openai?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I connect Aider to OpenAI models? Revision 1, last verified 2026-11-20T11:43:12Z. https://latestn.com/tool/aider/models/connect-aider-to-openai (accessed 2026-11-21T10:03:50Z). @misc{LatestN_tool_aider_models_connect_aider_to_openai_r1, title = {How do I connect Aider to OpenAI models?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/aider/models/connect-aider-to-openai}}, note = {Revision 1; digest sha256:377e0a66cbc4ec83; last verified 2026-11-20T11:43:12Z; accessed 2026-11-21T10:03:50Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/aider/models/connect-aider-to-openai