Skip to main content
Watch: I Built an AI App Without Leaving Databricks

Setup guide - Documented by Aider

Use Gemini in Aider

Aider connects to Gemini natively by setting GEMINI_API_KEY and passing --model. It also documents a generic OpenAI-compatible route.

Last verified 3 steps5 official sources

Steps

  1. Step 1.

    Configure your API key.

    Terminal
    export GEMINI_API_KEY=<key> # Mac/Linux
    setx   GEMINI_API_KEY <key> # Windows, restart shell after setx
  2. Step 2.

    Start aider in your codebase. Aider's docs show these commands.

    Terminal
    # Change directory into your codebase
    cd /to/your/project
    
    # You can run the Gemini 2.5 Pro model with this shortcut:
    aider --model gemini
    
    # List models available from Gemini
    aider --list-models gemini/
  3. Step 3.

    Alternative (aider's OpenAI-compatible doc combined with Google's endpoint): set OPENAI_API_BASE to Gemini's OpenAI-compatible base URL and prefix the model name with openai/.

    Terminal
    export OPENAI_API_BASE=https://generativelanguage.googleapis.com/v1beta/openai/
    export OPENAI_API_KEY=<key>
    aider --model openai/gemini-3.8-flash

Caveats

  • The aider docs page is stale. It says --model gemini runs Gemini 2.5 Pro, but aider/models.py on main now maps "gemini" to "gemini/gemini-3-pro-preview", and Google lists Gemini 3 Pro Preview as Shut down. Pass an explicit current id such as gemini/gemini-3.8-flash rather than the alias.
  • The gemini-exp shortcut on aider's page maps to gemini/gemini-2.5-pro-exp-03-25, an old experimental model. It is not recommended.
  • The gemini/<id> form is inferred from aider's documented aider --list-models gemini/ command and its model alias table. The OpenAI-compatible alternative combines aider's documented OPENAI_API_BASE mechanism with Google's documented base URL, and aider warns about models it is not familiar with.

FAQ

How do I use Gemini in Aider?

Aider connects to Gemini natively by setting GEMINI_API_KEY and passing --model. It also documents a generic OpenAI-compatible route.

Which Gemini model ids work in Aider?

The official docs read for this guide list gemini/gemini-4-argon, gemini/gemini-3.8-flash, gemini/gemini-3.6-flash, gemini/gemini-3.1-pro-preview, gemini/gemini-2.5-pro and gemini/gemini-2.5-flash. Requests go to https://generativelanguage.googleapis.com/v1beta/openai/.

Is this an official Gemini and Aider setup?

Aider documents this setup in its own docs. It was last checked against 5 official pages on October 17, 2026.

Sources

Last verified against 5 official pages.

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.