{"_id":"@anyr/ai-sdk-provider","_rev":"8-b9861f8de45d419fc5088a9b16421e9f","name":"@anyr/ai-sdk-provider","dist-tags":{"latest":"0.1.6"},"versions":{"0.1.0":{"name":"@anyr/ai-sdk-provider","version":"0.1.0","keywords":["anyrouter","ai-sdk","vercel-ai-sdk","ai","llm","openai","anthropic","language-model","provider"],"author":{"name":"Duyet Le"},"license":"MIT","_id":"@anyr/ai-sdk-provider@0.1.0","maintainers":[{"name":"duyetdev","email":"lvduit08@gmail.com"}],"homepage":"https://anyrouter.dev","bugs":{"url":"https://github.com/duyet/anyrouter/issues"},"dist":{"shasum":"3494ca13233b37b69fa721959b9d79fbb2aef828","tarball":"https://registry.npmjs.org/@anyr/ai-sdk-provider/-/ai-sdk-provider-0.1.0.tgz","fileCount":9,"integrity":"sha512-8k+wSZ55yQ6gL7JoM5leXWZ05q3I8etTrrkd1XfnVuTgfzqMoGtkJ0qhB3D+zl/pB6Qi+cSEQaaf3Km5Of8JwA==","signatures":[{"sig":"MEUCIQCNXOF+6e/2kDRyc/E6dsW3kPXNMK6856XLoE8X+Xyb5gIgGhsgVNzUL/we/TJtiBY//PgN5FgcNojRWScuSEj3FKU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":187913},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.js"}},"./package.json":"./package.json"},"scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","clean":"rm -rf dist","typecheck":"tsc --noEmit","prepublishOnly":"tsup"},"_npmUser":{"name":"duyetdev","email":"lvduit08@gmail.com"},"repository":{"url":"git+https://github.com/duyet/anyrouter.git","type":"git","directory":"packages/ai-sdk-provider"},"_npmVersion":"11.15.0","description":"The AnyRouter provider for the Vercel AI SDK — call every AnyRouter model through `createAnyRouter`.","directories":{},"_nodeVersion":"22.22.2","dependencies":{"@anyr/sdk":"^0.1.0","@ai-sdk/provider":"^3.0.10","@ai-sdk/provider-utils":"^4.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"ai":"^6.0.159","zod":"^4.4.3","@types/node":"^24.0.0"},"peerDependencies":{"ai":"^6.0.0","zod":"^3.25.0 || ^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/ai-sdk-provider_0.1.0_1781719486559_0.8373005010969006","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@anyr/ai-sdk-provider","version":"0.1.1","keywords":["anyrouter","ai-sdk","vercel-ai-sdk","ai","llm","openai","anthropic","language-model","provider"],"author":{"name":"Duyet Le"},"license":"MIT","_id":"@anyr/ai-sdk-provider@0.1.1","maintainers":[{"name":"duyetdev","email":"lvduit08@gmail.com"}],"homepage":"https://anyrouter.dev","bugs":{"url":"https://github.com/duyet/anyrouter/issues"},"dist":{"shasum":"149e17ee3c9128b41e115057fd2a9a595c3e210a","tarball":"https://registry.npmjs.org/@anyr/ai-sdk-provider/-/ai-sdk-provider-0.1.1.tgz","fileCount":7,"integrity":"sha512-XcpyWhQJmHlVZYs5Cq8qhPaKnIY9UjUax9ZRvANk2BkygJIr5n4xTVtTepBW9BM2uMxT76P/LAP3/KNRrNzPoQ==","signatures":[{"sig":"MEUCIFTzVYBh/wdz+IVhChzlDjbb9DJYrwZH5cLmymRg+qIUAiEAlvsQwH9Levj06Wnse69H9tTY9U6esi4ES18X3KdD27g=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":66262},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.js"}},"./package.json":"./package.json"},"scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","clean":"rm -rf dist","typecheck":"tsc --noEmit","prepublishOnly":"tsup"},"_npmUser":{"name":"duyetdev","email":"lvduit08@gmail.com"},"repository":{"url":"git+https://github.com/duyet/anyrouter.git","type":"git","directory":"packages/ai-sdk-provider"},"_npmVersion":"11.15.0","description":"The AnyRouter provider for the Vercel AI SDK — call every AnyRouter model through `createAnyRouter`.","directories":{},"_nodeVersion":"22.22.2","dependencies":{"@anyr/sdk":"^0.1.1","@ai-sdk/provider":"^3.0.10","@ai-sdk/provider-utils":"^4.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"ai":"^6.0.159","zod":"^4.4.3","@types/node":"^24.0.0"},"peerDependencies":{"ai":"^6.0.0","zod":"^3.25.0 || ^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/ai-sdk-provider_0.1.1_1781719873537_0.5389407708607679","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@anyr/ai-sdk-provider","version":"0.1.2","keywords":["anyrouter","ai-sdk","vercel-ai-sdk","ai","llm","openai","anthropic","language-model","provider"],"author":{"name":"Duyet Le"},"license":"MIT","_id":"@anyr/ai-sdk-provider@0.1.2","maintainers":[{"name":"duyetdev","email":"lvduit08@gmail.com"}],"homepage":"https://anyrouter.dev","bugs":{"url":"https://github.com/duyet/anyrouter/issues"},"dist":{"shasum":"5b07b3e4a67d8a0c610bec24091e5729892a1226","tarball":"https://registry.npmjs.org/@anyr/ai-sdk-provider/-/ai-sdk-provider-0.1.2.tgz","fileCount":7,"integrity":"sha512-WXKU50ZXrIg5rqWbXrVXeMuNS5xEaK6JeNdjDjEc7QAYPfY0T27jg9QrQGXFphjBg6ajkcHZY2zNmdk0W6fg/w==","signatures":[{"sig":"MEQCIFOFsvav5OofDZZNLNZ0bYqnEplZcDkREqehHrJO7+9dAiB4ut7p06XzHZTu/fg9HNDehvvPhOXVRTfbfzaOE0y+iA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":66262},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.js"}},"./package.json":"./package.json"},"scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","clean":"rm -rf dist","typecheck":"tsc --noEmit","prepublishOnly":"tsup"},"_npmUser":{"name":"duyetdev","email":"lvduit08@gmail.com"},"repository":{"url":"git+https://github.com/duyet/anyrouter.git","type":"git","directory":"packages/ai-sdk-provider"},"_npmVersion":"11.12.1","description":"The AnyRouter provider for the Vercel AI SDK — call every AnyRouter model through `createAnyRouter`.","directories":{},"_nodeVersion":"26.0.0","dependencies":{"@anyr/sdk":"^0.1.1","@ai-sdk/provider":"^3.0.10","@ai-sdk/provider-utils":"^4.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"ai":"^6.0.159","zod":"^4.4.3","@types/node":"^24.0.0"},"peerDependencies":{"ai":"^6.0.0","zod":"^3.25.0 || ^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/ai-sdk-provider_0.1.2_1781722778258_0.9714695841017631","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@anyr/ai-sdk-provider","version":"0.1.3","keywords":["anyrouter","ai-sdk","vercel-ai-sdk","ai","llm","openai","anthropic","language-model","provider"],"author":{"name":"Duyet Le"},"license":"MIT","_id":"@anyr/ai-sdk-provider@0.1.3","maintainers":[{"name":"duyetdev","email":"lvduit08@gmail.com"}],"homepage":"https://anyrouter.dev","bugs":{"url":"https://github.com/duyet/anyrouter/issues"},"dist":{"shasum":"04f7502f55a9ded0421f0705d7555812370c3f7f","tarball":"https://registry.npmjs.org/@anyr/ai-sdk-provider/-/ai-sdk-provider-0.1.3.tgz","fileCount":7,"integrity":"sha512-+LeINoJ60NJNHwWX9VGPkCgWFweyCts+RclxKC8txzNL3AzjbGyE9cNOBriL1dg1nHTyLWmz7D5vnCjFG1EugQ==","signatures":[{"sig":"MEUCIQDhg1umhlPSYdnyZygdukP+VcpN8sQuV+venQ38G70RJgIgYPdmXqC5HyNn+qvK/s6XOi83/OPaJGSKc+dvUvn3OrI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":66382},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.js"}},"./package.json":"./package.json"},"gitHead":"246e33298d5df592d30ab96cd2f946b082f9e6ca","scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","clean":"rm -rf dist","typecheck":"tsc --noEmit","prepublishOnly":"tsup"},"_npmUser":{"name":"duyetdev","email":"lvduit08@gmail.com"},"repository":{"url":"git+https://github.com/duyet/anyrouter.git","type":"git","directory":"packages/ai-sdk-provider"},"_npmVersion":"11.12.1","description":"The AnyRouter provider for the Vercel AI SDK — call every AnyRouter model through `createAnyRouter`.","directories":{},"_nodeVersion":"26.0.0","dependencies":{"@anyr/sdk":"^0.1.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"ai":"^6.0.159","zod":"^4.4.3","@types/node":"^24.0.0","@ai-sdk/provider":"^3.0.10","@ai-sdk/provider-utils":"^4.0.0"},"peerDependencies":{"ai":"^6.0.0 || ^7.0.0-beta","zod":"^3.25.0 || ^4.0.0","@ai-sdk/provider":"^3.0.10 || ^4.0.0-beta","@ai-sdk/provider-utils":"^4.0.0 || ^5.0.0-beta"},"_npmOperationalInternal":{"tmp":"tmp/ai-sdk-provider_0.1.3_1781742427395_0.6417474792459399","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@anyr/ai-sdk-provider","version":"0.1.4","keywords":["anyrouter","ai-sdk","vercel-ai-sdk","ai","llm","openai","anthropic","language-model","provider"],"author":{"name":"Duyet Le"},"license":"MIT","_id":"@anyr/ai-sdk-provider@0.1.4","maintainers":[{"name":"duyetdev","email":"lvduit08@gmail.com"}],"homepage":"https://anyrouter.dev","bugs":{"url":"https://github.com/duyet/anyrouter/issues"},"dist":{"shasum":"b830e43a77591b65f3f814d5f3ebe2ad7d2f840c","tarball":"https://registry.npmjs.org/@anyr/ai-sdk-provider/-/ai-sdk-provider-0.1.4.tgz","fileCount":7,"integrity":"sha512-ZQe//Pc6z6HX/DGOKTrQXW7zWET22o7h0T8Q0KLGGBal9O55e5DhdcEKhmSagJzuBy0CoSW+FFcwVY0rbdrR8w==","signatures":[{"sig":"MEYCIQDM3MvjdxqX/tU4XsKBfGSnzYSsN+60SzEd7fhkisgQrgIhANvsoJvh7ouoQyrPSct3mFjUQsJ/9rsAZEQmvvooAEe4","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":69070},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.js"}},"./package.json":"./package.json"},"gitHead":"6635fe076250ac6655544d13c2e9b4c1283eb78e","scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","clean":"rm -rf dist","typecheck":"tsc --noEmit","prepublishOnly":"tsup"},"_npmUser":{"name":"duyetdev","email":"lvduit08@gmail.com"},"repository":{"url":"git+https://github.com/duyet/anyrouter.git","type":"git","directory":"packages/ai-sdk-provider"},"_npmVersion":"11.12.1","description":"The AnyRouter provider for the Vercel AI SDK — call every AnyRouter model through `createAnyRouter`.","directories":{},"_nodeVersion":"26.0.0","dependencies":{"@anyr/sdk":"^0.1.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"ai":"^6.0.159","zod":"^4.4.3","@types/node":"^24.0.0","@ai-sdk/provider":"^3.0.10","@ai-sdk/provider-utils":"^4.0.0"},"peerDependencies":{"ai":"^6.0.0 || ^7.0.0-beta","zod":"^3.25.0 || ^4.0.0","@ai-sdk/provider":"^3.0.10 || ^4.0.0-beta","@ai-sdk/provider-utils":"^4.0.0 || ^5.0.0-beta"},"_npmOperationalInternal":{"tmp":"tmp/ai-sdk-provider_0.1.4_1781782465374_0.14271887056981414","host":"s3://npm-registry-packages-npm-production"}},"0.1.6":{"name":"@anyr/ai-sdk-provider","version":"0.1.6","description":"The AnyRouter provider for the Vercel AI SDK — call every AnyRouter model through `createAnyRouter`.","type":"module","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.js"}},"./package.json":"./package.json"},"engines":{"node":">=18"},"scripts":{"build":"tsup","dev":"tsup --watch","clean":"rm -rf dist","typecheck":"tsc --noEmit","test":"vitest run","prepublishOnly":"tsup"},"keywords":["anyrouter","ai-sdk","vercel-ai-sdk","ai","llm","openai","anthropic","language-model","provider"],"homepage":"https://anyrouter.dev","repository":{"type":"git","url":"git+https://github.com/duyet/anyrouter.git","directory":"packages/ai-sdk-provider"},"bugs":{"url":"https://github.com/duyet/anyrouter/issues"},"author":{"name":"Duyet Le"},"license":"MIT","publishConfig":{"access":"public"},"dependencies":{"@anyr/sdk":"^0.1.3"},"peerDependencies":{"@ai-sdk/provider":"^4.0.0","@ai-sdk/provider-utils":"^5.0.0","ai":"^7.0.0","zod":"^3.25.0 || ^4.0.0"},"devDependencies":{"@ai-sdk/provider":"^4.0.0","@ai-sdk/provider-utils":"^5.0.0","@types/node":"^24.0.0","ai":"^7.0.0","zod":"^4.4.3"},"gitHead":"1597b034648aa215e466df99efb884d28b7bb321","_id":"@anyr/ai-sdk-provider@0.1.6","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-U7FtH81gW57nI+wopoyOOhUVJgQMGXlCbaEfJJU/ADP4Ec/PTukHYfPcVKrR40kzUbSudFqJNkrB2Uzz3k56gg==","shasum":"f3167b8b885f84fb6b0fbde5fb7b0f767c8048df","tarball":"https://registry.npmjs.org/@anyr/ai-sdk-provider/-/ai-sdk-provider-0.1.6.tgz","fileCount":7,"unpackedSize":91717,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCPoETKo3/lXzl0UcmgWTsct2JHJIVoPnpKsjtmuRylkgIhAPm2jpiMPEQKDjlE77HxHXGjhLzDGJcWLkruXjMtswSA"}]},"_npmUser":{"name":"duyetdev","email":"lvduit08@gmail.com"},"directories":{},"maintainers":[{"name":"duyetdev","email":"lvduit08@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ai-sdk-provider_0.1.6_1785944451929_0.33118251249850017"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-17T18:04:46.292Z","modified":"2026-08-05T15:40:52.263Z","0.1.0":"2026-06-17T18:04:46.690Z","0.1.1":"2026-06-17T18:11:13.667Z","0.1.2":"2026-06-17T18:59:38.410Z","0.2.0":"2026-06-18T00:19:12.075Z","0.1.3":"2026-06-18T00:27:07.535Z","0.1.4":"2026-06-18T11:34:25.542Z","0.1.6":"2026-08-05T15:40:52.087Z"},"bugs":{"url":"https://github.com/duyet/anyrouter/issues"},"author":{"name":"Duyet Le"},"license":"MIT","homepage":"https://anyrouter.dev","keywords":["anyrouter","ai-sdk","vercel-ai-sdk","ai","llm","openai","anthropic","language-model","provider"],"repository":{"type":"git","url":"git+https://github.com/duyet/anyrouter.git","directory":"packages/ai-sdk-provider"},"description":"The AnyRouter provider for the Vercel AI SDK — call every AnyRouter model through `createAnyRouter`.","maintainers":[{"name":"duyetdev","email":"lvduit08@gmail.com"}],"readme":"# @anyr/ai-sdk-provider\n\nThe [AnyRouter](https://anyrouter.dev) provider for the [Vercel AI SDK](https://ai-sdk.dev).\n\nCall every model on the AnyRouter gateway through the standard AI SDK\ninterface — `generateText`, `streamText`, `generateObject`, `embedMany`,\n`generateImage` — with one key and one provider.\n\n## Install\n\n```bash\nnpm install @anyr/ai-sdk-provider ai zod\n# or\npnpm add @anyr/ai-sdk-provider ai zod\n```\n\n## Quickstart\n\n```ts\nimport { createAnyRouter } from \"@anyr/ai-sdk-provider\"\nimport { generateText } from \"ai\"\n\n// Reads ANYROUTER_API_KEY from the environment when omitted.\nconst anyrouter = createAnyRouter()\n\nconst { text } = await generateText({\n  model: anyrouter(\"openai/gpt-4o-mini\"),\n  prompt: \"What is AnyRouter?\",\n})\nconsole.log(text)\n```\n\n## Usage\n\n### generateText\n\n```ts\nimport { createAnyRouter } from \"@anyr/ai-sdk-provider\"\nimport { generateText } from \"ai\"\n\nconst anyrouter = createAnyRouter({ apiKey: process.env.ANYROUTER_API_KEY })\n\nconst { text } = await generateText({\n  model: anyrouter(\"anthropic/claude-opus-4-5\"),\n  system: \"You are a helpful assistant.\",\n  prompt: \"Explain the butterfly effect in one paragraph.\",\n})\n```\n\n### streamText\n\n```ts\nimport { createAnyRouter } from \"@anyr/ai-sdk-provider\"\nimport { streamText } from \"ai\"\n\nconst anyrouter = createAnyRouter()\n\nconst { textStream } = await streamText({\n  model: anyrouter(\"openai/gpt-4o\"),\n  prompt: \"Write a haiku about the ocean.\",\n})\n\nfor await (const chunk of textStream) {\n  process.stdout.write(chunk)\n}\n```\n\n### Reasoning models\n\nReasoning models (e.g. `deepseek/deepseek-r1`) return their thinking as a\nseparate stream — the provider surfaces it as the AI SDK's standard reasoning\nparts, so `reasoning`/`reasoningText` and the full-stream `reasoning-*` parts\nwork out of the box.\n\n```ts\nimport { createAnyRouter } from \"@anyr/ai-sdk-provider\"\nimport { generateText } from \"ai\"\n\nconst anyrouter = createAnyRouter()\n\nconst { text, reasoningText } = await generateText({\n  model: anyrouter(\"deepseek/deepseek-r1\"),\n  prompt: \"How many r's are in strawberry?\",\n})\n\nconsole.log(reasoningText) // the model's chain of thought\nconsole.log(text) // the final answer\n```\n\n### generateObject (structured output)\n\n```ts\nimport { createAnyRouter } from \"@anyr/ai-sdk-provider\"\nimport { generateObject } from \"ai\"\nimport { z } from \"zod\"\n\nconst anyrouter = createAnyRouter()\n\nconst { object } = await generateObject({\n  model: anyrouter(\"openai/gpt-4o-mini\"),\n  schema: z.object({\n    title: z.string(),\n    summary: z.string(),\n    tags: z.array(z.string()),\n  }),\n  prompt: \"Summarise the latest AI news in a structured format.\",\n})\n\nconsole.log(object.title, object.tags)\n```\n\n### Tool calling\n\n```ts\nimport { createAnyRouter } from \"@anyr/ai-sdk-provider\"\nimport { generateText, tool } from \"ai\"\nimport { z } from \"zod\"\n\nconst anyrouter = createAnyRouter()\n\nconst { text, toolCalls } = await generateText({\n  model: anyrouter(\"openai/gpt-4o\"),\n  tools: {\n    get_weather: tool({\n      description: \"Get the current weather in a city.\",\n      parameters: z.object({ city: z.string() }),\n      execute: async ({ city }) => ({ temperature: 22, unit: \"C\", city }),\n    }),\n  },\n  prompt: \"What is the weather in Tokyo?\",\n})\n```\n\n### Embeddings\n\n```ts\nimport { createAnyRouter } from \"@anyr/ai-sdk-provider\"\nimport { embedMany } from \"ai\"\n\nconst anyrouter = createAnyRouter()\n\nconst { embeddings } = await embedMany({\n  model: anyrouter.embeddingModel(\"openai/text-embedding-3-small\"),\n  values: [\"Hello world\", \"How are you?\"],\n})\n\nconsole.log(embeddings[0]) // [0.123, -0.456, ...]\n```\n\n### Image generation\n\n```ts\nimport { createAnyRouter } from \"@anyr/ai-sdk-provider\"\nimport { generateImage } from \"ai\"\n\nconst anyrouter = createAnyRouter()\n\nconst { image } = await generateImage({\n  model: anyrouter.imageModel(\"openai/dall-e-3\"),\n  prompt: \"A serene mountain lake at dawn, oil painting.\",\n  size: \"1024x1024\",\n})\n\n// image.base64 — base64-encoded PNG or URL depending on the model\n```\n\n### Provider options (routing, session, extra body)\n\n```ts\nimport { createAnyRouter } from \"@anyr/ai-sdk-provider\"\nimport { generateText } from \"ai\"\n\n// Set routing preferences at the provider level\nconst anyrouter = createAnyRouter({\n  provider: { only: [\"openai\"], quantizations: [\"bf16\"] },\n  sessionId: \"user-session-abc\",\n})\n\n// Or override them per-call\nconst { text } = await generateText({\n  model: anyrouter(\"openai/gpt-4o\"),\n  prompt: \"Hello!\",\n  experimental_providerMetadata: {\n    anyrouter: {\n      provider: { order: [\"openai\", \"azure\"] },\n      sessionId: \"per-request-session\",\n      extraBody: { logprobs: true },\n    },\n  },\n})\n```\n\n## Configuration\n\n```ts\nimport { createAnyRouter } from \"@anyr/ai-sdk-provider\"\n\nconst anyrouter = createAnyRouter({\n  // API key — falls back to ANYROUTER_API_KEY env var (resolved lazily at request time)\n  apiKey: \"<your-anyrouter-key>\",\n\n  // API base URL — defaults to https://anyrouter.dev/api/v1\n  baseURL: \"https://anyrouter.dev/api/v1\",\n\n  // Extra headers merged into every request\n  headers: { \"X-Custom-Header\": \"value\" },\n\n  // Custom fetch implementation (e.g. for logging or proxying)\n  fetch: myCustomFetch,\n\n  // Default routing preference forwarded as `provider` in the request body\n  provider: { only: [\"openai\"] },\n\n  // Session ID forwarded as `session_id` — useful for grouping in analytics\n  sessionId: \"my-session\",\n\n  // Extra fields merged into every request body (per-call overrides these)\n  extraBody: { safe_mode: true },\n})\n```\n\n## Provider methods\n\n| Method | Returns | Description |\n|--------|---------|-------------|\n| `anyrouter(modelId)` | `LanguageModelV3` | Shorthand for `anyrouter.chat(modelId)` |\n| `anyrouter.chat(modelId)` | `LanguageModelV3` | Chat / instruction language model |\n| `anyrouter.languageModel(modelId)` | `LanguageModelV3` | Alias for `.chat()` (ProviderV3 interface) |\n| `anyrouter.embeddingModel(modelId)` | `EmbeddingModelV3` | Text embedding model |\n| `anyrouter.imageModel(modelId)` | `ImageModelV3` | Image generation model |\n| `anyrouter.client` | `AnyRouter` | Raw `@anyr/sdk` client (escape hatch) |\n\n## Default export\n\n```ts\nimport { anyrouter } from \"@anyr/ai-sdk-provider\"\n\n// Uses ANYROUTER_API_KEY from the environment\nconst { text } = await generateText({\n  model: anyrouter(\"openai/gpt-4o-mini\"),\n  prompt: \"Hello!\",\n})\n```\n\nBuilt on [`@anyr/sdk`](https://www.npmjs.com/package/@anyr/sdk).\n\n## License\n\nMIT © Duyet Le\n","readmeFilename":"README.md"}