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

# Claude Code

> Set up Anthropic's Claude Code CLI with KiosAPI to use Claude models in your terminal.

# Claude Code

[Claude Code](https://docs.anthropic.com/en/docs/claude-code) is Anthropic's official agentic coding tool that runs in your terminal. This guide shows you how to configure it to use KiosAPI as the backend provider.

## Prerequisites

* **Node.js 18+** — check with `node --version`
* A **KiosAPI API key** (starts with `sk-`) created in the **`Claude-Kiro`** group

## Get the right API key

Claude models on KiosAPI are served through the **`Claude-Kiro`** group, so your token must be created in that group:

1. Log in to the [KiosAPI Dashboard](https://kiosapi.com).
2. Go to **Console → Tokens** and click **Add Token**.
3. Select the group **`Claude-Kiro`** (0.05× multiplier — much cheaper than default).
4. Save and copy the key.

> [!WARNING]
>
> A key created in another group (for example `default` or `Free`) cannot call Claude models. If you get a "no available channel" or model-not-found error, check the token's group first. See [Choosing a Token Group](https://docs.kiosapi.com/getting-started/token-groups.md).

## Installation

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

Verify the installation:

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

## Skip Onboarding

After installing, skip the interactive onboarding wizard by editing `~/.claude.json`:

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

This prevents Claude Code from prompting you to sign in with an Anthropic account.

## Project Configuration

Create a `.claude/settings.json` file in your project root to inject environment variables:

```json theme={null}
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://kiosapi.com",
    "ANTHROPIC_AUTH_TOKEN": "sk-xxx",
    "ANTHROPIC_MODEL": "claude-sonnet-5",
    "ANTHROPIC_SMALL_FAST_MODEL": "claude-haiku-4-5",
    "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"
  }
}
```

Replace `sk-xxx` with your actual KiosAPI key from the `Claude-Kiro` group.

> [!NOTE]
>
> `ANTHROPIC_BASE_URL` must be `https://kiosapi.com` — no `/v1`, no trailing slash. Claude Code appends the API path automatically.

## Current Claude models on KiosAPI

| Model | Best for |
| - | - |
| `claude-opus-5` | Hardest reasoning tasks |
| `claude-opus-4-8` | Complex refactors and long agentic sessions |
| `claude-sonnet-5` | Daily coding — the recommended default |
| `claude-sonnet-4-6` | Balanced coding work |
| `claude-haiku-4-5` | Fast background/small-fast-model tasks |

The authoritative list with live pricing is the [Models & Pricing](https://kiosapi.com/pricing) page (filter by the `Claude-Kiro` group).

## Global Configuration

You can also set these environment variables globally so Claude Code works in any directory.

### Windows (PowerShell)

```powershell theme={null}
setx ANTHROPIC_BASE_URL "https://kiosapi.com"
setx ANTHROPIC_AUTH_TOKEN "sk-xxx"
setx ANTHROPIC_MODEL "claude-sonnet-5"
setx ANTHROPIC_SMALL_FAST_MODEL "claude-haiku-4-5"
setx CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS "1"
```

### 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"
export ANTHROPIC_MODEL="claude-sonnet-5"
export ANTHROPIC_SMALL_FAST_MODEL="claude-haiku-4-5"
export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS="1"
```

Then reload your shell:

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

### Global config file paths

| Platform | Path |
| - | - |
| Windows | `C:\Users\<username>\.claude.json` |
| macOS | `/Users/<username>/.claude.json` |
| Linux | `/home/<username>/.claude.json` |

## Usage

Navigate to your project directory and launch Claude Code:

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

This opens an interactive session where you can ask Claude to read, write, and modify code.

## Best Practices

### CLAUDE.md

Create a `CLAUDE.md` file in your project root to give Claude persistent context about your codebase, conventions, and common commands. Claude Code reads this file automatically on startup.

### File Permissions

Claude Code will ask for permission before reading or writing files. You can pre-approve directories by adding them to `.claude/settings.json`:

```json theme={null}
{
  "permissions": {
    "allow": ["Read(*)", "Write(src/**)", "Edit(src/**)"]
  }
}
```

### Context Management

Long sessions can consume a lot of context. Use these slash commands to manage it:

| Command | Description |
| - | - |
| `/clear` | Clears the entire conversation history |
| `/compact` | Summarizes and compresses the conversation to save context |

## Switching Models

Change the default model globally:

```bash theme={null}
claude config set --global env '{"ANTHROPIC_MODEL": "claude-opus-5"}'
```

Or switch to a lighter model for faster responses:

```bash theme={null}
claude config set --global env '{"ANTHROPIC_MODEL": "claude-haiku-4-5"}'
```

## Troubleshooting

### 400 Bad Request / Invalid Beta Flag

Add this environment variable to your configuration:

```json theme={null}
"CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"
```

This disables experimental beta headers that KiosAPI may not support.

### Length / Max Output Token Error

Add this to your `.claude/settings.json` env block:

```json theme={null}
"CLAUDE_CODE_MAX_OUTPUT_TOKENS": "32000"
```

### No Available Channel / Model Not Found

* Verify your token is in the **`Claude-Kiro`** group
* Verify the model name against the [pricing page](https://kiosapi.com/pricing) — old model IDs like `claude-3-5-sonnet-*` no longer exist
* Run `claude config set --global env '{"ANTHROPIC_MODEL": "claude-sonnet-5"}'` to reset to a current model

### Connection Refused / 401 Unauthorized

* Verify your API key is correct and starts with `sk-`
* Ensure `ANTHROPIC_BASE_URL` is set to `https://kiosapi.com` (no trailing slash, no `/v1`)
* Check that the token group supports Claude models (`Claude-Kiro`)

## Verify Your Setup

Run a simple test:

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

If Claude responds, your configuration is working correctly.

## Need Help?

* [KiosAPI Dashboard](https://kiosapi.com)
* [Choosing a Token Group](https://docs.kiosapi.com/getting-started/token-groups.md)
* [Available Models](https://kiosapi.com/pricing)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.