{"_id":"@economic/agents-providers","_rev":"2-65e464910fb34dbc5a149f00883746d8","name":"@economic/agents-providers","dist-tags":{"canary":"0.0.1-canary.20260604191608","latest":"1.0.0"},"versions":{"0.0.1-canary.20260604191608":{"name":"@economic/agents-providers","version":"0.0.1-canary.20260604191608","license":"MIT","_id":"@economic/agents-providers@0.0.1-canary.20260604191608","maintainers":[{"name":"e-conomic-devops","email":"opsteam@e-conomic.com"},{"name":"claudiuhojdavisma","email":"claudiu.hojda@visma.com"},{"name":"matthew.daly","email":"matthew.daly@visma.com"},{"name":"peter.kasarda.visma","email":"peter.kasarda@visma.com"}],"dist":{"shasum":"18004a967cb3a279724508a972d5faa5bab4ba87","tarball":"https://registry.npmjs.org/@economic/agents-providers/-/agents-providers-0.0.1-canary.20260604191608.tgz","fileCount":4,"integrity":"sha512-TyqU+3YX9NXKoPqjgH1MvyanWGNDMVmZDc6WmrQbnrGhNpuvniE8Wggec2Xy3LQxWE8Cw2KF7VWMjcr5Otcz2g==","signatures":[{"sig":"MEQCIAr6rYAzu6q+3F2E9Uqabar1KlQiP4oUW8wxzTGZBzB2AiAvqgXd+ur9GEjY+kSkytk7pQYXVoi748WNUmx0UzyNLA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7939},"type":"module","types":"./dist/index.d.mts","exports":{".":"./dist/index.mjs","./package.json":"./package.json"},"gitHead":"c28f86d3fddfac4a299f0aace157d9caa4847146","scripts":{"dev":"tsdown --watch","test":"vitest","build":"tsdown","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"_npmUser":{"name":"matthew.daly","email":"matthew.daly@visma.com"},"_npmVersion":"11.12.1","description":"Provider helpers for creating AI SDK language models behind Cloudflare AI Gateway.","directories":{},"_nodeVersion":"25.9.0","dependencies":{"@ai-sdk/google":"^3.0.73","@ai-sdk/anthropic":"^3.0.77"},"_hasShrinkwrap":false,"devDependencies":{"tsdown":"^0.22.0","vitest":"^4.1.4","typescript":"^6.0.2","@types/node":"^25.6.0","@cloudflare/workers-types":"^4.20260602.1","@typescript/native-preview":"7.0.0-dev.20260412.1"},"_npmOperationalInternal":{"tmp":"tmp/agents-providers_0.0.1-canary.20260604191608_1780597136511_0.7387310949418262","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@economic/agents-providers","version":"1.0.0","license":"MIT","type":"module","types":"./dist/index.d.mts","exports":{".":"./dist/index.mjs","./package.json":"./package.json"},"scripts":{"build":"tsdown","dev":"tsdown --watch","test":"vitest","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"dependencies":{"@ai-sdk/anthropic":"^3.0.77","@ai-sdk/google":"^3.0.73"},"devDependencies":{"@cloudflare/workers-types":"^4.20260602.1","@types/node":"^25.6.0","@typescript/native-preview":"7.0.0-dev.20260412.1","tsdown":"^0.22.0","typescript":"^6.0.2","vitest":"^4.1.4"},"gitHead":"568f79209d393e5f8f3ac0b4fc21c4a512bf8d10","_id":"@economic/agents-providers@1.0.0","description":"Provider helpers for creating AI SDK language models behind Cloudflare AI Gateway.","_nodeVersion":"24.16.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-KHREbOnPziwaJB2Jgyn21OuGSbkaYVcTORp9zTgYkOQh3fKLBfd7hguxQDDB3l39Unbew4BJuyMZK127ZSpupg==","shasum":"c31380c04ad472d86da5315ed84f5ad33e1c96fe","tarball":"https://registry.npmjs.org/@economic/agents-providers/-/agents-providers-1.0.0.tgz","fileCount":4,"unpackedSize":7917,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEW7SdgPMHwXWqSmYKoLRbP6ev3erz0DawWtwk0JFdBNAiEA7eQWQR/nMezfhM1g2pYLZcpD56Hn9JIahDUymcThV2g="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:179dbdee-5691-4097-98bc-2f6cce36ab96"}},"directories":{},"maintainers":[{"name":"e-conomic-devops","email":"opsteam@e-conomic.com"},{"name":"claudiuhojdavisma","email":"claudiu.hojda@visma.com"},{"name":"matthew.daly","email":"matthew.daly@visma.com"},{"name":"peter.kasarda.visma","email":"peter.kasarda@visma.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/agents-providers_1.0.0_1780597318943_0.38337780012430933"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-04T18:18:56.303Z","modified":"2026-06-04T18:21:59.258Z","0.0.1-canary.20260604191608":"2026-06-04T18:18:56.705Z","1.0.0":"2026-06-04T18:21:59.103Z"},"license":"MIT","description":"Provider helpers for creating AI SDK language models behind Cloudflare AI Gateway.","maintainers":[{"name":"e-conomic-devops","email":"opsteam@e-conomic.com"},{"name":"claudiuhojdavisma","email":"claudiu.hojda@visma.com"},{"name":"matthew.daly","email":"matthew.daly@visma.com"},{"name":"peter.kasarda.visma","email":"peter.kasarda@visma.com"}],"readme":"# @economic/agents-providers\n\nProvider helpers for creating AI SDK language models behind Cloudflare AI Gateway.\n\nThe package is meant for server-side code, especially Cloudflare Workers using [`@economic/agents`](../agents/README.md). It keeps gateway configuration in one place while still giving each provider its own typed model names.\n\n## Install\n\n```sh\nnpm install @economic/agents-providers\n```\n\n## Basic Usage\n\nCreate the providers object once from your Worker bindings, then use it anywhere you need an AI SDK language model.\n\n```ts\nimport { createAiGatewayVertexProviders } from \"@economic/agents-providers\";\nimport { env } from \"cloudflare:workers\";\n\nexport const providers = createAiGatewayVertexProviders({\n  cloudflareAccountId: env.CLOUDFLARE_ACCOUNT_ID,\n  cloudflareAiGatewayId: env.CLOUDFLARE_AI_GATEWAY_ID,\n  cloudflareApiToken: env.CLOUDFLARE_API_TOKEN,\n  googleCloudProjectId: env.GOOGLE_CLOUD_PROJECT_ID,\n  googleApiKey: env.GOOGLE_GENERATIVE_AI_API_KEY,\n});\n```\n\nUse the provider in an agent:\n\n```ts\nimport { ChatAgent } from \"@economic/agents\";\nimport type { LanguageModel } from \"ai\";\nimport { providers } from \"./providers\";\n\nexport class SupportAgent extends ChatAgent {\n  getModel(): LanguageModel {\n    return providers.gemini(\"gemini-2.5-flash\");\n  }\n\n  getFastModel(): LanguageModel {\n    return providers.anthropic(\"claude-haiku-4-5\");\n  }\n}\n```\n\n`providers.anthropic(...)` is typed from `@ai-sdk/anthropic`, and `providers.gemini(...)` is typed from `@ai-sdk/google`, so model names follow the SDKs instead of hand-maintained lists in this package.\n\n## Configuration\n\n`createAiGatewayVertexProviders` accepts the shared Cloudflare AI Gateway settings plus the Google Vertex settings needed for Anthropic:\n\n```ts\ninterface AiGatewayVertexProvidersOptions {\n  cloudflareAccountId: string;\n  cloudflareAiGatewayId: string;\n  cloudflareApiToken: string;\n  googleCloudProjectId: string;\n  googleApiKey?: string;\n  location?: string;\n  anthropicVersion?: string;\n}\n```\n\nDefaults:\n\n- `location`: `\"europe-west1\"`\n- `anthropicVersion`: `\"vertex-2023-10-16\"`\n\nRequired values should usually come from Worker bindings rather than being read inside the library. That keeps this package testable and usable in different runtimes.\n\n`googleApiKey` is passed to `@ai-sdk/google` for Gemini. If your Cloudflare AI Gateway is configured to authenticate upstream requests itself, the library sends `\"unused\"` to satisfy the Google SDK's required API-key header.\n\n## Exports\n\n```ts\nimport {\n  createAiGatewayVertexProviders,\n  createAnthropicVertexProvider,\n  createGeminiProvider,\n  type AiGatewayVertexProvidersOptions,\n  type AnthropicVertexModelId,\n  type AnthropicVertexProviderOptions,\n  type GeminiModelId,\n  type GeminiProviderOptions,\n} from \"@economic/agents-providers\";\n```\n\nUse `createAiGatewayVertexProviders` for normal app setup. Use `createAnthropicVertexProvider` or `createGeminiProvider` only if you want one provider by itself.\n\n## Current Providers\n\n- `anthropic(modelId)` routes Anthropic Messages models through Cloudflare AI Gateway to Google Vertex AI.\n- `gemini(modelId)` routes Gemini models through Cloudflare AI Gateway to Google AI Studio.\n\nMore providers can be added to the same factory without changing the way callers pass shared Cloudflare/Vertex configuration.\n","readmeFilename":"README.md"}