# Claude Code

Run Claude Code on Boundless models: install, the settings.json to edit, model ids for every slot, a verify command and common errors.


Claude Code talks to the gateway in the Anthropic Messages format. You point it at Boundless with a few environment variables in `~/.claude/settings.json`, or let the [one-command setup](https://inference.boundless.network/docs/coding-agents-and-harnesses#set-up-with-one-command) write them for you.

Claude Code is built for Anthropic's models, and there is no supported setting for another provider. This works by overriding the API it talks to. Your key replaces your claude.ai login for as long as the file sets it, and behaviour tuned to Anthropic's models can come out differently.

## Choose your model

Claude Code uses a main model for foreground work and a smaller one for background work. The settings below use `deepseek/deepseek-v4.1-flash` for the main slots and `deepseek/deepseek-v4-flash-0731` for the background slot. Every model we serve is listed with its price and limits on the [models page](https://inference.boundless.network/models), and `GET https://api.inference.boundless.network/v1/models` returns the ids.

Laya, our System One model, cannot be Claude Code's model. Claude Code can call it before each tool call, though. [System One](https://inference.boundless.network/docs/system-one#gate-tool-calls-in-claude-code) has a hook that asks before a destructive command runs.

## Install

Install Claude Code from Anthropic's own documentation first. Then pick one way to point it at Boundless.

Run this in a terminal on macOS or Linux:

```bash
curl -fsSL https://boundless.md/install | sh
```

On Windows, or to skip the script, run the package yourself:

```bash
npx -y @boundless.md/setup@latest
```

It signs you in through your browser, creates a key on your account and asks which harnesses to configure. Choose **Claude Code**. It backs up every file it changes and finishes with one small request per model and wire format.

- You can keep your Anthropic login: choose **Anthropic account + Boundless**, and `/model` lists the Boundless models beside Anthropic's. It needs Claude Code 2.1.282 or later and is a preview on Linux and Windows.
- Project scope keeps the key in `.boundless/api-key`, ignored by git, and writes project-level configuration.

To put everything back the way it was before the first run:

```bash
curl -fsSL https://boundless.md/install | sh -s -- --revert
```

## Configure

### Claude Code

Anthropic Messages format. Put the configuration in `~/.claude/settings.json` so it applies everywhere. Exit Claude Code before changing this file; start a fresh session afterward.

```json
{
  "model": "deepseek/deepseek-v4.1-flash",
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.inference.boundless.network",
    "ANTHROPIC_AUTH_TOKEN": "your-boundless-key",
    "ANTHROPIC_MODEL": "deepseek/deepseek-v4.1-flash",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek/deepseek-v4.1-flash",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek/deepseek-v4.1-flash",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek/deepseek-v4-flash-0731",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
    "CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT": "1"
  }
}
```

- Use `ANTHROPIC_AUTH_TOKEN` (sends as `Authorization: Bearer`, works immediately) rather than `ANTHROPIC_API_KEY` (sends as `x-api-key`, requires interactive approval first).
- Set every model slot. Claude Code can pick its saved model or a family model for foreground and background work.
- Claude Code 2.1.27x refuses model ids missing from its built-in catalog, which is every model here. `CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT=1` restores the earlier behaviour of asking the API.
- The credential replaces your claude.ai login while set. Remove it from `settings.json` to go back. To keep the key out of the file, drop `ANTHROPIC_AUTH_TOKEN` and use [`apiKeyHelper`](https://code.claude.com/docs/en/settings-reference) instead.

```bash
claude --model "deepseek/deepseek-v4.1-flash" -p 'Use the Bash tool to run printf boundless, then report the output.'
```

## Model ids

Set every model slot, as the settings above do. They give `deepseek/deepseek-v4.1-flash` to `model`, `ANTHROPIC_MODEL` and the Opus and Sonnet slots, and `deepseek/deepseek-v4-flash-0731` to the Haiku slot. Use any id from `GET https://api.inference.boundless.network/v1/models`.

## Verify

Run the `claude -p` command from the setup above. The reply should report `boundless`.

To check the base URL and key on their own, list the models the gateway serves. A list of models means both are right. A `401` means the key is missing or wrong:

```bash
curl https://api.inference.boundless.network/v1/models -H "Authorization: Bearer YOUR_API_KEY"
```

## Let your agent do the setup

To have a coding agent do the setup instead, point it at [the setup guide](https://inference.boundless.network/setup.md): the same steps, written for an agent. Exit Claude Code first if it is the agent doing the work, because the new base URL applies to the next session.

## Common errors

| What you see | What it usually is |
| --- | --- |
| `401` on every request | Wrong header. Use `ANTHROPIC_AUTH_TOKEN`, or switch between `Authorization: Bearer` and `x-api-key`. |
| An error naming a model you never chose | Claude Code is sending its default. Set every slot, including the background one. |
| Claude Code refuses the model id | Set `CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT` to `1`, as in the settings above. |
| Empty reply, `stop_reason: max_tokens` | The output budget has to cover thinking too. Give reasoning models 1024+. |
| `403` with `model_not_allowed` | Your team admin has not enabled that model for you. Ask them, or pick another. See [Model access](https://inference.boundless.network/docs/teams#model-access). |

Every status and code is on the [Errors](https://inference.boundless.network/docs/errors) page. Other harnesses are on the [Coding Agents & Harnesses](https://inference.boundless.network/docs/coding-agents-and-harnesses) page.
