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

# Anthropic SDK

> Use authsome to manage ANTHROPIC_API_KEY. Run agents under the proxy or pass the key at construction.

The [Anthropic Python SDK](https://github.com/anthropics/anthropic-sdk-python) reads `ANTHROPIC_API_KEY` from the environment by default. Authsome can supply it through the proxy or through `export`.

## Add Anthropic as a custom provider

Anthropic isn't in the bundled set today. Register it as a custom provider:

```bash theme={null}
cat > /tmp/anthropic.json <<EOF
{
  "schema_version": 1,
  "name": "anthropic",
  "display_name": "Anthropic",
  "auth_type": "api_key",
  "flow": "api_key",
  "api_url": "api.anthropic.com",
  "api_key": {
    "header_name": "x-api-key",
    "header_prefix": ""
  },
  "export": {
    "env": {
      "api_key": "ANTHROPIC_API_KEY"
    }
  }
}
EOF

authsome register /tmp/anthropic.json
authsome login anthropic
```

Get a key from [console.anthropic.com/settings/keys](https://console.anthropic.com/settings/keys).

See [Custom providers](/guides/custom-providers) for the full template.

## Recommended: run the agent under the proxy

```bash theme={null}
authsome run -- python my_agent.py
```

The SDK initializes with `ANTHROPIC_API_KEY=authsome-proxy-managed`. Outbound requests to `api.anthropic.com` are intercepted and authenticated at the proxy layer.

## Alternative: export into the environment

```bash theme={null}
eval "$(authsome export anthropic --format env)"
python my_agent.py
```

Or read the key in Python after export:

```python theme={null}
import os
from anthropic import Anthropic

client = Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])
```

## Multi-account workflows

```bash theme={null}
authsome login anthropic --connection personal
authsome login anthropic --connection team
```

```bash theme={null}
eval "$(authsome export anthropic --connection team --format env)"
```

## What's next

<Columns cols={2}>
  <Card title="Custom providers" icon="puzzle-piece" href="/guides/custom-providers">
    The custom-provider walkthrough.
  </Card>

  <Card title="Run agents with the proxy" icon="shield-halved" href="/guides/run-agents-with-proxy">
    The injection model.
  </Card>
</Columns>
