@anyr/ai-sdk-provider weekly downloads statistics
The AnyRouter provider for the Vercel AI SDK — call every AnyRouter model through `createAnyRouter`.
@anyr/ai-sdk-provider has 451 recorded weekly downloads on npm, a decrease of 73.0% over the past 30 days, ranking #1595 of 2,391 tracked listings.
About @anyr/ai-sdk-provider
@anyr/ai-sdk-provider
The AnyRouter provider for the Vercel AI SDK.
Call every model on the AnyRouter gateway through the standard AI SDK
interface — generateText, streamText, generateObject, embedMany,
generateImage — with one key and one provider.
Install
npm install @anyr/ai-sdk-provider ai zod
# or
pnpm add @anyr/ai-sdk-provider ai zod
Quickstart
import { createAnyRouter } from "@anyr/ai-sdk-provider"
import { generateText } from "ai"
// Reads ANYROUTER_API_KEY from the environment when omitted.
const anyrouter = createAnyRouter()
const { text } = await generateText({
model: anyrouter("openai/gpt-4o-mini"),
prompt: "What is AnyRouter?",
})
console.log(text)
Usage
generateText
import { createAnyRouter } from "@anyr/ai-sdk-provider"
import { generateText } from "ai"
const anyrouter = createAnyRouter({ apiKey: process.env.ANYROUTER_API_KEY })
const { text } = await generateText({
model: anyrouter("anthropic/claude-opus-4-5"),
system: "You are a helpful assistant.",
prompt: "Explain the butterfly effect in one paragraph.",
})
streamText
import { createAnyRouter } from "@anyr/ai-sdk-provider"
import { streamText } from "ai"
const anyrouter = createAnyRouter()
const { textStream } = await streamText({
model: anyrouter("openai/gpt-4o"),
prompt: "Write a haiku about the ocean.",
})
for await (const chunk of textStream) {
process.stdout.write(chunk)
}
Reasoning models
Reasoning models (e.g. deepseek/deepseek-r1) return their thinking as a
separate stream — the provider surfaces it as the AI SDK's standard reasoning
parts, so reasoning/reasoningText and the full-stream reasoning-* parts
work out of the box.
import { createAnyRouter } from "@anyr/ai-sdk-provider"
import { generateText } from "ai"
const anyrouter = createAnyRouter()
const { text, reasoningText } = await generateText({
model: anyrouter("deepseek/deepseek-r1"),
prompt: "How many r's are in strawberry?",
})
console.log(reasoningText) // the model's chain of thought
console.log(text) // the final answer
generateObject (structured output)
import { createAnyRouter } from "@anyr/ai-sdk-provider"
import { generateObject } from "ai"
import { z } from "zod"
const anyrouter = createAnyRouter()
const { object } = await generateObject({
model: anyrouter("openai/gpt-4o-mini"),
schema: z.object({
title: z.string(),
summary: z.string(),
tags: z.array(z.string()),
}),
prompt: "Summarise the latest AI news in a structured format.",
})
console.log(object.title, object.tags)
Tool calling
import { createAnyRouter } from "@anyr/ai-sdk-provider"
import { generateText, tool } from "ai"
import { z } from "zod"
const anyrouter = createAnyRouter()
const { text, toolCalls } = await generateText({
model: anyrouter("openai/gpt-4o"),
tools: {
get_weather: tool({
description: "Get the current weather in a city.",
parameters: z.object({ city: z.string() }),
execute: async ({ city }) => ({ temperature: 22, unit: "C", city }),
}),
},
prompt: "What is the weather in Tokyo?",
})
Embeddings
import { createAnyRouter } from "@anyr/ai-sdk-provider"
import { embedMany } from "ai"
const anyrouter = createAnyRouter()
const { embeddings } = await embedMany({
model: anyrouter.embeddingModel("openai/text-embedding-3-small"),
values: ["Hello world", "How are you?"],
})
console.log(embeddings[0]) // [0.123, -0.456, ...]
Image generation
import { createAnyRouter } from "@anyr/ai-sdk-provider"
import { generateImage } from "ai"
const anyrouter = createAnyRouter()
const { image } = await generateImage({
model: anyrouter.imageModel("openai/dall-e-3"),
prompt: "A serene mountain lake at dawn, oil painting.",
size: "1024x1024",
})
// image.base64 — base64-encoded PNG or URL depending on the model
Provider options (routing, session, extra body)
import { createAnyRouter } from "@anyr/ai-sdk-provider"
import { generateText } from "ai"
// Set routing preferences at the provider level
const anyrouter = createAnyRouter({
provider: { only: ["openai"], quantizations: ["bf16"] },
sessionId: "user-session-abc",
})
// Or override them per-call
const { text } = await generateText({
model: anyrouter("openai/gpt-4o"),
prompt: "Hello!",
experimental_providerMetadata: {
anyrouter: {
provider: { order: ["openai", "azure"] },
sessionId: "per-request-session",
extraBody: { logprobs: true },
},
},
})
Configuration
import { createAnyRouter } from "@anyr/ai-sdk-provider"
const anyrouter = createAnyRouter({
// API key — falls back to ANYROUTER_API_KEY env var (resolved lazily at request time)
apiKey: "<your-anyrouter-key>",
// API base URL — defaults to https://anyrouter.dev/api/v1
baseURL: "https://anyrouter.dev/api/v1",
// Extra headers merged into every request
headers: { "X-Custom-Header": "value" },
// Custom fetch implementation (e.g. for logging or proxying)
fetch: myCustomFetch,
// Default routing preference forwarded as `provider` in the request body
provider: { only: ["openai"] },
// Session ID forwarded as `session_id` — useful for grouping in analytics
sessionId: "my-session",
// Extra fields merged into every request body (per-call overrides these)
extraBody: { safe_mode: true },
})
Provider methods…
Description from the npm listing.
- anyrouter
- ai-sdk
- vercel-ai-sdk
- ai
- llm
- openai
- anthropic
- language-model
- provider
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (544)Similar npm AI SDKs plugins
All 20 @anyr/ai-sdk-provider alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/@anyr/ai-sdk-provider. First seen Oct 16, 2026; last successful collection Oct 21, 2026. See the methodology.