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

Setup guide - Documented by Kilo Code

Use Grok in Kilo Code

Kilo Code supports xAI two ways: OAuth with a SuperGrok or X Premium subscription, or a pay-as-you-go xAI API key, in the VS Code extension and the CLI.

Last verified 5 steps3 official sources

Steps

  1. Step 1.

    API key: go to the xAI Console (https://console.x.ai/), open the API keys section, create a key (e.g. "Kilo Code") and copy it immediately.

  2. Step 2.

    Open Settings (gear icon) and go to the Providers tab. Click Show more providers, then search for or select xAI and enter your API key. The extension stores this in your kilo.json config file.

  3. Step 3.

    Subscription instead: in the same xAI provider entry choose the xAI Grok OAuth (SuperGrok / X Premium) sign-in option and complete the OAuth flow in your browser. For headless or remote environments choose xAI Grok OAuth (Headless / Remote / VPS) and enter the short code at the URL shown.

  4. Step 4.

    CLI sign-in (also used to restore a session if a token refresh in another process invalidated it):

    Terminal
    kilo auth login --provider xai
  5. Step 5.

    To sign out in the CLI, run kilo auth logout and choose xAI.

    Terminal
    kilo auth logout

Caveats

  • The browser OAuth flow starts a short-lived local server on 127.0.0.1:56121; use the headless device-code method if that port is busy.
  • Subscription OAuth is not supported through the Kilo Gateway / Cloud Agents; those need BYOK with an xAI API key.
  • Kilo's tips section still cites old details (131K context, grok-2-vision ids); current ids and context sizes come from docs.x.ai/developers/models (grok-4.7: 500k context).
  • Kilo docs moved to kilo.ai/docs/ai-providers/xai.

FAQ

How do I use Grok in Kilo Code?

Kilo Code supports xAI two ways: OAuth with a SuperGrok or X Premium subscription, or a pay-as-you-go xAI API key, in the VS Code extension and the CLI.

Which Grok model ids work in Kilo Code?

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

Is this an official Grok and Kilo Code setup?

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

Sources

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