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

# Claude Code

> Configure Claude Code to use Capriole AI.

## What is Claude Code

Claude Code is Anthropic's agentic coding tool for reading codebases, editing files, running commands, and integrating with development tools. This CLI setup uses Capriole AI by configuring Claude Code's API endpoint, auth token, and model environment variables.

## Prerequisites

Before you begin, make sure you have:

* A Capriole AI account ([Sign up here](https://capriole.ai))
* A Capriole AI API key ([Get your key](https://capriole.ai?view=api))

## Installation

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

## Configuration

Create or update `~/.claude/settings.json` for persistent setup:

```json theme={null}
{
  "model": "claude-latest",
  "effortLevel": "high",
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.caprioletech.com",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_CAPRIOLE_AI_API_KEY",
    "ANTHROPIC_MODEL": "claude-latest",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-latest",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-latest",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-latest",
    "ANTHROPIC_SMALL_FAST_MODEL": "claude-latest",
    "CLAUDE_CODE_SUBAGENT_MODEL": "claude-latest"
  }
}
```

For a one-time shell setup, export the same values before launching Claude Code:

```bash theme={null}
export ANTHROPIC_BASE_URL="https://api.caprioletech.com"
export ANTHROPIC_AUTH_TOKEN="YOUR_CAPRIOLE_AI_API_KEY"

export ANTHROPIC_MODEL="claude-latest"
export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-latest"
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-latest"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-latest"
export ANTHROPIC_SMALL_FAST_MODEL="claude-latest"
export CLAUDE_CODE_SUBAGENT_MODEL="claude-latest"
```

## Run Claude Code

After saving `~/.claude/settings.json` or exporting the variables, start Claude Code from your project directory:

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

For a one-time non-interactive run without a saved settings file, pass the model explicitly:

```bash theme={null}
claude --model claude-latest -p "Explain this repository."
```

## Supported models

Claude Code supports Claude latest, Fable 5, Opus 5, Opus 4.8, Opus 4.7, Opus 4.6, and Sonnet 4.6 through Capriole AI. Use `claude-latest` for new setups; it resolves to Fable 5.

* `claude-latest`
* `claude-fable-5`
* `claude-opus-5`
* `claude-opus-4-8`
* `claude-opus-4-7`
* `claude-opus-4-6`
* `claude-sonnet-4-6`

## Troubleshooting

### Why does Claude Code return an authentication error?

Confirm that `ANTHROPIC_AUTH_TOKEN` is exported in the same shell before launching `claude`. Use `ANTHROPIC_AUTH_TOKEN`, not `ANTHROPIC_API_KEY`, for this setup.

### Why do requests fail with endpoint errors?

Confirm that `ANTHROPIC_BASE_URL` is `https://api.caprioletech.com` without `/v1`; Claude Code sends requests to `/v1/messages` and `/v1/messages/count_tokens`.

### Why doesn't Claude Code use Claude latest?

Confirm that `model`, `ANTHROPIC_MODEL`, `ANTHROPIC_SMALL_FAST_MODEL`, and the default model environment variables are set before launch, then check `/model` or `/status` for an active session or settings override.

### Why doesn't Claude Code use the configured effort level?

Set `"effortLevel": "high"` in `~/.claude/settings.json`, then restart Claude Code. Claude Code settings accept `low`, `medium`, `high`, and `xhigh`; `max` is not accepted in `effortLevel`.

For the absolute maximum effort in a session, use `/effort max`, launch with `claude --effort max`, or set `CLAUDE_CODE_EFFORT_LEVEL=max` before launching `claude`.

### Why can't Claude Code select a concrete Opus model?

Update Claude Code with `claude update`, then run `claude --version`.

### Why does token counting or startup model discovery fail?

Keep the model environment variables in place and confirm that the model ID is `claude-latest` or a supported concrete Claude model ID. Capriole AI proxies `/v1/messages/count_tokens` to the selected upstream, so token-count preflight depends on that upstream supporting Anthropic token counting.

## Notes

* `~/.claude/settings.json` applies to your user account across projects. Use `YOUR_CAPRIOLE_AI_API_KEY` as a placeholder and replace it with your actual Capriole AI API key.
* `ANTHROPIC_BASE_URL` changes where Claude Code sends requests. The model environment variables control which model ID is sent.
* `ANTHROPIC_SMALL_FAST_MODEL` should match `claude-latest` so Claude Code helper requests use the same Capriole AI latest alias as the main conversation.
* This setup uses `high` as the documented default effort level. `xhigh` is also a persistent `effortLevel` option, while `max` is a session-level override and can spend more thinking tokens.
* Official references: [Claude Code setup](https://code.claude.com/docs/en/setup), [environment variables](https://code.claude.com/docs/en/env-vars), [model configuration](https://code.claude.com/docs/en/model-config), and [Claude effort](https://platform.claude.com/docs/en/build-with-claude/effort).
