Skip to content

Anthropic

Anthropic is a supported AI provider in Clanker. It uses the Anthropic Messages API directly (not through AWS Bedrock).


Provider Details

PropertyValue
Config keyanthropic
Default modelAuto-detected (Clanker queries the Anthropic Models endpoint and uses the latest available model)
API endpointhttps://api.anthropic.com/v1
Auth methodAPI key

Configuration

Add the following to ~/.clanker.yaml:

yaml
ai:
  default_provider: anthropic
  providers:
    anthropic:
      model: ""
      api_key_env: ANTHROPIC_API_KEY

If you leave the model field empty, Clanker automatically queries the Anthropic API to discover the latest available model. You can also pin a specific model:

yaml
ai:
  default_provider: anthropic
  providers:
    anthropic:
      model: claude-sonnet-4-20250514
      api_key: "sk-ant-api03-..."

Environment Variable

VariableDescription
ANTHROPIC_API_KEYAnthropic API key

CLI Flag Overrides

FlagDescription
--ai-profile anthropicSelect this provider
--anthropic-key <key>Override the API key for this query
--anthropic-model <model>Override the model for this query

Usage Example

bash
# Set the key via environment variable
export ANTHROPIC_API_KEY="sk-ant-api03-..."

# Query using Anthropic
clanker ask --ai-profile anthropic "Analyze IAM roles for overpermissive policies"

# Pin a specific model
clanker ask --ai-profile anthropic --anthropic-model claude-sonnet-4-20250514 "What RDS instances are running?"

Model Fallback Behavior

If the configured model ID is not found by the Anthropic API (HTTP 404), Clanker automatically falls back to the latest available model by querying the /models endpoint. This ensures that Clanker continues to work even when model IDs are retired or updated.