atomr-infer-runtime-anthropic
Anthropic Messages API runtime. Same shape as
atomr-infer-runtime-openai; per-provider differences live inwire.rsanderror.rs.
What's different from OpenAI
- Auth header is
x-api-key(notAuthorization: Bearer). - API version pinned via the
anthropic-versionheader (AnthropicConfig::anthropic_version, defaults to2023-06-01). - SSE event types are richer:
message_start,content_block_delta,message_delta,message_stop,ping,error. The runner translates each to the canonicalTokenChunkshape. - System messages are extracted into the top-level
systemfield (Anthropic doesn't acceptrole: "system"inline). - Vision input is a content block with
type: "image"carrying base64 source data — fully supported viaContentPart::ImageBase64. - Tool-use is round-tripped (input deltas surface as
tool_call_delta).
Pricing
AnthropicPricing::published() covers Opus 4, Sonnet 4, 3.5 Sonnet,
3.5 Haiku, 3 Haiku. Operators override per deployment.
Quick start
use ;
use SecretRef;
let cfg = defaults;
let runner = new?;