# Anthropic and Claude

> Run Claude Code on your Claude login, keep Claude on some roles of a profile, call Claude with an Anthropic API key or any Anthropic-compatible API, and switch between several Claude accounts.
>
> Plain sc already runs Claude Code on your own Claude login. To keep Claude on some roles of a profile, add the anthropic passthrough endpoint; it needs no key.

1. Run on your Claude login

   ```sh
   sc <project> <agent>
   ```

   Claude Code starts on the login it already has, with no gateway in the request path.

2. Keep Claude on one role of a profile

   ```toml
   [endpoints.anthropic]
   url = "https://api.anthropic.com"
   format = "anthropic-messages"
   auth = "passthrough"

   [profiles.claude-main]
   opus   = { slug = "anthropic/opus" }
   sonnet = { slug = "opencode/deepseek-v4.1-flash" }
   ```

   A role on a `passthrough` endpoint stays on your Claude login, which makes the profile a [hybrid](/docs/models#how-roles-map-to-models). The `sonnet` row assumes the `opencode` endpoint from [OpenCode](/docs/provider-opencode).

3. Check it and launch

   ```sh
   sc profiles claude-main
   sc -u claude-main <project> <agent>
   ```

   `sc profiles` prints one row per role with the model it is sent to.

**Your Claude subscription**

`direct` is plain Claude Code on its own login: no gateway sits in the request path. It is what a bare `sc` uses while `default_profile` is unset or `"direct"`; `claude`, `anthropic` and `none` are aliases.

When your default is another profile, return to it for one launch:

```sh
sc -u direct <project> <agent>
```

**Keep Claude on some roles**

- The daemon adds no key, and Anthropic receives Claude Code's own model id, so the text after `anthropic/` is only a label.
- Your Claude credential stays with Anthropic. A request routed to another endpoint carries that endpoint's key, and Claude Code's own auth header is not forwarded.
- The launch check skips passthrough roles, and `sc profiles -v` shows `keys: none needed — passthrough rides your Claude Code login` on this endpoint.

The full version, with reasoning effort, is the [recommended walkthrough](/docs/custom-profiles#recommended-profile-walkthrough).

**Claude with an API key**

Export the key, declare an `anthropic-messages` endpoint that reads it, and map a row to it:

```sh
export ANTHROPIC_API_KEY="<your-anthropic-key>"
```

```toml
[endpoints.anthropic-direct]
url = "https://api.anthropic.com"
format = "anthropic-messages"
auth = "x-api-key"
key_csv = "${ANTHROPIC_API_KEY}"

[profiles.claude-api]
opus = { slug = "anthropic-direct/<model-id>" }
```

Use an Anthropic model id after the slash. Requests go upstream untranslated and are billed to that key; a profile of only such rows is a [full gateway](/docs/models#how-roles-map-to-models). Export the key before the daemon starts, or run `sc daemon stop` after ([why](/docs/gateways#keys-from-the-environment)).

> [!WARNING]
> Leave `reasoning` off Claude rows on this endpoint. For a request that names no level, a row's effort is written as the older `thinking.budget_tokens` shape, which current Claude models reject with a 400. Without it, Claude Code's own thinking settings pass through untouched.

**Any Anthropic-compatible API**

Any provider that serves `POST <url>/v1/messages` works the same way, with no translation. DeepSeek's Anthropic-compatible API, for example:

```toml
[endpoints.deepseek-anthropic]
url = "https://api.deepseek.com/anthropic"
format = "anthropic-messages"
key_csv = "${DEEPSEEK_API_KEY}"

[profiles.deepseek-native]
opus = { slug = "deepseek-anthropic/deepseek-flash" }
```

`url` is everything before `/v1/messages`.

With no `auth`, the format's default `x-api-key` is used; set `auth = "bearer"` for a provider that wants `Authorization: Bearer`. A provider that serves some models over this wire and others over OpenAI's can set `format` per row ([per-model overrides](/docs/provider-openai-compatible#per-model-wire-overrides)).

The gateway swaps in the row's model id and adds the row's `temperature` and `params`, and leaves the rest of Claude Code's request as it is. MiniMax and Qwen models are the exception: their thinking field is rewritten into the vendor's own form whenever a level applies. For any other model, the request's own thinking settings pass through, and only a row's `reasoning` replaces them with `thinking.budget_tokens`, which is why the warning in the API key fold matters for Claude.

The launch check works as for every endpoint ([details](/docs/gateways#the-launch-check)).

**Several Claude accounts**

On macOS, `sc accounts` stores several Claude Code logins in the keychain and switches between them. Sign in with Claude Code, then capture that login under a label:

```sh
sc accounts capture --label <label>
sc accounts use --label <label>
```

`use` writes the stored login back into the keychain, so the next `claude` launch uses it. To list, check and forget accounts:

```sh
sc accounts ls
sc accounts usage --label <label>
sc accounts rm --label <label>
```

`sc accounts usage` polls one stored login's utilization; without `--label` it reads the login currently in the keychain. `sc usage` is a different command: it covers your gateway endpoints, such as Codex and Grok, not Claude logins.

The daemon can switch accounts for you when the active one nears its limit:

```toml
[daemon.accounts_monitor]
enabled = true
interval_seconds = 120
switch_threshold_percent = 95
```

It polls every `interval_seconds` and switches at or above `switch_threshold_percent`. Tokens are never printed. They live only in `config.toml` (mode `0600`) and the keychain.
