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

Setup guide - Documented by Aider

Use Grok in Aider

Aider documents xAI directly: export XAI_API_KEY and run aider with an xai/<model> name. The documented examples are Grok 3; current ids use the same xai/ prefix.

Last verified 4 steps4 official sources

Steps

  1. Step 1.

    Install aider:

    Terminal
    python -m pip install aider-install
    aider-install
  2. Step 2.

    Configure your API key:

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

    List models available from xAI:

    Terminal
    aider --list-models xai/
  4. Step 4.

    Start aider in your project with a Grok model using the documented xai/ prefix plus a current xAI model id (combined with xAI's model list):

    Terminal
    cd /to/your/project
    aider --model xai/grok-4.7

Caveats

  • Aider's xAI page only shows Grok 3 examples (xai/grok-3-beta, xai/grok-3-mini-beta, etc.). grok-3 was retired by xAI on May 15, 2026 and now redirects to grok-4.3. The command aider --model xai/grok-4.7 combines aider's documented xai/ prefix with the current model id from docs.x.ai; check that aider --list-models xai/ shows it for your aider version.
  • The --reasoning-effort example on aider's page targets Grok 3 Mini; grok-4.7 supports low, medium, high (default) and xhigh per xAI docs, but aider's handling for it is not documented.

FAQ

How do I use Grok in Aider?

Aider documents xAI directly: export XAI_API_KEY and run aider with an xai/<model> name. The documented examples are Grok 3; current ids use the same xai/ prefix.

Which Grok model ids work in Aider?

The official docs read for this guide list xai/grok-4.7, xai/grok-4.3 and xai/grok-build-0.1. Requests go to https://api.x.ai/v1.

Is this an official Grok and Aider setup?

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

Sources

Last verified against 4 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.