> ## Documentation Index
> Fetch the complete documentation index at: https://docs.routeway.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Grok CLI

> Use Grok CLI with Routeway to access Grok models and 50+ other models through a single API key.

Grok CLI is a third-party terminal client that works with OpenAI-compatible endpoints. Routeway provides a compatible endpoint, so you can use Grok CLI with your Routeway API key to access Grok models and many others.

<Note>
  Requires a valid Routeway API key. Get yours from the [dashboard](https://routeway.ai/dashboard/api-keys).
</Note>

***

## Setup

<Steps>
  <Step title="Install Grok CLI">
    Requires Node.js 18 or newer:

    ```bash theme={null}
    npm install -g @vibe-kit/grok-cli
    ```

    Verify the installation:

    ```bash theme={null}
    grok --version
    ```

    <Info>
      If you encounter permission issues, try `sudo` (macOS/Linux) or run the command prompt as administrator (Windows).
    </Info>
  </Step>

  <Step title="Configure environment variables">
    Grok CLI reads `GROK_BASE_URL` and `GROK_API_KEY` from your environment:

    <CodeGroup>
      ```bash Shell (macOS / Linux / WSL) theme={null}
      export GROK_BASE_URL="https://api.routeway.ai/v1"
      export GROK_API_KEY="YOUR_ROUTEWAY_API_KEY"
      ```

      ```powershell Windows PowerShell theme={null}
      $env:GROK_BASE_URL="https://api.routeway.ai/v1"
      $env:GROK_API_KEY="YOUR_ROUTEWAY_API_KEY"
      ```
    </CodeGroup>

    To make these persistent, add them to your shell profile (e.g. `~/.zshrc` or `~/.bashrc`).
  </Step>

  <Step title="Start using Grok CLI">
    Launch with a specific model:

    ```bash theme={null}
    grok --model grok-3
    ```

    Since you're connected to Routeway, you can use any available model:

    ```bash theme={null}
    # Grok models
    grok --model grok-3
    grok --model grok-3-fast
    grok --model grok-3-mini

    # Other providers through Routeway
    grok --model gpt-4.1
    grok --model claude-sonnet-4.5
    grok --model gemini-2.5-flash
    ```

    Browse all available models at [routeway.ai/models](https://routeway.ai/models).
  </Step>
</Steps>

***

## Available Grok Models

| Model         | Description                         |
| ------------- | ----------------------------------- |
| `grok-3`      | xAI flagship model                  |
| `grok-3-fast` | Faster, more cost-effective version |
| `grok-3-mini` | Lightweight version                 |

***

## Known Limitations

Grok CLI has limited compatibility with thinking/reasoning models. When you use a thinking model, the full reasoning content may be shown in the output.

If you want first-party CLI support for Routeway, consider [Claude Code](/integrations/agents/claude-code) or [Codex](/integrations/agents/codex).

***

## Troubleshooting

| Issue                            | Solution                                                                  |
| -------------------------------- | ------------------------------------------------------------------------- |
| `401 Unauthorized`               | Check your API key is correct and has credits                             |
| `GROK_BASE_URL not set`          | Ensure the environment variable is exported                               |
| `Model not found`                | Verify the model name at [routeway.ai/models](https://routeway.ai/models) |
| `Command not found: grok`        | Run `npm install -g @vibe-kit/grok-cli` again                             |
| Thinking content flooding output | Use a non-thinking model variant                                          |
