---
title: "Anthropic"
description: "Use Claude models directly from Autohand Code CLI through Anthropic's native Messages API."
seo:
  title: "Anthropic Integration"
  description: "Configure Autohand Code CLI with the native Anthropic provider for Claude Sonnet 5, Claude Opus 5, Claude Fable 5, and other Claude models."
---

## What is the Autohand Anthropic integration? [#quick-answer]

The Autohand Anthropic integration connects Autohand Code CLI directly to Anthropic's Messages API. It uses the official Anthropic TypeScript SDK instead of the OpenAI-compatible provider layer, so system prompts, tool calls, images, structured output, thinking, and prompt caching are translated natively for Claude models.

|  |  |
| --- | --- |
| Status | Available in Autohand Code CLI v0.9.7 and later |
| Requires | An Anthropic API key with billing enabled and access to the Claude model you select. |
| Configure with | Choose Anthropic from `/model` (or `autohand --setup`), paste your API key, and pick a Claude model. The settings are saved under `anthropic` with `"provider": "anthropic"`. |
| Best for | Teams that want Claude models billed directly through their own Anthropic account. |

:::warning
**Know before you start:** Model availability, rate limits, context windows, and pricing are controlled by Anthropic and can change. Confirm access in the Anthropic Console before relying on a model in production.
:::

## Overview

The native `anthropic` provider talks to `https://api.anthropic.com` with your own API key. Because Anthropic rejects request parameters a model does not support, Autohand gates each optional parameter on the selected model:

- **Temperature** is dropped for the Claude 5 family and Claude Opus 4.7 and 4.8.
- **Effort** follows your `reasoningEffort` setting. It is clamped to `high` on Claude Opus 4.5, Opus 4.6, and Sonnet 4.6, and omitted for models without effort support.
- **Thinking** is omitted for models where thinking is always on, uses adaptive thinking on models that support it, and falls back to a token budget on older models.
- **Prompt caching** is on by default. The stable prefix (tools, system prompt, and earlier turns) is cached automatically, and cache reads and writes appear in `/usage`.
- **Refusals** are shown as an explanation instead of an empty reply.

:::tip
**Using OpenRouter instead?** Claude models are also available through [OpenRouter](/integrations/openrouter) with `anthropic/...` model IDs. Use the unprefixed IDs on this page only with the native `anthropic` provider.
:::

## Setup

1. **Create an API key**

    Sign in to the [Anthropic Console](https://console.anthropic.com/settings/keys) and create an API key.

2. **Select Anthropic in Autohand Code CLI**

    Start a session and run `/model`. Choose **Anthropic** from the third-party providers list. You can also run `autohand --setup` to go through the full setup wizard.

    ```bash
    autohand
    ```

    ```text
    /model
    ```

3. **Paste the key and pick a model**

    Paste your API key when prompted, then choose a Claude model from the list. The default selection is `claude-sonnet-5`. Autohand saves the provider, key, model, and context window to your config file and switches the current session to the new model.

To store the key without the interactive flow, use `autohand config set`:

```bash
autohand config set anthropic.apiKey "sk-ant-your-key-here"
autohand config set anthropic.model "claude-sonnet-5"
```

:::note
Autohand reads the Anthropic key from `anthropic.apiKey` in your config. It does not read the `ANTHROPIC_API_KEY` environment variable.
:::

## CLI configuration [#configuration]

Configure Anthropic in `~/.autohand/config.json`:

```json title="~/.autohand/config.json"
{
  "provider": "anthropic",
  "anthropic": {
    "apiKey": "sk-ant-your-key-here",
    "baseUrl": "https://api.anthropic.com",
    "model": "claude-sonnet-5",
    "contextWindow": 1000000,
    "reasoningEffort": "high"
  }
}
```

| Option | Description | Default |
| --- | --- | --- |
| `apiKey` | Your Anthropic API key. Required. | \- |
| `baseUrl` | Anthropic API endpoint. Change it only when routing through an approved proxy. | `https://api.anthropic.com` |
| `model` | Claude model ID, without the `anthropic/` prefix. Required. | `claude-sonnet-5` |
| `contextWindow` | Context window in tokens. Set automatically from the model catalog during setup. | From the model catalog |
| `reasoningEffort` | Effort level sent to models that support it (`low`, `medium`, `high`, `xhigh`). | Not set |

Anthropic requests use a 10-minute minimum client timeout, because the Anthropic SDK applies the timeout to the whole request. A larger `network.timeout` is honoured; a smaller one is not. Retries follow `network.maxRetries` (default 3, maximum 5). See [Configuration](/working-with-autohand-code/configuration#network-services) for network settings.

## Available models [#models]

These are the Claude models in the model catalog bundled with Autohand Code CLI. The catalog can be refreshed with `autohand update --models`, so the list in `/model` may include newer entries.

| Model ID | Name | Context window |
| --- | --- | --- |
| `claude-sonnet-5` | Claude Sonnet 5 (default) | 1M |
| `claude-opus-5` | Claude Opus 5 | 1M |
| `claude-fable-5` | Claude Fable 5 | 1M |
| `claude-opus-4-8` | Claude Opus 4.8 | 1M |
| `claude-opus-4-7` | Claude Opus 4.7 | 1M |
| `claude-sonnet-4-6` | Claude Sonnet 4.6 | 1M |
| `claude-opus-4-6` | Claude Opus 4.6 | 1M |
| `claude-haiku-4-5` | Claude Haiku 4.5 | 200K |
| `claude-opus-4-5` | Claude Opus 4.5 | 200K |
| `claude-sonnet-4-5` | Claude Sonnet 4.5 | 1M |
| `claude-opus-4-1` | Claude Opus 4.1 | 200K |

### Switch models

```bash
# Start a session with a specific Claude model
autohand --model claude-opus-5
```

During a session, run `/model` and pick another Claude model, or choose a different provider.

### Thinking

The `--thinking` flag and `AUTOHAND_THINKING_LEVEL` control reasoning depth. With `extended`, Autohand requests adaptive thinking on models that support it and a thinking budget on older models. With `none`, thinking is disabled where the model allows it. See [Extended thinking](/working-with-autohand-code/extended-thinking).

## Troubleshooting

| Issue | Fix |
| --- | --- |
| Authentication failed | Check `anthropic.apiKey` in `~/.autohand/config.json`, or run `/model` and enter the key again. |
| Payment required | Check your Anthropic account balance and billing settings. |
| Access denied | Your key may not have access to the selected model. Choose another model or check the key's workspace permissions. |
| Model not found | Use an unprefixed ID such as `claude-sonnet-5`. `anthropic/...` IDs only work with OpenRouter. |
| Request timed out | Anthropic may be under heavy load. Try again, or raise `network.timeout` above 10 minutes for very long turns. |

## Resources

- [Anthropic Console](https://console.anthropic.com/settings/keys)
- [Claude models overview](https://platform.claude.com/docs/en/about-claude/models/overview)
- [Messages API reference](https://platform.claude.com/docs/en/api/typescript/messages/create)

**How do I configure the Autohand Anthropic integration?**

Run `/model`, choose Anthropic, paste your API key, and pick a Claude model. Autohand saves `"provider": "anthropic"` and an `anthropic` block with your key and model to `~/.autohand/config.json`.

**What does the Autohand Anthropic integration require?**

Autohand Code CLI v0.9.7 or later, an Anthropic API key with billing enabled, and access to the Claude model you select.

**Can I set the key with ANTHROPIC_API_KEY?**

No. The native provider reads the key from `anthropic.apiKey` in your config. Set it with `/model` or `autohand config set anthropic.apiKey`.

**Should I use the native provider or OpenRouter for Claude?**

Use the native `anthropic` provider when you want to bill Claude usage to your own Anthropic account and use native Messages API features such as prompt caching and thinking. Use OpenRouter when you want one key across many model vendors.

**What limitations should I know about?**

Model IDs, quotas, context limits, and pricing are controlled by Anthropic and can change. Requests are sent without streaming, so long turns return when generation finishes.
