← all repositories
OpenRouterTeam/ai-sdk-provider

One adapter plugs 300+ models into the Vercel AI SDK

It exposes OpenRouter's 300+ models through the Vercel AI SDK, letting you swap LLMs without rewriting your generation logic.

ai-sdk-provider
Not currently ranked — collecting fresh signals.
star history

What it does This package is a bridge between the Vercel AI SDK and OpenRouter’s unified API. It lets you call over 300 chat, completion, and embedding models through the standard generateText, streamText, and embed functions. The provider handles the translation layer so you can call models from different upstream providers through the same interface.

The interesting bit The adapter does more than proxy requests: it translates Anthropic-specific features like prompt caching and beta headers into the correct formats internally. It also supports OpenRouter-specific plugins like Response Healing, which automatically scrubs malformed JSON from structured outputs.

Key highlights

  • Access to 300+ models via a single provider instance, including embedding models like openai/text-embedding-3-small
  • Three different ways to pass extra body parameters (per-request, per-model, or factory-level)
  • Built-in Anthropic prompt caching conversion and beta feature headers (such as fine-grained tool streaming)
  • Response Healing plugin to repair broken JSON from generateObject calls
  • Debug mode and usage accounting that echo upstream request bodies and surface token costs, including BYOK passthrough pricing, in response metadata

Caveats

  • The README notes that tool-supported models listed on OpenRouter may not all be compatible with the AI SDK, so compatibility is not guaranteed across the full list.
  • Response Healing only works with non-streaming requests, and debug mode only works with streaming requests, creating an odd split in feature availability.
  • The supported model list changes constantly, so any hardcoded model references may need periodic updating.

Verdict Worth a look if you’re already using the Vercel AI SDK and want to experiment across model providers without maintaining separate API clients. Skip it if you only ever call one provider’s API directly and don’t need the abstraction.

Frequently asked

What is OpenRouterTeam/ai-sdk-provider?
It exposes OpenRouter's 300+ models through the Vercel AI SDK, letting you swap LLMs without rewriting your generation logic.
Is ai-sdk-provider open source?
Yes — OpenRouterTeam/ai-sdk-provider is open source, released under the Apache-2.0 license.
What language is ai-sdk-provider written in?
OpenRouterTeam/ai-sdk-provider is primarily written in TypeScript.
How popular is ai-sdk-provider?
OpenRouterTeam/ai-sdk-provider has 671 stars on GitHub.
Where can I find ai-sdk-provider?
OpenRouterTeam/ai-sdk-provider is on GitHub at https://github.com/OpenRouterTeam/ai-sdk-provider.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.