LLM Providers

LLM Providers#

claude-review supports three provider types. The claude and anthropic providers both use the Anthropic Messages API. The openai provider uses the OpenAI Chat Completions API.

Anthropic Hosted (claude / anthropic)#

The claude and anthropic providers are functionally identical. Both send requests to the Anthropic Messages API.

toml
[llm]
provider = "claude"                # or "anthropic"
model = "claude-sonnet-4-6"
max_tokens = 4096
# api_key via ANTHROPIC_API_KEY env var

[llm.anthropic]
api_version = "2023-06-01"

Default base URL: https://api.anthropic.com

The API key is sent as the x-api-key header.

Anthropic-Compatible (Bedrock, Vertex, Proxies)#

To use an Anthropic-compatible proxy (e.g. for AWS Bedrock or GCP Vertex AI), set base_url and use custom_headers for authentication:

toml
[llm]
provider = "anthropic"
model = "anthropic.claude-sonnet-4-6"
base_url = "https://bedrock-proxy.internal/anthropic"

[llm.anthropic]
custom_headers = { "x-bedrock-auth" = "..." }

The client sends requests to {base_url}/v1/messages. Any key/value pairs in custom_headers are included as HTTP headers on every request, which is useful for proxy-specific authentication tokens.

OpenAI-Compatible#

The openai provider works with any service that implements the OpenAI Chat Completions API:

  • OpenAI (https://api.openai.com/v1)

  • Azure OpenAI

  • Ollama (http://localhost:11434/v1)

  • vLLM (http://localhost:8000/v1)

  • Together AI (https://api.together.xyz/v1)

  • Groq (https://api.groq.com/openai/v1)

  • LiteLLM proxy

  • Fireworks AI

toml
[llm]
provider = "openai"
model = "gpt-4o"
max_tokens = 4096
# api_key via OPENAI_API_KEY env var

For self-hosted or alternative endpoints, set base_url:

toml
[llm]
provider = "openai"
model = "llama3.1:70b"
base_url = "http://localhost:11434/v1"

The API key is sent as a Bearer token in the Authorization header. If api_key is empty (as is typical with local Ollama), the header is omitted.

The client sends requests to {base_url}/chat/completions.

Prompt Caching#

Prompt caching reduces latency and cost on repeated calls by caching the system prompt and tool definitions server-side. It is only available with the Anthropic provider.

toml
[llm.anthropic]
prompt_caching = true

When enabled:

  • The system prompt is sent as a content block with cache_control: { type: "ephemeral" }.

  • The last tool definition in the list also receives a cache_control block.

  • The prompt-caching-2024-07-31 beta flag is automatically added to the anthropic-beta header (unless you specify betas manually).

Cache hit metrics (cache_read_input_tokens, cache_creation_input_tokens) are logged at debug level.

Extended Thinking#

Extended thinking lets the model reason internally before producing a response. It is available on Claude 3.7 Sonnet and Claude 4 family models.

toml
[llm.anthropic]
extended_thinking = true
thinking_budget = 10000          # optional, default 10000

When enabled:

  • A thinking block is added to the request with budget_tokens.

  • The temperature parameter is ignored (required by the API).

  • The model’s internal reasoning is returned separately and logged but not posted to GitHub.

Custom Headers#

The custom_headers map lets you inject arbitrary HTTP headers into every Anthropic API request. This is primarily useful for proxy authentication or routing:

toml
[llm.anthropic]
custom_headers = { "x-routing-key" = "prod", "x-auth-token" = "abc123" }

Provider Comparison#

Feature
claude / anthropic
openai
API formatAnthropic MessagesOpenAI Chat Completions
Prompt cachingYesNo
Extended thinkingYesNo
Custom headersYesNo
Tool useYesYes
Default base URLhttps://api.anthropic.comhttps://api.openai.com/v1
Auth headerx-api-keyAuthorization: Bearer