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

# Claude Code

> Connect Claude Code to DreamTo with ANTHROPIC_BASE_URL and use Claude and other models for command-line coding.

[Claude Code](https://code.claude.com/docs) is Anthropic's command-line coding assistant. It reads code, edits files and runs commands in your terminal. It uses the Anthropic Messages protocol, which DreamTo supports natively, so you only need to set a few environment variables.

## Prerequisites

* Claude Code is installed (`claude --version` prints a version). See the [official docs](https://code.claude.com/docs) for installation.
* You have created an API Key on the **API Keys** page of the [DreamTo console](https://www.dreamto.ai/console).
* You have picked a Claude model ID in the [Model Marketplace](https://www.dreamto.ai/models), such as `claude-sonnet-5-5` or `claude-opus-5-5`. For the full list, see [Anthropic Messages](https://docs.dreamto.ai/en/llm/anthropic-messages.md).

## Key settings

| Environment variable | Value | Notes |
| - | - | - |
| `ANTHROPIC_BASE_URL` | `https://api.dreamto.ai` | No `/v1`; Claude Code appends `/v1/messages` itself |
| `ANTHROPIC_AUTH_TOKEN` | Your DreamTo API Key | Sent as `Authorization: Bearer`; recommended |
| `ANTHROPIC_API_KEY` | Your DreamTo API Key | Sent as `x-api-key`; use this or the previous one |
| `ANTHROPIC_MODEL` | e.g. `claude-sonnet-5-5` | Default main model |
| `ANTHROPIC_DEFAULT_OPUS_MODEL` | e.g. `claude-opus-5-5` | Model for the `opus` alias |
| `ANTHROPIC_DEFAULT_SONNET_MODEL` | e.g. `claude-sonnet-5-5` | Model for the `sonnet` alias |
| `ANTHROPIC_DEFAULT_HAIKU_MODEL` | e.g. `claude-haiku-5-5` | Small model for the `haiku` alias and background tasks |

> [!NOTE]
>
> Older versions used `ANTHROPIC_SMALL_FAST_MODEL` for the background model. It is now deprecated; use `ANTHROPIC_DEFAULT_HAIKU_MODEL` in newer versions. Setting both does not conflict.

## Setup

**1. Edit settings.json (recommended)**

Edit the user-level config file `~/.claude/settings.json` (`%USERPROFILE%\.claude\settings.json` on Windows) and add the following under `env`. If the file already exists, merge only the `env` field and keep your other settings.

```json ~/.claude/settings.json theme={null}
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.dreamto.ai",
    "ANTHROPIC_AUTH_TOKEN": "sk-xxxx",
    "ANTHROPIC_MODEL": "claude-sonnet-5-5",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-5-5",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5-5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-5-5",
    "API_TIMEOUT_MS": "600000"
  }
}
```

Values in `settings.json` are passed as-is, with no shell expansion of `~`, `$HOME` and the like. To apply the settings to a single project only, put them in `.claude/settings.local.json` in the project directory (not committed).

**2. Or use environment variables**

For quick tests or CI, you can set them directly in your shell:

```bash macOS / Linux theme={null}
export ANTHROPIC_BASE_URL="https://api.dreamto.ai"
export ANTHROPIC_AUTH_TOKEN="sk-xxxx"
export ANTHROPIC_MODEL="claude-sonnet-5-5"
claude
```

```powershell Windows PowerShell theme={null}
$env:ANTHROPIC_BASE_URL = "https://api.dreamto.ai"
$env:ANTHROPIC_AUTH_TOKEN = "sk-xxxx"
$env:ANTHROPIC_MODEL = "claude-sonnet-5-5"
claude
```

```bat Windows CMD theme={null}
set ANTHROPIC_BASE_URL=https://api.dreamto.ai
set ANTHROPIC_AUTH_TOKEN=sk-xxxx
set ANTHROPIC_MODEL=claude-sonnet-5-5
claude
```

To make them permanent, add the `export` lines to `~/.zshrc` / `~/.bashrc`. On Windows, use "Edit the system environment variables" or `setx`.

**3. Skip first-run onboarding (if needed)**

On first launch, Claude Code may ask you to sign in to an Anthropic account. When using your own gateway, add `"hasCompletedOnboarding": true` at the top level of `~/.claude.json` (`C:\Users\<username>\.claude.json` on Windows), save, and reopen your terminal.

**4. Launch and verify**

Reopen your terminal, run `claude` in your project directory, and type `/status` to see the current Base URL and model. Then send "Hello"; a normal reply means the setup works. You can also test quickly in non-interactive mode:

```bash theme={null}
claude -p "Introduce yourself in one sentence" --model claude-sonnet-5-5
```

## Switching models

* At launch: `claude --model claude-opus-5-5`
* During a session: type `/model` and choose the `opus` / `sonnet` / `haiku` alias (which calls the model set in the matching `ANTHROPIC_DEFAULT_*_MODEL` above), or enter a full model ID.

> [!TIP]
>
> Claude Code relies on tool calling, long context and streaming, so Claude models are recommended. Whether other models work reliably in Claude Code depends on how well they support tool calling over the Anthropic Messages protocol.

## FAQ

> [accordion] 401 / Invalid API key
>
> * Make sure `ANTHROPIC_AUTH_TOKEN` (or `ANTHROPIC_API_KEY`) is a key from the DreamTo console.
> * If you previously signed in to an Anthropic account, or an old `ANTHROPIC_API_KEY` is still set in your shell, it may override the new config. Run `unset ANTHROPIC_API_KEY` and retry, or keep all settings in `settings.json`.
> * Restart Claude Code after editing `settings.json`; running sessions don't pick up new values.

> [accordion] 404 / model not found
>
> * Don't set `ANTHROPIC_BASE_URL` to `https://api.dreamto.ai/v1`, or requests go to `/v1/v1/messages`.
> * Check that `ANTHROPIC_MODEL` and all three `ANTHROPIC_DEFAULT_*_MODEL` values are model IDs that exist in the Model Marketplace. Background tasks use the Haiku model; if it is wrong, the main conversation works but errors appear intermittently.

> [accordion] anthropic-beta / Extra inputs are not permitted
>
> Newer versions of Claude Code send pre-release `anthropic-beta` headers and related fields. If you hit beta-related parameter errors, add `"CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"` to `env` to drop them.

> [accordion] Long tasks time out or streaming breaks
>
> Raise `API_TIMEOUT_MS` (in milliseconds; default 600000). If you're behind a corporate proxy, make sure it doesn't buffer or truncate the SSE stream.

> [accordion] Disabling telemetry and auto-update requests
>
> Set `"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"` to turn off auto-updates, telemetry, error reporting and other non-essential network requests. Note that setting it to `0` also takes effect; delete it to restore the defaults.

> [!NOTE]
>
> `settings.json` applies to the command-line Claude Code. The Claude Code extensions for JetBrains and VS Code reuse the same config. If your desktop app doesn't read this file, you can manage it with [CC Switch](https://docs.dreamto.ai/en/integrations/cc-switch.md).


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