Integration · @namzu/anthropic
Namzu × Anthropic.Messages API, streaming and extended thinking.
The Anthropic driver: streaming, tool use, extended thinking and native JSON-schema output over the official SDK.
Install.
pnpm add @namzu/sdk @namzu/anthropic@namzu/sdk is a peer dependency, so install both. The SDK needs zod@^3 too.
Why pair the kernel with Anthropic.
The driver implements the kernel's LLMProvider interface over the official @anthropic-ai/sdk, so nothing above it knows which vendor is answering. Namzu surfaces the vendor's tool-use and thinking primitives as kernel events rather than burying them in a framework abstraction.
chatStreamis the only model entry point; a non-streaming call is that stream collected. The kernel's turn loop calls it and hands you events.- Signed thinking and encrypted redacted blocks are persisted with the exact provider, model and fallback route, and replayed after a restart or
/resume. Another model receives portable history without foreign thinking metadata. thinkingis an intent that the driver resolves against the model before sending:enabledbecomesadaptiveon models that only have adaptive thinking, and aneffortthe model does not accept fails before the request is sent.provider.effortLevelsFor(model, thinking)lists the valid levels.- Forced tool choice (
'required'or a named function) is refused before sending on models that reject it, such as Claude Opus 5.5, Claude Fable 5.1 and Claude Mythos 5.1.acceptsForcedToolChoice(model)asks first;'auto'and'none'work everywhere. listModelsStrict()returns only the rows the account's Models API supplies, so a catalogue you show is never a bundled guess.
Example.
import { ProviderRegistry, runAgent } from '@namzu/sdk'
import { registerAnthropic } from '@namzu/anthropic'
registerAnthropic() // once, at startup
const model = 'claude-sonnet-4-5-20250929'
const { provider } = ProviderRegistry.create({
type: 'anthropic',
apiKey: process.env.ANTHROPIC_API_KEY,
model,
})
const { output } = await runAgent({
provider,
model,
prompt: 'What is the capital of France?',
})
console.log(output)Configure.
Configuration (type: 'anthropic')
- apiKeystring
- Console API key. Set exactly one of
apiKeyorauthToken. - authTokenstring
- Bearer-style OAuth access token, sent as
Authorization: Bearer. Mutually exclusive withapiKey. - modelstring
- Default model; overridable per call.
- baseURLstring
- Override the base URL, for a compatible proxy.
- maxRetriesnumber
- Vendor transport retries. Default 0, so the host sees a throttle immediately and owns backoff. Set 2 for the vendor default.
- timeoutnumber (ms)
- Request timeout.
- streamIdleTimeoutMsnumber (ms)
- Fail a stalled stream independently of the request timeout. Disabled by default.
- defaultHeadersRecord<string, string>
- Headers appended to every request.
- maxTokensnumber
- Default
max_tokens, which the Messages API requires. Default 64000. - strictToolUse'auto' | 'on' | 'off'
- Constrained tool input.
autoenables it for known Claude 4.5 and later models;onopts a compatible proxy alias in. Defaultauto.
What the driver declares.
- StreamingYes
- Tool callsYes
- Image attachmentsYes
- Document attachmentsYes
- Native JSON-schema outputYes
- Hosted web searchYes
- Images in tool resultsYes
Ship Anthropic agents on a runtime you can own.
Anthropic owns the model. Namzu owns the runtime. The package is a thin adapter, not a wrapper, so you keep everything Anthropic ships and add the kernel concerns you do not get from the model API alone.