{"_id":"@api-route/ai-sdk-provider","name":"@api-route/ai-sdk-provider","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@api-route/ai-sdk-provider","version":"0.1.0","description":"API Route community provider for the Vercel AI SDK","type":"module","sideEffects":false,"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"build":"tsup src/index.ts --format esm --dts --clean","lint":"eslint .","test":"vitest run","typecheck":"tsc --noEmit"},"engines":{"node":">=22"},"keywords":["ai","ai-sdk","api-route","openai-compatible","vercel-ai-sdk"],"homepage":"https://www.api-route.com/","repository":{"type":"git","url":"git+https://github.com/DennyHo0917/api-route-ai-sdk-provider.git"},"bugs":{"url":"https://github.com/DennyHo0917/api-route-ai-sdk-provider/issues"},"license":"Apache-2.0","dependencies":{"@ai-sdk/openai-compatible":"^3.0.44"},"peerDependencies":{"ai":"^7.0.0"},"devDependencies":{"@eslint/js":"^10.0.1","@types/node":"^26.4.1","ai":"^7.0.93","eslint":"^10.0.0","globals":"^17.12.0","tsup":"^8.5.1","typescript":"^5.9.3","typescript-eslint":"^8.69.0","vitest":"^5.0.0"},"gitHead":"754373f3d8d36f8848f09c7d8ce805f477da036b","_id":"@api-route/ai-sdk-provider@0.1.0","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-ueQT6e3EQDq0GmYPLYM9RFjUlYkXE8g8bhHUE25QYkog+w8PB7uzRg/8rLdSjzAsOQ3cW8YL2PVKtq+oa7R0tA==","shasum":"b047f1e0ddff91a6191e1886bbfdee93dcf79b05","tarball":"https://registry.npmjs.org/@api-route/ai-sdk-provider/-/ai-sdk-provider-0.1.0.tgz","fileCount":5,"unpackedSize":17529,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBauZZsHE+T3EODZK2gO4Y0N/aCf/CSggx0uldbP6ethAiEAjttPoAB/RwCDmTAF33d3ztABp1DlNLQpEUuNe+ykgEs="}]},"_npmUser":{"name":"dennyho0917","email":"dennyho0917@gmail.com"},"directories":{},"maintainers":[{"name":"dennyho0917","email":"dennyho0917@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ai-sdk-provider_0.1.0_1788667746254_0.7634704805415586"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-06T04:09:06.076Z","0.1.0":"2026-09-06T04:09:06.391Z","modified":"2026-09-06T04:09:06.605Z"},"maintainers":[{"name":"dennyho0917","email":"dennyho0917@gmail.com"}],"description":"API Route community provider for the Vercel AI SDK","homepage":"https://www.api-route.com/","keywords":["ai","ai-sdk","api-route","openai-compatible","vercel-ai-sdk"],"repository":{"type":"git","url":"git+https://github.com/DennyHo0917/api-route-ai-sdk-provider.git"},"bugs":{"url":"https://github.com/DennyHo0917/api-route-ai-sdk-provider/issues"},"license":"Apache-2.0","readme":"# API Route Provider for the Vercel AI SDK\n\n`@api-route/ai-sdk-provider` is a minimal OpenAI-compatible community provider for the current Vercel AI SDK. It supports text generation, streaming, and tool calling in Node.js and Edge runtimes.\n\n## Setup\n\nInstall the provider and AI SDK:\n\n```bash\nnpm install @api-route/ai-sdk-provider ai\n```\n\nOpen [API Access](https://www.api-route.com/) on the API Route website to get your Base URL and API key, then set:\n\n```bash\nAPI_ROUTE_BASE_URL=\"your-base-url\"\nAPI_ROUTE_API_KEY=\"your-api-key\"\n```\n\nThe Base URL should include the API version path shown in API Access.\n\n## Quickstart\n\n```ts\nimport { generateText } from 'ai';\nimport { apiRoute } from '@api-route/ai-sdk-provider';\n\nconst { text } = await generateText({\n  model: apiRoute('your-model-id'),\n  prompt: 'Hello!',\n});\n\nconsole.log(text);\n```\n\nAny model ID string accepted by your API Route endpoint can be passed directly.\n\n## Streaming\n\n```ts\nimport { streamText } from 'ai';\nimport { apiRoute } from '@api-route/ai-sdk-provider';\n\nconst result = streamText({\n  model: apiRoute('your-model-id'),\n  prompt: 'Write a short story.',\n});\n\nfor await (const chunk of result.textStream) {\n  process.stdout.write(chunk);\n}\n```\n\n## Tool calling\n\n```ts\nimport { generateText, jsonSchema, tool } from 'ai';\nimport { apiRoute } from '@api-route/ai-sdk-provider';\n\nconst result = await generateText({\n  model: apiRoute('your-model-id'),\n  prompt: 'What is the weather in Shanghai?',\n  tools: {\n    weather: tool({\n      description: 'Get weather by city',\n      inputSchema: jsonSchema<{ city: string }>({\n        type: 'object',\n        properties: { city: { type: 'string' } },\n        required: ['city'],\n        additionalProperties: false,\n      }),\n    }),\n  },\n});\n\nconsole.log(result.toolCalls);\n```\n\nTool support depends on the selected model.\n\n## Custom configuration\n\nExplicit settings override environment variables. Custom headers are merged after Bearer authentication headers by the underlying OpenAI-compatible provider.\n\n```ts\nimport { createAPIRoute } from '@api-route/ai-sdk-provider';\n\nconst apiRoute = createAPIRoute({\n  baseURL: 'https://your-base-url/v1',\n  apiKey: 'your-api-key',\n  headers: { 'X-Custom-Header': 'value' },\n  fetch: customFetch,\n});\n```\n\n## Resources\n\n- [API Route website](https://www.api-route.com/)\n- [Documentation](https://www.api-route.com/docs/overview)\n- [Quickstart](https://www.api-route.com/docs/quickstart)\n\n## Scope\n\nThis first release intentionally exposes only OpenAI-compatible chat language models. Image, audio, completion-only, and embedding APIs are not included.\n\n## License\n\nApache-2.0\n","readmeFilename":"README.md","_rev":"1-8af8e939527254303822178f73f372fe"}