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

# Claude Code

> Use Claude Code with Onetoken

## Quickstart

This guide gets Claude Code talking to Onetoken in a few minutes.

### 1. Install Claude Code

#### Install script

<CodeGroup>
  ```shellscript macOS theme={null} theme={null}
  curl -fsSL https://claude.ai/install.sh | bash
  ```

  ```shellscript Windows theme={null} theme={null}
  irm https://claude.ai/install.ps1 | iex
  ```
</CodeGroup>

#### npm

Requires [Node.js 18+](https://nodejs.org/en/download/)

```shellscript theme={null} theme={null}
npm install -g @anthropic-ai/claude-code
```

### 2. Point Claude Code at Onetoken

For Anthropic-compatible access via Onetoken, set:

1. `BASE_URL` → `https://onetoken.one`
2. `AUTH_TOKEN` → API key from [Onetoken](https://onetoken.one/console/token)
3. `MODEL` → a model id from the [model list](https://onetoken.one/pricing)

<Tabs>
  <Tab title="macOS">
    1) Check your default shell:

    ```shellscript theme={null} theme={null}
    echo $SHELL
    ```

    2. Append exports (replace `ONETOKEN_API_KEY`):

    <CodeGroup>
      ```shellscript Zsh theme={null} theme={null}
      echo 'export BASE_URL="https://onetoken.one"' >> ~/.zshrc
      echo 'export AUTH_TOKEN="ONETOKEN_API_KEY"' >> ~/.zshrc
      echo 'export MODEL="claude-sonnet-4-5"' >> ~/.zshrc
      ```

      ```shellscript Bash theme={null} theme={null}
      echo 'export BASE_URL="https://onetoken.one"' >> ~/.bash_profile
      echo 'export AUTH_TOKEN="ONETOKEN_API_KEY"' >> ~/.bash_profile
      echo 'export MODEL="claude-sonnet-4-5"' >> ~/.bash_profile
      ```
    </CodeGroup>

    3. Reload:

    <CodeGroup>
      ```shellscript Zsh theme={null} theme={null}
      source ~/.zshrc
      ```

      ```shellscript Bash theme={null} theme={null}
      source ~/.bash_profile
      ```
    </CodeGroup>

    4. Verify in a new terminal:

    ```shellscript theme={null} theme={null}
    echo $BASE_URL
    echo $AUTH_TOKEN
    echo $MODEL
    ```
  </Tab>

  <Tab title="Windows">
    In CMD or PowerShell, set Onetoken base URL and [API key](https://onetoken.one/console/token) as user env vars.

    <Tabs>
      <Tab title="CMD">
        1. Run:

        ```shellscript theme={null} theme={null}
        REM Replace ONETOKEN_API_KEY
        setx AUTH_TOKEN "ONETOKEN_API_KEY"
        setx BASE_URL "https://onetoken.one"
        setx MODEL "claude-sonnet-4-5"
        ```

        2. New CMD window:

        ```shellscript theme={null} theme={null}
        echo %AUTH_TOKEN%
        echo %BASE_URL%
        echo %MODEL%
        ```
      </Tab>

      <Tab title="PowerShell">
        1. Run:

        ```shellscript theme={null} theme={null}
        # Replace ONETOKEN_API_KEY
        [Environment]::SetEnvironmentVariable("AUTH_TOKEN", "ONETOKEN_API_KEY", [EnvironmentVariableTarget]::User)
        [Environment]::SetEnvironmentVariable("BASE_URL", "https://onetoken.one", [EnvironmentVariableTarget]::User)
        [Environment]::SetEnvironmentVariable("MODEL", "claude-sonnet-4-5", [EnvironmentVariableTarget]::User)
        ```

        2. New PowerShell window:

        ```shellscript theme={null} theme={null}
        echo $env:AUTH_TOKEN
        echo $env:BASE_URL
        echo $env:MODEL
        ```
      </Tab>
    </Tabs>
  </Tab>
</Tabs>

### 3. Run

From your project:

```bash theme={null} theme={null}
$ cd /path/your-project
> claude
```

First launch may ask you to sign in to Anthropic. To skip:

<img src="https://mintcdn.com/onetoken-9a3c590a/Y02IerIYTPVRQQ-L/images/ClaudeCode-doc/1.webp?fit=max&auto=format&n=Y02IerIYTPVRQQ-L&q=85&s=8caea867b6cd8d0760303860734d56d6" alt="Cc 7" width="1622" height="438" data-path="public/cn/cc-7.jpg" data-path="images/ClaudeCode-doc/1.webp" />

1. Edit `~/.claude.json` (macOS/Linux) or `C:\Users\%USERNAME%\.claude.json` (Windows).
2. Set `hasCompletedOnboarding` to `true`:

```json theme={null} theme={null}
{
  "hasCompletedOnboarding": true
}
```

3. Save and run `claude` again.

#### More ways to pick models (priority high → low)

1. **In session**: `/model <name>` for a one-off switch.

```text theme={null} theme={null}
/model claude-sonnet-4-5
```

2. **CLI flag**: `claude --model <name>` for one run.

```text theme={null} theme={null}
claude --model claude-sonnet-4-5
```

3. **Env defaults** (global):

```shellscript theme={null} theme={null}
export DEFAULT_OPUS_MODEL="claude-opus-4-5"
export DEFAULT_SONNET_MODEL="claude-sonnet-4-5"
export DEFAULT_HAIKU_MODEL="claude-haiku-4-5"
```

* **OPUS** — hard reasoning / architecture
* **SONNET** — everyday coding
* **HAIKU** — quick checks, search

4. **`settings.json`** (project or user home):

```json theme={null} theme={null}
{
  "env": {
    "DEFAULT_OPUS_MODEL": "claude-opus-4-5",
    "DEFAULT_SONNET_MODEL": "claude-sonnet-4-5",
    "DEFAULT_HAIKU_MODEL": "claude-haiku-4-5"
  }
}
```

## CC-Switch

1. Open CC-Switch → **Add provider**.

<img src="https://mintcdn.com/onetoken-9a3c590a/KFIRj5hibFTyL0AW/images/claudecode/1.png?fit=max&auto=format&n=KFIRj5hibFTyL0AW&q=85&s=295800a351629928c4c600fd5cc40552" width="2000" height="1302" data-path="images/claudecode/1.png" />

2. Choose **Custom**.

<img src="https://mintcdn.com/onetoken-9a3c590a/KFIRj5hibFTyL0AW/images/claudecode/2.png?fit=max&auto=format&n=KFIRj5hibFTyL0AW&q=85&s=ec9804cbebac9663f314f34294bb7cd2" width="2000" height="1302" data-path="images/claudecode/2.png" />

3. Enter API key and endpoint.

<img src="https://mintcdn.com/onetoken-9a3c590a/KFIRj5hibFTyL0AW/images/claudecode/3.png?fit=max&auto=format&n=KFIRj5hibFTyL0AW&q=85&s=9f492b22bc49059dcb988b26103ae2e5" width="2022" height="1336" data-path="images/claudecode/3.png" />

4. **Add** to save.

<img src="https://mintcdn.com/onetoken-9a3c590a/KFIRj5hibFTyL0AW/images/claudecode/4.png?fit=max&auto=format&n=KFIRj5hibFTyL0AW&q=85&s=a534955d70b61579bd71df73edf88a77" width="2022" height="1336" data-path="images/claudecode/4.png" />

5. Home → select **onetoken** → **Start**.

<img src="https://mintcdn.com/onetoken-9a3c590a/KFIRj5hibFTyL0AW/images/claudecode/5.png?fit=max&auto=format&n=KFIRj5hibFTyL0AW&q=85&s=d380d7b68f9655bf58a0c7959dde12f9" width="2022" height="1336" data-path="images/claudecode/5.png" />

## VS Code extension

1. Install the extension.

<Frame>
  <img src="https://mintcdn.com/onetoken-9a3c590a/Y02IerIYTPVRQQ-L/images/ClaudeCode-doc/2.webp?fit=max&auto=format&n=Y02IerIYTPVRQQ-L&q=85&s=fe1d7be31bf9a402f8c99e4a8c99fd0c" alt="I Shot 2026 03 25 11 44 03" width="1958" height="724" data-path="images/iShot_2026-03-25_11.44.03.jpg" data-path="images/ClaudeCode-doc/2.webp" />
</Frame>

2. `Ctrl + Shift + P` / `Cmd + Shift + P` → **Settings**.

<Frame>
  <img src="https://mintcdn.com/onetoken-9a3c590a/Y02IerIYTPVRQQ-L/images/ClaudeCode-doc/3.webp?fit=max&auto=format&n=Y02IerIYTPVRQQ-L&q=85&s=0fc717f943e393b11d51675c369f12f2" alt="I Shot 2026 03 25 11 47 48" width="1772" height="976" data-path="images/iShot_2026-03-25_11.47.48.jpg" data-path="images/ClaudeCode-doc/3.webp" />
</Frame>

3. Search **Claude Code** → `Claude Code: Environment Variable` → **Edit in settings.json**.

<Frame>
  <img src="https://mintcdn.com/onetoken-9a3c590a/Y02IerIYTPVRQQ-L/images/ClaudeCode-doc/4.webp?fit=max&auto=format&n=Y02IerIYTPVRQQ-L&q=85&s=d339edb2b8be2377b30881d3ca79cd23" alt="I Shot 2026 03 25 11 49 37" width="1940" height="1248" data-path="images/iShot_2026-03-25_11.49.37.jpg" data-path="images/ClaudeCode-doc/4.webp" />
</Frame>

4. Fill `claudeCode.environmentVariables` with Onetoken values.

<Frame>
  <img src="https://mintcdn.com/onetoken-9a3c590a/KFIRj5hibFTyL0AW/images/claudecode/6.png?fit=max&auto=format&n=KFIRj5hibFTyL0AW&q=85&s=6624882ef17dbce5afe057b4e35c2ab4" alt="I Shot 2026 03 25 11 53 07" width="1156" height="304" data-path="images/iShot_2026-03-25_11.53.07.jpg" data-path="images/claudecode/6.png" />
</Frame>

## Using the deepseek model in Claude code

Available models `deepseek-r1-distill-qwen-14b` `deepseek-v3` `deepseek-v3-0324` `deepseek-v3-1-250821` `deepseek-v3.2` `deepseek-v4-flash` `deepseek-v4-pro`

Method 1: Directly modify the configuration file

Locate the `.claude.json` file in the user's home directory. The specific path is as follows:

* macOS / Linux: `~/.claude.json`
* Windows: `C:\Users\%USERNAME%\.claude.json`

Change the value of `ANTHROPIC_MODEL` to the name of the deepseek model.

```json theme={null} theme={null}
{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "sk-**",
    "ANTHROPIC_BASE_URL": "https://onetoken.one",
    "ANTHROPIC_MODEL": "deepseek-v4-pro"
  },
  "includeCoAuthoredBy": false
}
```

Method 2: Directly modify the configuration file using CC Switch. change the model name to the DeepSeek model name, and then restart Claude Code.

## FAQ

### Q: `401 , No token provided...`

In the Claude terminal run `/config`, enable **Use custom API key**, verify the token.

<img src="https://mintcdn.com/onetoken-9a3c590a/Y02IerIYTPVRQQ-L/images/ClaudeCode-doc/5.webp?fit=max&auto=format&n=Y02IerIYTPVRQQ-L&q=85&s=fd23d3b7d8a64146773599a485c91751" alt="install" width="1220" height="760" data-path="public/cn/cc-6.png" data-path="images/ClaudeCode-doc/5.webp" />

### Q: `zsh: command not found: claude` on macOS

The binary exists but isn’t on `PATH`. Common locations:

* `~/.claude/bin`
* `~/.local/bin`

```shellscript theme={null} theme={null}
ls -l ~/.claude/bin
# or
ls -l ~/.local/bin | grep claude
```

**If in `~/.claude/bin`:**

```shellscript theme={null} theme={null}
echo 'export PATH="$HOME/.claude/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
```

**If in `~/.local/bin`:**

```shellscript theme={null} theme={null}
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
```

Check:

```text theme={null} theme={null}
which claude
claude -v
```

### Q: Cannot reach Anthropic

Newer Claude Code builds expect **`AUTH_TOKEN`** instead of `API_KEY`. Update the header name and reload env—key value stays the same. Follow the env steps above.

### Q: Login API Error 403

<img src="https://mintcdn.com/onetoken-9a3c590a/gdX-WXR7O4SB8M6G/images/claudecode/7.png?fit=max&auto=format&n=gdX-WXR7O4SB8M6G&q=85&s=e0944190bab372a92e15bd26f9bd92b9" width="1692" height="543" data-path="images/claudecode/7.png" />

Upgrade Claude Code to the latest version and disable CC-Switch local proxy / failover if enabled.

### Q: How to enable 1-hour caching

1. Open the global configuration file \~/.claude/settings.json (or .claude/settings.json in the project directory);

2. Add the env field:

```

{ "env": { "ENABLE_PROMPT_CACHING_1H": "1" } }

```

Happy coding!
