Skip to main content

Anthropic Claude

KhunQuant connects to Anthropic via the official anthropic-sdk-go. The anthropic/ provider implements the LLMProvider interface and additionally implements ThinkingCapable for extended thinking support.

Configuration

Add to ~/.khunquant/config.json:

{
"model_list": [
{
"model_name": "claude",
"model": "claude-sonnet-4-6",
"api_key": "ANTHROPIC_API_KEY"
}
]
}

Add the API key to ~/.khunquant/.security.yml:

model_list:
- model_name: claude
api_key: "sk-ant-..."

Extended thinking

Claude models support extended thinking, which lets the model reason step-by-step before producing a final response. Configure the thinking level per model:

thinking_levelDescription
"none"No extended thinking (default)
"low"Brief thinking budget
"high"Maximum thinking budget
{
"model_list": [
{
"model_name": "claude-think",
"model": "claude-opus-4-7",
"api_key": "ANTHROPIC_API_KEY",
"thinking_level": "high"
}
]
}

Fallback chain example

Configure a primary model with a cheaper fallback:

{
"agents": {
"defaults": {
"model_name": "claude",
"model_fallbacks": ["claude-haiku"]
}
},
"model_list": [
{ "model_name": "claude", "model": "claude-sonnet-4-6", "api_key": "ANTHROPIC_API_KEY" },
{ "model_name": "claude-haiku", "model": "claude-haiku-4-5-20251001", "api_key": "ANTHROPIC_API_KEY" }
]
}

The fallback chain automatically retries on rate limits, overload, or context overflow errors.