Skip to main content

Documentation Index

Fetch the complete documentation index at: https://authsome.agentr.dev/docs/llms.txt

Use this file to discover all available pages before exploring further.

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",
  "host_url": "api.anthropic.com",
  "api_key": {
    "header_name": "x-api-key",
    "header_prefix": ""
  },
  "export": {
    "env": {
      "api_key": "ANTHROPIC_API_KEY"
    }
  }
}
EOF

uvx authsome register /tmp/anthropic.json
uvx authsome login anthropic
Get a key from console.anthropic.com/settings/keys. See Custom providers for the full template.
uvx 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: pass the key explicitly

from authsome.server.dependencies import create_auth_service
from anthropic import Anthropic

auth = create_auth_service()
client = Anthropic(api_key=auth.get_access_token("anthropic"))

resp = client.messages.create(
    model="claude-sonnet-4-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "ping"}],
)
print(resp.content[0].text)

Multi-account workflows

uvx authsome login anthropic --connection personal
uvx authsome login anthropic --connection team
In code:
key = auth.get_access_token("anthropic", connection="team")
client = Anthropic(api_key=key)

What’s next

Custom providers

The custom-provider walkthrough.

Run agents with the proxy

The injection model.