Skip to content

Provider Anthropic

Muhammet Şafak edited this page May 30, 2026 · 3 revisions

Home / Providers / Anthropic

Provider: Anthropic

Direct HTTPS API integration with api.anthropic.com.

Configuration

provider: anthropic
providers:
  anthropic:
    api_key: sk-ant-...
    model: claude-opus-4-8

Equivalent CLI / env:

commitbrief config set provider anthropic
commitbrief config set providers.anthropic.api_key sk-ant-...
commitbrief config set providers.anthropic.model claude-opus-4-8

# Or via env:
export ANTHROPIC_API_KEY=sk-ant-...

Get an API key from https://console.anthropic.com/.

Supported models

The static list registered by the binary:

Model ID Default? Notes
claude-opus-4-8 Highest capability; 1M-token context.
claude-sonnet-4-6 Mid-tier; 1M-token context.
claude-haiku-4-5-20251001 Fastest, cheapest.

The setup wizard offers the same three. Any model name accepted by the Anthropic Messages API works at runtime — the static list is just for the wizard's pick-list.

Pricing (per 1M tokens)

Snapshot from the binary's pricing table:

Model Input Output Cached input
claude-opus-4-8 $5.00 $25.00 $0.50
claude-sonnet-4-6 $3.00 $15.00 $0.30
claude-haiku-4-5-20251001 $1.00 $5.00 $0.10

The cost preflight (cost.warn_threshold_usd) uses these figures plus an output-token heuristic to estimate per-review spend before firing.

Rates are updated when Anthropic changes them; check internal/provider/anthropic/pricing.go against https://www.anthropic.com/pricing if accuracy matters.

Context window

Model Context window
claude-opus-4-8 1,000,000 tokens
claude-sonnet-4-6 1,000,000 tokens
claude-haiku-4-5-20251001 200,000 tokens

Reported by the provider for dry-run and the cost preflight's "will this fit?" check.

Prompt caching

CommitBrief uses Anthropic's ephemeral prompt-caching (5-minute TTL) to cut repeated-input cost ~10×. The cache happens on Anthropic's side; CommitBrief sends the system-prompt section marked for caching. Cache hits show in the verbose footer as Cached input: N tokens.

Structured findings

The Anthropic integration uses a tool-call (forced) to get structured JSON back, then parses against the v1 schema. If the first attempt produces unparseable JSON, one retry fires with a nudge to produce strict JSON — see ADR-0014 §4. A second failure falls back to markdown rendering and prints a warning: LLM produced malformed JSON; falling back to plain-text view.

See also

Clone this wiki locally