llmsdk-provider 0.1.1

Provider trait abstractions for llmsdk (Rust port of @ai-sdk/provider v4)
Documentation

Provider trait abstractions for llmsdk.

This crate is the Rust port of @ai-sdk/provider at specification version v4. It defines the contract every model provider (OpenAI, Anthropic, ...) implements, plus the shared message / content / streaming types and the unified error type.

The crate is intentionally minimal: no HTTP, no retry, no middleware. Those live in llmsdk-provider-utils and downstream provider crates.

Layout

  • [language_model]: chat / completion models with streaming.
  • [embedding_model]: vector embedding models.
  • [image_model]: image generation models.
  • [video_model]: video generation models.
  • [reranking_model]: document reranking models.
  • [files_model]: file-upload models (e.g. Anthropic's POST /files).
  • [skills_model]: skill-upload models (Anthropic skills bundles).
  • [middleware]: decorators for stacking cross-cutting concerns (retry / logging / caching) on top of any [LanguageModel].
  • [provider]: top-level factory returning model instances by id.
  • [error]: unified [ProviderError].
  • [shared]: provider options / metadata / warnings reused across models.

Example

use llmsdk_provider::SPECIFICATION_VERSION;
assert_eq!(SPECIFICATION_VERSION, "v4");

Stability

Until 1.0, expect breaking changes; the spec version pins compatibility with the matching @ai-sdk/provider major.