Anthropic Provider
Configure @namzu/anthropic for the Anthropic Messages API through Namzu.
@namzu/anthropic is the direct Anthropic integration for Namzu. It wraps the official Anthropic SDK and exposes the provider as the anthropic type in ProviderRegistry.
1. When to Use It
Choose this package when you want native Anthropic Messages API behavior instead of going through a compatibility layer.
2. When Not to Use It
Choose another provider when:
- you need AWS-native auth and region semantics, in which case
@namzu/bedrockis a better fit - your endpoint is only Anthropic-compatible over raw HTTP, in which case
@namzu/httpmay be the simpler abstraction
3. Install
4. Register and Create the Provider
5. Sanity-Check With a Direct Provider Call
6. Use It With a Reactive Agent
7. Configuration
| Field | Required | Description |
|---|---|---|
apiKey | Yes | Anthropic API key |
model | No | Default model for calls that omit params.model |
baseURL | No | Override endpoint URL for a compatible proxy or gateway |
timeout | No | Request timeout in milliseconds |
defaultHeaders | No | Extra headers appended to every request |
maxTokens | No | Default max_tokens value; Anthropic requires this field at request time |
8. Capability Snapshot
The package exports ANTHROPIC_CAPABILITIES:
9. Operational Notes
- Anthropic requires
max_tokens, so settingmaxTokensat provider creation time is a good default. baseURLcan point at proxies or gateways, but for Bedrock-hosted Anthropic models@namzu/bedrockis the better fit.- The provider also implements
listModels()andhealthCheck().
10. Common Errors
| Error | Meaning | Fix |
|---|---|---|
Unsupported provider type: anthropic | registration never happened | call registerAnthropic() before create() |
| missing API key error | apiKey not provided | pass a valid Anthropic API key |
| tool-rich calls fail unexpectedly | max_tokens handling was overlooked in direct calls | set maxTokens at provider creation or per call |