Skip to main content

Crate spectracost

Crate spectracost 

Source
Expand description

§spectracost

AI cost observability SDK for Rust. See the crate-level README for usage.

The SDK owns minimal HTTP clients for OpenAI and Anthropic under openai and anthropic so callers get a one-line setup without wrestling with a third-party crate’s builder types. Every call is instrumented: we capture model, token counts, latency, and attribution tags, then forward a UsageEvent to the Spectracost ingestion endpoint in a background task.

Modules§

anthropic
Anthropic Messages API surface.
openai
OpenAI-compatible chat completion surface.

Structs§

Attribution
Per-call attribution overrides.
Options
Options for constructing a Spectracost client.
Spectracost
The main client. Cheap to clone (inner state is Arc’d).
UsageEvent
Wire format for a telemetry event. Matches sdk/SPEC.md exactly.

Enums§

Error
Errors returned by the SDK.

Constants§

DEFAULT_ENDPOINT
Default Spectracost ingestion endpoint.