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'sPOST /files). - [
skills_model]: skill-upload models (Anthropicskills 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 SPECIFICATION_VERSION;
assert_eq!;
Stability
Until 1.0, expect breaking changes; the spec version pins compatibility
with the matching @ai-sdk/provider major.