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

# Claude Code

> Setup Claude Code in 30 seconds and code with 50+ models including MiniMax, Kimi, GLM, DeepSeek, OpenAI, Gemini, and Claude. No expensive $200 subscription required. Get a Concentrate API key and pay as you go.

<Info>
  We guarantee full support with the Anthropic provider but have high support for many others.
</Info>

<Accordion title="Reasons to Use Concentrate with Claude Code">
  1. **Model Fallbacks** — Auto-retries across providers if a model is rate-limited or down.
  2. **Save up to 90%** — Mix cheap open-source models with frontier when you need it.
  3. **Swap Models Mid-Session** — Switch with `/model` on the fly, no restart needed.
  4. **Spend Controls** — Set a monthly budget cap so you never get a surprise bill.
  5. **Usage Analytics** — See every request, model, token count, and cost in your dashboard.
  6. [**Zero Data Retention (ZDR)**](https://concentrate.ai/docs/api-reference/endpoint/zero-data-retention) — You can choose to opt out of upstream provider data processing.
     * We're adding new [ZDR providers](https://concentrate.ai/docs/api-reference/endpoint/zero-data-retention) weekly.
</Accordion>

## Quick Start

<Accordion title="View prerequisites (before you begin)">
  <Steps>
    <Step title="Create a Concentrate AI account with an active API key">
      Log in at [concentrate.ai](https://concentrate.ai) and create an API key. Your key should start with `sk-cn`.
    </Step>

    <Step title="Install Claude Code">
      If you haven't installed Claude Code yet, follow the [official installation instructions](https://docs.anthropic.com/en/docs/claude-code/overview#installation). On most systems:

      Verify it's installed by running:

      ```bash theme={null}
      claude --version
      ```
    </Step>

    <Step title="Log out of existing Anthropic session (if applicable)">
      If you were previously logged in to Claude Code directly with Anthropic, you need to log out first. Open Claude Code and run:

      ```text theme={null}
      /logout
      ```

      This clears the existing Anthropic credentials so Claude Code will use your Concentrate environment variables instead.
    </Step>
  </Steps>
</Accordion>

```bash theme={null}
curl -fsSL https://concentrate.ai/scripts/setup-claude.sh | bash
```

To use a specific model, you can configure it by running this command within Claude Code:

```bash theme={null}
/model <model>
```

**Example Models:** minimax-m2-7-highspeed, kimi-k2-6, gpt-5.4, claude-opus-4-7

### Verify Installation

After running the setup script:

1. **Restart your terminal** or source your shell profile:
   ```bash theme={null}
   # For bash (Linux)
   source ~/.bashrc
   # For bash (macOS)
   source ~/.bash_profile
   # For zsh
   source ~/.zshrc
   ```
2. **Launch Claude Code**
   ```bash theme={null}
   claude
   ```
3. **Verify the connection:** Once inside Claude Code, run:
   ```text theme={null}
   /status
   ```
   You should see output confirming the Concentrate endpoint and your API key:
   ```text theme={null}
   API endpoint: https://api.concentrate.ai
   Auth: API key (sk-cn...)
   Model: claude-sonnet-4-20250514
   ```
   If the endpoint shows `api.anthropic.com` instead, your environment variables are not being picked up — see [Troubleshooting](https://concentrate.ai/docs/#troubleshooting).

## Manual Setup

If you prefer to configure Claude Code manually or the automated script doesn't work for your environment:

<Steps>
  <Step title="Set environment variables in your shell profile">
    Add the following to your shell profile (`~/.bashrc`, `~/.zshrc`, etc.):

    ```bash theme={null}
    export CONCENTRATE_API_KEY="your_api_key_here"
    export ANTHROPIC_BASE_URL="https://api.concentrate.ai"
    export ANTHROPIC_AUTH_TOKEN="$CONCENTRATE_API_KEY"
    export ANTHROPIC_API_KEY="" # Leave Empty.
    ```

    <Warning>
      These variables **must** be set in your shell profile (e.g. `~/.bashrc` or `~/.zshrc`). Do not put them in a project-level `.env` file — Claude Code does not read `.env` files.
    </Warning>

    Then reload your shell:

    ```bash theme={null}
    source ~/.bashrc # or ~/.zshrc
    ```
  </Step>

  <Step title="Verify the connection">
    Launch Claude Code and run `/status`:

    ```bash theme={null}
    claude
    ```

    ```text theme={null}
    /status
    ```

    Confirm the output shows `https://api.concentrate.ai` as the API endpoint. If it still shows `api.anthropic.com`, make sure you have [logged out](#prerequisites) of any existing Anthropic session and that your shell profile has been reloaded.
  </Step>
</Steps>

## Remove Concentrate AI

```bash theme={null}
curl -fsSL https://concentrate.ai/scripts/uninstall-claude.sh | bash
```

## Use Different Models

Claude Code works with most models on Concentrate. To use a specific model, you can configure it by running this command within Claude Code:

```bash theme={null}
/model <model>
```

Example Models:

* minimax-m2-7-highspeed
* kimi-k2-6
* gpt-5.4
* claude-opus-4-7

<Info>
  For non-Anthropic options like MiniMax, GLM, Kimi, OpenAI, Gemini, etc. and compatibility guidance, see our [Model Fortress](https://concentrate.ai/models) and filter integrations for Claude Code and filter by "High" compatibility.
</Info>

Concentrate makes it easy to use most models in Claude Code. Similar to how you might choose models in Cursor or VS Code, you can switch between options based on quality, speed, reasoning, or cost to find the best fit for your workflow.

### Resiliency

In addition to accessing models by other authors, Concentrate improves resiliency by giving you multiple ways to access Anthropic models. If Anthropic direct is down, you can use fallback options to route requests to Anthropic through another provider such as AWS Bedrock, Azure, or Google Vertex AI.

## How It Works

Claude Code natively communicates with the Anthropic Messages API. Concentrate AI exposes an Anthropic-compatible API layer at `https://api.concentrate.ai`, allowing Claude Code to connect to Concentrate the same way it connects to Anthropic directly.

By setting `ANTHROPIC_BASE_URL` to the Concentrate endpoint and providing your Concentrate API key, all Claude Code requests are routed through Concentrate for centralized billing, observability, token savings, and access controls, with no changes to the Claude Code experience.

Billing and usage are managed through your Concentrate AI credits. All usage, including reasoning tokens, appears in your [Concentrate dashboard](https://concentrate.ai/dashboard).

## Troubleshooting

<AccordionGroup>
  <Accordion title="API key not found error" icon="key">
    If you see an error about missing API key:

    1. Verify the environment variable is set:
       ```bash theme={null}
       echo $CONCENTRATE_API_KEY
       ```
    2. Make sure you've sourced your shell profile:
       ```bash theme={null}
       source ~/.bashrc # or appropriate file
       ```
    3. Confirm the variables are in your **shell profile** (`~/.bashrc`, `~/.zshrc`), not a `.env` file — Claude Code does not read `.env` files.
    4. If you were previously logged in to Anthropic directly, run `/logout` inside Claude Code first.
  </Accordion>

  <Accordion title="Invalid API key error" icon="triangle-exclamation">
    If your API key is rejected:

    1. Verify the key in your [dashboard](https://concentrate.ai).
    2. Ensure there are no extra spaces or quotes in the environment variable.
    3. Check that the key starts with `sk-cn`.
  </Accordion>

  <Accordion title="Connection errors" icon="wifi">
    If you cannot connect to the API:

    1. Verify `ANTHROPIC_BASE_URL` is set correctly:
       ```bash theme={null}
       echo $ANTHROPIC_BASE_URL
       # Should output: https://api.concentrate.ai
       ```
    2. Test the connection manually:
       ```bash theme={null}
       curl https://api.concentrate.ai/v1/responses/health
       ```
    3. Check your internet connection and firewall settings.
  </Accordion>

  <Accordion title="Still hitting api.anthropic.com" icon="brake-warning">
    If you're still connected to api.anthropic.com:

    * Run `/logout` in Claude Code.
    * Confirm `ANTHROPIC_API_KEY=""`.
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="API Reference" icon="code" href="/docs/api-reference/introduction">
    Explore the full API capabilities
  </Card>

  <Card title="Available Models" icon="layer-group" href="/docs/api-reference/endpoint/list-models">
    Browse all supported models
  </Card>

  <Card title="Auto Routing" icon="route" href="/docs/api-reference/endpoint/auto-routing">
    Optimize model selection automatically
  </Card>

  <Card title="Get Support" icon="life-ring" href="mailto:support@concentrate.ai">
    Contact our support team
  </Card>
</CardGroup>

## Feedback

If you encounter issues or have suggestions, email [support@concentrate.ai](mailto:support@concentrate.ai).

* Report bugs
* Feature requests
* Documentation improvements

We appreciate your patience as we continue to enhance the Claude Code integration.
