Skip to content

rulvar API reference


rulvar API reference / @rulvar/anthropic

@rulvar/anthropic

Classes

ClassDescription
IdMapBijective canonical-to-wire tool-call id map.

Interfaces

InterfaceDescription
AnthropicAdapterOptions-
AnthropicClientLikeThe client sub-surface the adapter consumes; injectable for tests.
AnthropicModelInfo-
TurnMapping-

Type Aliases

Type AliasDescription
AnthropicStreamEventRaw Messages API stream events, structurally typed.

Variables

VariableDescription
ANTHROPIC_MODELSStatic seed table naming the current model set.
DEFAULT_PAUSE_TURN_MAX_CONTINUATIONSpause_turn continuation cap.

Functions

FunctionDescription
anthropic@rulvar/anthropic: the first-class Anthropic adapter on the July 2026 Messages API surface.
anthropicErrorToWireProjects an SDK/API error into the retryable WireError vocabulary: 429 rate limits surface retryAfterMs and the x-ratelimit-* buckets; 529 overloaded and 5xx are retryable transport; everything else is terminal transport. Adapters never sleep internally.
anthropicModelInfoUnknown Anthropic models are assumed current-generation: adaptive thinking, native structured outputs, no sampling parameters. refreshCaps corrects window/output figures from the live model list.
buildAnthropicParamsBuilds Messages API params from a ChatRequest. cacheHint compiles into cache_control breakpoints; beyond the provider cap of 4 the DEEPEST breakpoints are kept and the shallowest dropped, deterministically.
mapAnthropicStreamMaps one Messages API stream into ChatEvents. Emits an early usage event from message_start (the input side is known immediately) and exactly one terminal finish unless the turn paused (pause_turn) or errored. carryRetained holds thinking blocks from earlier pause_turn continuations of the same turn so the terminal finish ships the whole turn's retention payload (M4-T02).
mapStopReasonThe stop-reason table. pause_turn never surfaces as a canonical finish: the adapter continues internally.
normalizeAnthropicUsageNormalizes Messages API usage under the Usage invariant: Anthropic reports input_tokens EXCLUDING cache reads and writes, so the canonical inputTokens is the sum of all three.