From e19665d15193ca92b6a09565b639b9d0028b51f4 Mon Sep 17 00:00:00 2001 From: "kiloconnect[bot]" <240665456+kiloconnect[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 14:35:08 +0000 Subject: [PATCH 1/3] docs(kilo-docs): add xAI SuperGrok subscription and OAuth login documentation --- packages/kilo-docs/pages/ai-providers/xai.md | 97 ++++++++++++++++++-- 1 file changed, 89 insertions(+), 8 deletions(-) diff --git a/packages/kilo-docs/pages/ai-providers/xai.md b/packages/kilo-docs/pages/ai-providers/xai.md index dc74332d781..9ffe02dae88 100644 --- a/packages/kilo-docs/pages/ai-providers/xai.md +++ b/packages/kilo-docs/pages/ai-providers/xai.md @@ -1,6 +1,6 @@ --- title: "Using xAI Grok with Kilo Code" -description: "Connect xAI's Grok models to Kilo Code. Guide to getting an API key and configuring Grok in VS Code and the CLI." +description: "Connect xAI's Grok models to Kilo Code. Use a SuperGrok subscription via OAuth or a paid API key. Guide to setup in VS Code and the CLI." sidebar_label: xAI (Grok) --- @@ -10,14 +10,93 @@ xAI is the company behind Grok, a large language model known for its conversatio **Website:** [https://x.ai/](https://x.ai/) -## Getting an API Key +Kilo Code supports two ways to connect xAI: -1. **Sign Up/Sign In:** Go to the [xAI Console](https://console.x.ai/). Create an account or sign in. -2. **Navigate to API Keys:** Go to the API keys section in your dashboard. -3. **Create a Key:** Click to create a new API key. Give your key a descriptive name (e.g., "Kilo Code"). -4. **Copy the Key:** **Important:** Copy the API key _immediately_. You will not be able to see it again. Store it securely. +- **SuperGrok subscription (OAuth):** If you subscribe to SuperGrok, you can sign in with OAuth — no separate API key or pay-as-you-go charges required. +- **API key:** For pay-as-you-go access via the xAI API. -## Configuration in Kilo Code +--- + +## Option 1: SuperGrok Subscription (OAuth) + +If you have an active [SuperGrok subscription](https://x.ai/grok), you can authenticate with xAI using OAuth and use Grok models directly without needing a separate API key. + +### Why use SuperGrok? + +- **No API billing:** Usage counts against your SuperGrok subscription, not a pay-per-token API account. +- **OAuth login — no API keys:** Sign in through your browser and Kilo Code handles token management automatically. +- **Automatic token refresh:** Kilo Code refreshes your access token in the background so long-running sessions stay authenticated. + +{% callout type="note" %} +SuperGrok subscription access works with Kilo Code's core functionality (VS Code extension and CLI). For cloud features such as Cloud Agents or KiloClaw, use the [Kilo Gateway](/docs/gateway). +{% /callout %} + +### Setup with SuperGrok + +{% tabs %} +{% tab label="VSCode (Legacy)" %} + +1. Open Kilo Code settings (click the gear icon {% codicon name="gear" /%} in the Kilo Code panel). +2. In **API Provider**, select **xAI**. +3. Click **Sign in with xAI (SuperGrok)**. +4. Complete the authorization flow in your browser. +5. Back in Kilo Code settings, select your desired Grok model. +6. Save. + +{% /tab %} +{% tab label="VSCode" %} + +Open **Settings** (gear icon) and go to the **Providers** tab. Select the xAI provider and choose the **xAI Grok OAuth (SuperGrok Subscription)** sign-in option. Complete the OAuth flow in your browser. + +For headless or remote environments (VPS, SSH, Docker, WSL) where a browser redirect to `127.0.0.1` is not reachable, choose **xAI Grok OAuth (Headless / Remote / VPS)** instead. You will be shown a short code to enter at a URL you open on any device with a browser. + +{% /tab %} +{% tab label="CLI" %} + +Run the auth command and follow the xAI SuperGrok sign-in flow: + +```bash +kilo auth login --provider xai +``` + +Kilo Code offers two OAuth methods at the prompt: + +- **xAI Grok OAuth (SuperGrok Subscription)** — opens `https://auth.x.ai` in your browser for a standard PKCE OAuth flow. Best for local desktop environments. +- **xAI Grok OAuth (Headless / Remote / VPS)** — uses the RFC 8628 device-code flow. The CLI displays a short code and a URL; open the URL on any device with a browser, enter the code, and the CLI completes the login. Use this when running on a VPS, behind SSH, inside Docker, WSL, or CI where `127.0.0.1:56121` is not accessible from your browser. +- **Manually enter API Key** — fall back to a standard API key if you prefer. + +Then set your default model: + +```jsonc +{ + "model": "xai/grok-3", +} +``` + +{% /tab %} +{% /tabs %} + +### Tips for SuperGrok + +- **Subscription required:** You need an active SuperGrok subscription. This option will not work with a free xAI account. +- **Sign out:** To disconnect in VS Code, use the "Disconnect" button in the provider settings. In the CLI, run `kilo auth logout` and choose xAI. +- **Port 56121:** The browser OAuth flow (PKCE) starts a short-lived local server on `127.0.0.1:56121` to receive the OAuth callback. If another application is already using that port, use the headless device-code method instead. +- **Token rotation:** xAI rotates refresh tokens on each use. Kilo Code persists the latest tokens automatically. If you run Kilo Code from multiple processes simultaneously, the first refresh can invalidate the other process's token — re-run `kilo auth login --provider xai` to restore the session. + +--- + +## Option 2: API Key + +If you prefer pay-as-you-go access or do not have a SuperGrok subscription, you can use an xAI API key. + +### Getting an API Key + +1. **Sign Up/Sign In:** Go to the [xAI Console](https://console.x.ai/). Create an account or sign in. +2. **Navigate to API Keys:** Go to the API keys section in your dashboard. +3. **Create a Key:** Click to create a new API key. Give your key a descriptive name (e.g., "Kilo Code"). +4. **Copy the Key:** **Important:** Copy the API key _immediately_. You will not be able to see it again. Store it securely. + +### Configuration with API Key {% tabs %} {% tab label="VSCode (Legacy)" %} @@ -68,6 +147,8 @@ Then set your default model: {% /tab %} {% /tabs %} +--- + ## Reasoning Capabilities Some models feature specialized reasoning capabilities, allowing them to "think before responding" - particularly useful for complex problem-solving tasks. @@ -91,5 +172,5 @@ Choose `low` for simple queries that should complete quickly, and `high` for har - **Context Window:** Most Grok models feature large context windows (up to 131K tokens), allowing you to include substantial amounts of code and context in your prompts. - **Vision Capabilities:** Select vision-enabled models (`grok-2-vision-latest`, `grok-2-vision`, etc.) when you need to process or analyze images. -- **Pricing:** Pricing varies by model, with input costs ranging from $0.3 to $5.0 per million tokens and output costs from $0.5 to $25.0 per million tokens. Refer to the xAI documentation for the most current pricing information. +- **Pricing:** API key pricing varies by model, with input costs ranging from $0.3 to $5.0 per million tokens and output costs from $0.5 to $25.0 per million tokens. Refer to the xAI documentation for the most current pricing information. - **Performance Tradeoffs:** "Fast" variants typically offer quicker response times but may have higher costs, while "mini" variants are more economical but may have reduced capabilities. From d74e95ccf8971c8e20e7c1e85cfeda39918edeab Mon Sep 17 00:00:00 2001 From: "kiloconnect[bot]" <240665456+kiloconnect[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 16:41:01 +0000 Subject: [PATCH 2/3] docs(kilo-docs): mention xAI BYOK on Gateway in SuperGrok callout --- packages/kilo-docs/pages/ai-providers/xai.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kilo-docs/pages/ai-providers/xai.md b/packages/kilo-docs/pages/ai-providers/xai.md index 9ffe02dae88..63c2d1c8492 100644 --- a/packages/kilo-docs/pages/ai-providers/xai.md +++ b/packages/kilo-docs/pages/ai-providers/xai.md @@ -28,7 +28,7 @@ If you have an active [SuperGrok subscription](https://x.ai/grok), you can authe - **Automatic token refresh:** Kilo Code refreshes your access token in the background so long-running sessions stay authenticated. {% callout type="note" %} -SuperGrok subscription access works with Kilo Code's core functionality (VS Code extension and CLI). For cloud features such as Cloud Agents or KiloClaw, use the [Kilo Gateway](/docs/gateway). +SuperGrok subscription access works with Kilo Code's core functionality (VS Code extension and CLI). For cloud features such as Cloud Agents or KiloClaw, use the [Kilo Gateway](/docs/gateway) — the Gateway supports xAI via [BYOK](/docs/getting-started/byok) with an API key (OAuth/SuperGrok is not supported through the Gateway). {% /callout %} ### Setup with SuperGrok From b63dafe5a63f34149e72f42911f55160db54c182 Mon Sep 17 00:00:00 2001 From: "kiloconnect[bot]" <240665456+kiloconnect[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 16:42:55 +0000 Subject: [PATCH 3/3] docs(kilo-docs): note 'Show more providers' step to find xAI in VSCode --- packages/kilo-docs/pages/ai-providers/xai.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/kilo-docs/pages/ai-providers/xai.md b/packages/kilo-docs/pages/ai-providers/xai.md index 63c2d1c8492..6de7feabd42 100644 --- a/packages/kilo-docs/pages/ai-providers/xai.md +++ b/packages/kilo-docs/pages/ai-providers/xai.md @@ -46,7 +46,7 @@ SuperGrok subscription access works with Kilo Code's core functionality (VS Code {% /tab %} {% tab label="VSCode" %} -Open **Settings** (gear icon) and go to the **Providers** tab. Select the xAI provider and choose the **xAI Grok OAuth (SuperGrok Subscription)** sign-in option. Complete the OAuth flow in your browser. +Open **Settings** (gear icon) and go to the **Providers** tab. Click **Show more providers**, then search for or select **xAI**. Choose the **xAI Grok OAuth (SuperGrok Subscription)** sign-in option and complete the OAuth flow in your browser. For headless or remote environments (VPS, SSH, Docker, WSL) where a browser redirect to `127.0.0.1` is not reachable, choose **xAI Grok OAuth (Headless / Remote / VPS)** instead. You will be shown a short code to enter at a URL you open on any device with a browser. @@ -109,7 +109,7 @@ If you prefer pay-as-you-go access or do not have a SuperGrok subscription, you {% /tab %} {% tab label="VSCode" %} -Open **Settings** (gear icon) and go to the **Providers** tab to add xAI and enter your API key. +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. You can also edit the config file directly — see the **CLI** tab for the file format.