Skip to main content

Module ai

Module ai 

Source
Expand description

LLM abstraction layer (packages/ai). Types + the Anthropic Messages API streaming provider.

Re-exports§

pub use types::Api;
pub use types::Message;
pub use types::Model;
pub use types::ThinkingLevel;
pub use types::Usage;
pub use types::UserMessage;

Modules§

anthropic
Anthropic Messages API provider — direct HTTP streaming with a hand-rolled SSE decoder (no SDK dependency), mirroring packages/ai/providers/anthropic.ts.
stream
Streaming primitives: the SSE decoder, a tolerant streaming-JSON parser, the fine-grained AssistantMessageEvent protocol, and the AssistantStream type that providers return.
types
Core type system for the LLM abstraction layer.

Constants§

DEFAULT_ANTHROPIC_BASE_URL
The default base URL for the Anthropic API.

Functions§

builtin_models
A curated model registry. A handful of Anthropic models with sensible defaults; resolved/overridden at runtime via env vars and CLI flags.
now_ms
Current wall-clock time in milliseconds since the Unix epoch.
resolve_model
Resolve a model by provider/id pattern (supports just id). An optional :thinking suffix is tolerated and ignored here (thinking is set elsewhere).