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

# Use CC Switch to Configure KiosAPI for Claude Code

> Use CC Switch to switch Claude Code to use KiosAPI as the API backend, making it easy to toggle between providers from the command line.

CC Switch is a tool that lets you switch Claude Code between different API providers without manually editing environment variables or config files. This tutorial walks you through installing CC Switch, adding KiosAPI as a named provider, and switching Claude Code to use it.

## Prerequisites

* [Claude Code](/tutorials/claude-code) installed and configured
* A **KiosAPI API key** (starts with `sk-`) from the [Dashboard](https://kiosapi.com) → **Token Management**
* **Node.js 18+**

<Steps>
  ### Install CC Switch

  Install CC Switch globally via npm:

  ```bash theme={null}
  npm install -g cc-switch
  ```

  Verify the installation:

  ```bash theme={null}
  cc-switch --version
  ```

  ### Get your KiosAPI key

  1. Log in to the [KiosAPI Dashboard](https://kiosapi.com)
  2. Navigate to **Token Management**
  3. Create or copy an existing API key (starts with `sk-`)

  ### Add KiosAPI as a provider

  Create or edit the CC Switch configuration file at the path for your platform:

  | Platform | Config Path                                  |
  | -------- | -------------------------------------------- |
  | Windows  | `C:\Users\<username>\.cc-switch\config.json` |
  | macOS    | `/Users/<username>/.cc-switch/config.json`   |
  | Linux    | `/home/<username>/.cc-switch/config.json`    |

  Add the KiosAPI provider entry:

  ```json theme={null}
  {
    "providers": {
      "kiloapi": {
        "name": "KiloAPI",
        "baseUrl": "https://kiosapi.com",
        "apiKey": "sk-xxx",
        "model": "claude-sonnet-4-6",
        "smallFastModel": "claude-haiku-4-5-20251001",
        "disableBetas": true
      }
    },
    "default": "kiloapi"
  }
  ```

  Replace `sk-xxx` with your actual KiosAPI key.

  <Info>
    Set `"baseUrl"` to `https://kiosapi.com` — without `/v1`. Claude Code appends the API path automatically.
  </Info>

  ### (Optional) Set environment variables directly

  You can also configure the backend by setting environment variables instead of using the config file.

  <Tabs>
    <Tab title="macOS / Linux">
      Add the following to `~/.bashrc` or `~/.zshrc`:

      ```bash theme={null}
      export ANTHROPIC_BASE_URL="https://kiosapi.com"
      export ANTHROPIC_AUTH_TOKEN="sk-xxx"
      ```

      Then reload your shell:

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

    <Tab title="Windows (PowerShell)">
      ```powershell theme={null}
      setx ANTHROPIC_BASE_URL "https://kiosapi.com"
      setx ANTHROPIC_AUTH_TOKEN "sk-xxx"
      ```
    </Tab>
  </Tabs>

  ### Switch Claude Code to KiosAPI

  Run the following command to activate the KiosAPI provider:

  ```bash theme={null}
  cc-switch use kiloapi
  ```

  ### Verify your setup

  Test that Claude Code is now routing through KiosAPI:

  ```bash theme={null}
  claude "Say hello"
  ```

  If Claude responds, CC Switch is correctly routing through KiosAPI.

  <Tip>
    Use the **`claude_cc`** token group on KiosAPI for the best pricing when using Claude Code.
  </Tip>
</Steps>

## Usage

<CodeGroup>
  ```bash Switch to KiosAPI theme={null}
  cc-switch use kiloapi
  ```

  ```bash Switch to another provider theme={null}
  cc-switch use anthropic
  ```

  ```bash Show current provider theme={null}
  cc-switch current
  ```

  ```bash List all providers theme={null}
  cc-switch list
  ```
</CodeGroup>

## Troubleshooting

### Provider not found

* Verify the provider name in `cc-switch use <name>` matches a key in `config.json`
* Check that the config file is at the correct path for your platform

### Authentication error after switching

* Ensure the `apiKey` in the config is correct and starts with `sk-`
* Verify `baseUrl` is `https://kiosapi.com` — no trailing slash, no `/v1`

### Invalid beta flag (400 error)

If you see a `400` error about beta flags, ensure `"disableBetas": true` is set in the provider config. This adds `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1` to the environment.

## Need Help?

* [Claude Code Setup Guide](/tutorials/claude-code)
* [KiosAPI Dashboard](https://kiosapi.com)
* [Available Models](../api-reference/models/list-models)
