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
32 changes: 32 additions & 0 deletions .changeset/ai-gateway-provider-rewrite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
"ai-gateway-provider": minor
---

Rewrote the AI Gateway provider with a new API. `createAIGateway` now wraps any standard AI SDK provider — import directly from `@ai-sdk/*` instead of `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 BYOK leaking dummy API keys (`Authorization: Bearer unused` was forwarded to the provider)
- 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`
- Propagate abort signals to binding and fetch calls

**Deprecated (all still work, with a one-time console warning):**

- `createAiGateway()` — use `createAIGateway()` (wraps a provider) or `createAIGatewayFallback()` (cross-provider fallback) instead
- `ai-gateway-provider/providers/*` subpath imports — import directly from `@ai-sdk/*` and use `createAIGateway()` instead
- Old type names: `AiGatewaySettings` → `AiGatewayConfig`, `AiGatewayAPISettings` → `AiGatewayAPIConfig`, `AiGatewayBindingSettings` → `AiGatewayBindingConfig`, `AiGatewayReties` → `AiGatewayRetries`

All deprecated APIs will be removed in the next major version.
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