Skip to main content
The Anthropic Python SDK 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:
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. See Custom providers for the full template.
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

eval "$(authsome export anthropic --format env)"
python my_agent.py
Or read the key in Python after export:
import os
from anthropic import Anthropic

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

Multi-account workflows

authsome login anthropic --connection personal
authsome login anthropic --connection team
eval "$(authsome export anthropic --connection team --format env)"

What’s next

Custom providers

The custom-provider walkthrough.

Run agents with the proxy

The injection model.