rulvar API reference / @rulvar/anthropic
@rulvar/anthropic
Classes
| Class | Description |
|---|---|
| IdMap | Bijective canonical-to-wire tool-call id map. |
Interfaces
| Interface | Description |
|---|---|
| AnthropicAdapterOptions | - |
| AnthropicClientLike | The client sub-surface the adapter consumes; injectable for tests. |
| AnthropicModelInfo | - |
| TurnMapping | - |
Type Aliases
| Type Alias | Description |
|---|---|
| AnthropicStreamEvent | Raw Messages API stream events, structurally typed. |
Variables
| Variable | Description |
|---|---|
| ANTHROPIC_MODELS | Static seed table naming the current model set. |
| DEFAULT_PAUSE_TURN_MAX_CONTINUATIONS | pause_turn continuation cap. |
Functions
| Function | Description |
|---|---|
| anthropic | @rulvar/anthropic: the first-class Anthropic adapter on the July 2026 Messages API surface. |
| anthropicErrorToWire | Projects 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. |
| anthropicModelInfo | Unknown Anthropic models are assumed current-generation: adaptive thinking, native structured outputs, no sampling parameters. refreshCaps corrects window/output figures from the live model list. |
| buildAnthropicParams | Builds 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. |
| mapAnthropicStream | Maps 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). |
| mapStopReason | The stop-reason table. pause_turn never surfaces as a canonical finish: the adapter continues internally. |
| normalizeAnthropicUsage | Normalizes 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. |