Answer: You can set the OpenAI API key with the --openai-api-key VALUE option, or via the AIDER_OPENAI_API_KEY environment variable. Status: Confirmed Entry: tool/aider/settings/set-openai-api-key Revision: 1 Digest: sha256:e91ee250a88f4cb7 (changes whenever the content changes) Timeline: Created: 2026-11-13T02:56:12Z Last changed: 2026-11-13T02:56:12Z Last verified: 2026-11-20T11:42:16Z Next check: 2026-11-21T11:42:16Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of option | --openai-api-key VALUE | [1] | 2026-11-20 environment variable | AIDER_OPENAI_API_KEY | [1] | 2026-11-20 Sources: [1] Aider. "aider.chat/docs/config/options.html". https://aider.chat/docs/config/options.html Role: primary. Accessed: 2026-11-20T11:42:16Z Quote: "--openai-api-key VALUE Specify the OpenAI API key" (Supports: option) Quote: "Environment variable: AIDER_OPENAI_API_KEY" (Supports: environment variable) Published: 2026-04-25T16:45:23Z Snapshot SHA-256: c132a31adc40bb987527d0bfe93b1ca7446017abc4be28a86e1f3c3644da182f (captured 2026-11-13T02:56:12Z) 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:12Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T11:42:16Z. No independent second source is configured for this entry Last successful check: 2026-11-20T11:42:16Z Last attempt: 2026-11-20T11:42:16Z Notes and limitations: Extracted automatically from a single official source (section "--openai-api-key VALUE"). Related: https://latestn.com/tool/aider/settings/specify-coding-conventions How do I specify coding conventions for Aider? https://latestn.com/tool/aider/settings/vertex-ai-environment-variables Which environment variables does Aider need for Vertex AI (VERTEXAI_PROJECT and VERTEXAI_LOCATION)? https://latestn.com/tool/aider/settings/vertex-ai-yaml-model-config How do I set the Vertex AI model in Aider's YAML config file? https://latestn.com/tool/aider/settings/set-api-key-yaml-config How do I configure the OpenAI or Anthropic API key for Aider in a YAML config file? https://latestn.com/tool/aider/settings/set-editor-option How do I set which editor Aider uses with the --editor option? https://latestn.com/tool/aider/settings/set-openai-anthropic-api-key-env How do I set the OpenAI or Anthropic API key for Aider using environment variables or a .env file? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T02:56:12Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/aider/settings/set-openai-api-key/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/settings/set-openai-api-key POST: https://latestn.com/dispute/tool/aider/settings/set-openai-api-key with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/aider/settings/set-openai-api-key?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I set the OpenAI API key for Aider? Revision 1, last verified 2026-11-20T11:42:16Z. https://latestn.com/tool/aider/settings/set-openai-api-key (accessed 2026-11-21T09:59:31Z). @misc{LatestN_tool_aider_settings_set_openai_api_key_r1, title = {How do I set the OpenAI API key for Aider?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/aider/settings/set-openai-api-key}}, note = {Revision 1; digest sha256:e91ee250a88f4cb7; last verified 2026-11-20T11:42:16Z; accessed 2026-11-21T09:59:31Z} } 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/settings/set-openai-api-key