All use cases
Vercel AI SDK
One AI SDK provider for the whole catalog
Install @anyr/ai-sdk-provider. generateText and streamText take a catalog id — including anyrouter/free.
01
The problem
What this is for
Vercel AI SDK providers are usually one-vendor. Switching models should not mean a new client or a new key.
02
What to do
Three steps, then copy
- 1.npm install @anyr/ai-sdk-provider ai
- 2.createAnyRouter() reads ANYROUTER_API_KEY when you omit the key.
- 3.Call anyrouter("anyrouter/free") or anyrouter("anyrouter/auto").
generateText
ts
import { createAnyRouter } from "@anyr/ai-sdk-provider"
import { generateText } from "ai"
const anyrouter = createAnyRouter()
const { text } = await generateText({
model: anyrouter("anyrouter/free"),
prompt: "What is AnyRouter?",
})
console.log(text)Ready to try it
The guide has the full walkthrough. Sign up if you still need a key.
Related
Next playbooks
Keep the OpenAI SDK, change two fields
Override baseURL and apiKey. Model ids are owner/model strings across 209+ models.
OpenAUTO
Start on anyrouter/free or anyrouter/auto
Two built-in virtual models: Go+ free failover (anyrouter/free) and stable paid failover (anyrouter/auto). Do not pick a flaky SKU for your first request.
OpenOne API in front of every provider dialect
OpenAI /chat/completions, Anthropic /messages, and a Responses API — same key, same catalog.
Open