Providers
Anthropic
Configure the Anthropic provider for Claude models.
Setup
import { AnthropicProvider } from "noumen";
const provider = new AnthropicProvider({
apiKey: "sk-ant-...",
model: "claude-sonnet-4-20250514", // default
});Options
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | required | Anthropic API key |
model | string | "claude-sonnet-4-20250514" | Default model |
baseURL | string | — | Override the API base URL |
Streaming
The Anthropic provider uses the messages.stream() API. It internally maps Anthropic's event types to noumen's OpenAI-compatible chunk format:
content_block_start/content_block_deltafor text and tool callsmessage_startfor initial token countsmessage_deltafor final output token countmessage_stopfor the finish signal with usage
Message conversion
Anthropic uses a different message format than OpenAI. The provider handles this automatically:
- System messages become the
systemparameter - Tool results are wrapped in
tool_resultcontent blocks withinusermessages - Tool calls use Anthropic's
tool_usecontent block format
Models
claude-sonnet-4-20250514-- balanced speed and capabilityclaude-opus-4-20250514-- highest capabilityclaude-haiku-3-20250307-- fastest, most affordable