Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .changeset/ai-gateway-provider-rewrite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
"ai-gateway-provider": major
---

Rewrote the AI Gateway provider with a new API. `createAIGateway` now wraps any standard AI SDK provider as a drop-in replacement — no more importing wrapped providers from `ai-gateway-provider/providers/*`.

**New features:**

- `createAIGateway({ provider, binding/accountId })` — wraps any AI SDK provider
- `createAIGatewayFallback({ models, binding/accountId })` — cross-provider fallback
- `providerName` — explicit provider name for custom base URLs
- `byok: true` — strips provider auth headers for BYOK/Unified Billing
- `byokAlias` and `zdr` gateway options
- 22 providers auto-detected from URL (up from 13)
- `resolveProvider` exported as a utility

**Bug fixes:**

- Updated stale cache header names (`cf-skip-cache` → `cf-aig-skip-cache`, `cf-cache-ttl` → `cf-aig-cache-ttl`)
- Fixed fetch mutation not being restored after gateway calls
- Removed unanchored Google Vertex regex that could match unintended URLs
- Fixed query parameter loss for custom URLs with `providerName`

**Breaking changes:**

- `createAiGateway` → `createAIGateway` (new API shape — takes `provider` instead of model arrays)
- Removed all `ai-gateway-provider/providers/*` subpath exports
- Removed `@ai-sdk/openai-compatible` from peer dependencies
- Removed all `optionalDependencies`
- Fallback is now a separate `createAIGatewayFallback` function
5 changes: 5 additions & 0 deletions .changeset/workers-ai-gateway-tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"workers-ai-provider": patch
---

Added AI Gateway e2e tests for the binding path. The test worker now accepts a `?gateway=<name>` query parameter to route requests through a specified AI Gateway, validating that the built-in `gateway` option works for chat, streaming, multi-turn, tool calling, structured output, embeddings, and image generation.
3 changes: 2 additions & 1 deletion .oxlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"no-await-in-loop": "off",
"react/react-in-jsx-scope": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "off"
"@typescript-eslint/no-explicit-any": "off",
"eslint(no-shadow)": "off"
},
"ignorePatterns": ["**/worker-configuration.d.ts", "types/workerd.d.ts"]
}
1 change: 0 additions & 1 deletion CODEOWNERS

This file was deleted.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@
"sharp",
"workerd"
],
"patchedDependencies": {
"@ai-sdk/google-vertex": "patches/@ai-sdk__google-vertex.patch"
}
"patchedDependencies": {}
}
}
Loading
Loading