Skip to main content

Anthropic

Use Anthropic’s Claude models with Agentium through the unified ModelProvider interface. Claude excels at long-context tasks, analysis, and nuanced reasoning.

Setup

Install the Anthropic SDK (required by Agentium for Anthropic support):

Factory

string
required
The Anthropic model identifier.
object
Optional configuration. See Config below.

Supported Models

Pass any valid Anthropic model ID to the factory. Check the Anthropic docs for the latest model IDs.

Config

string
Anthropic API key. If omitted, uses ANTHROPIC_API_KEY environment variable.

Example


Multi-Modal Support

Anthropic Claude supports images and files/documents as input. Audio is not supported.

Images

Pass images as base64 or URL in ContentPart[]:

Files & Documents

PDF and other documents can be sent via URL or base64. Anthropic processes them natively as document blocks:
Both URL-based and base64-encoded files are supported. The provider auto-detects the format.

Unsupported: Audio

Audio input is not supported by Anthropic. If passed, the provider logs a warning and substitutes a placeholder text block.

Reasoning / Extended Thinking

Claude supports extended thinking — the model “thinks” step-by-step before responding. Enable it via the reasoning config on your agent:
When reasoning is enabled, maxTokens is automatically adjusted. If your maxTokens is lower than budgetTokens + 4096, it’s overridden to ensure room for both thinking and response. See Reasoning for details.

Prompt Caching

Anthropic automatically caches prompt prefixes for repeated conversations. This reduces cost and latency when the system prompt or conversation history is reused across requests. No configuration is needed — the SDK handles this transparently. Benefits are most significant when:
  • System prompts are long (e.g., detailed instructions, few-shot examples)
  • Conversations span many turns (the prefix is cached across requests in the same session)
  • Multiple users share the same agent instructions

Full Example