Skip to content

Anthropic

Provider value: anthropic (default)

Anthropic is the default provider. If no --provider flag is set, ra uses Anthropic.

Setup

bash
export ANTHROPIC_API_KEY=sk-ant-...
ra "Hello"

Environment variables

VariableRequiredDescription
ANTHROPIC_API_KEYYesAnthropic API key (standard Anthropic env var)

Models

ModelNotes
claude-sonnet-4-6Default. Best balance of speed and capability
claude-opus-4-6Most capable
claude-haiku-4-5-20251001Fastest, cheapest. Used as default compaction model
bash
ra --model claude-opus-4-6 "Design a distributed system"
ra --model claude-haiku-4-5-20251001 "Quick summary of this file" --file data.csv

Extended thinking

Enable extended thinking for deeper reasoning. Supported modes: off (default), low, medium, high, adaptive.

bash
ra --thinking high "Design a distributed cache"
ra --thinking adaptive "Review this architecture"

Or in config:

yaml
agent:
  provider: anthropic
  thinking: adaptive   # high for first 10 turns, then low

Prompt caching

ra automatically applies cache hints to system prompts and tool definitions when using Anthropic. This reduces costs on multi-turn sessions without any configuration needed. Cached tokens are billed at a reduced rate — especially beneficial for sessions with large system prompts or many tools.

Custom base URL

Point ra at an Anthropic-compatible API proxy:

bash
ra --anthropic-base-url https://my-proxy.example.com/v1 "Hello"

Or in a config file:

yaml
app:
  providers:
    anthropic:
      baseURL: https://my-proxy.example.com/v1

See also

Released under the MIT License.