// AI Platform Drift
Cloudflare Agents SDK deprecates workers-ai-provider and ai-gateway-provider for unified createAI
Cloudflare developer changelog · published 2026-10-22 04:48 UTC
WHAT CHANGEDCloudflare deprecated workers-ai-provider and ai-gateway-provider on 21 October 2026, replacing them with a single createAI function in the Agents SDK. The new function consolidates Workers AI models, AI Gateway catalog models, dynamic routes, and vendor models into one interface. Function signatures changed: createWorkersAI({ accountId, apiKey }) becomes createAI({ accountId, apiToken }), and createAiGateway is replaced by createAI with a fallback parameter for model lists. AI Search moves to a separate ai-search-provider package.
WHY IT MATTERSCode using the deprecated providers will continue to work but receives no new features. The parameter rename from apiKey to apiToken breaks existing credential-based initialization. Applications that do not migrate will miss stream resume, vendor model passthrough, and cross-account gateway access.
WHAT TO DOAudit code for imports from workers-ai-provider and ai-gateway-provider. Replace createWorkersAI and createAiGateway calls with createAI from agents/models/ai-sdk, changing apiKey parameters to apiToken. For AI Search, migrate createAISearch to createAISearchNamespace from ai-search-provider. Test credential initialization and model fallback arrays.
Model-reported confidence 85% (not measured accuracy)
Primary source ↗
written by anthropic/claude-sonnet-4.5
Show the reasoning — raw diff, triage verdict, confidence
RAW DIFF
+## Agents, Workers AI, AI Gateway - createAI replaces workers-ai-provider and ai-gateway-provider +https://developers.cloudflare.com/changelog/post/2026-10-21-createai/ +Wed, 21 Oct 2026 00:00:00 GMT + +The Agents SDK has a new createAI function for the AI SDK and Pi AI. It unifies what workers-ai-provider and ai-gateway-provider did: Workers AI models, AI Gateway catalog models, dynamic routes, and vendor models, through the AI binding or an account id and API token. +workers-ai-provider and ai-gateway-provider are now feature frozen and marked as deprecated. Please migrate at your convenience. +npm i agents +import { createAI } from "agents/models/ai-sdk"; +import { streamText } from "ai"; + +export default { +async fetch(request, env) { +const ai = createAI({ binding: env.AI, id: "my-gateway" }); + +const result = streamText({ +model: ai("anthropic/claude-opus-5.5", { +fallback: ["@cf/zai-org/glm-4.7-flash"], +}), +prompt: "Write a haiku about Durable Objects", +}); + +return result.toTextStreamResponse(); +}, +};import { createAI } from "agents/models/ai-sdk"; +import { streamText } from "ai"; + +export default { +async fetch(request: Request, env: Env) { +const ai = createAI({ binding: env.AI, id: "my-gateway" }); + +const result = streamText({ +model: ai("anthropic/claude-opus-5.5", { +fallback: ["@cf/zai-org/glm-4.7-flash"], +}), +prompt: "Write a haiku about Durable Objects", +}); + +return result.toTextStreamResponse(); +}, +}; +With createAI you get: + +Every model by id. Workers AI @cf/ ids, any model in the AI Gateway catalog, and dynamic routes as dynamic/<route>. +Vendor model objects. Pass a model from the vendor's own package, such as ai(anthropic("claude-opus-5-5")). It goes unchanged to AI Gateway's provider-native endpoint. +The binding, or an account id and API token. Use a gateway in another account, or call from outside a Worker. +Gateway options, fallback, and BYOK. Caching, logging, metadata, retries, byokAlias, zdr, and vendorKey. +Stream resume. Through the binding, a catalog or dynamic route stream that drops mid-answer resumes. +Other model types. Embeddings, images, speech, transcription, and reranking in the AI SDK provider, and images in Pi AI. + +Before +After + +createWorkersAI({ binding }) +createAI({ binding }) + +createWorkersAI({ accountId, apiKey }) +createAI({ accountId, apiToken }) + +createAiGateway(...) +createAI(...), with fallback for a list of models + +createAISearch from workers-ai-provider +createAISearchNamespace from ai-search-provider + +For AI Search, use ai-search-provider. For more information, refer to Models.
HOW IT WAS JUDGED
Triage signals below are model-reported assertions, preserved verbatim; they are not independent arithmetic verification.
| triage verdict | MATERIAL at 0.95, needed 0.5 |
|---|---|
| triage reasoning | Deprecation of two provider packages with breaking API replacements requires migration action. |
| signals | deprecation announced: workers-ai-provider and ai-gateway-provider marked deprecated · breaking API change: createWorkersAI and createAiGateway replaced by createAI · function signature changes: accountId+apiKey → accountId+apiToken parameter rename · new unified API surface consolidates three provider patterns into one · migration required: existing code using old providers must adopt createAI · future date: changelog dated 2026-10-21 signals planned sunset window |
| suppression | — |
| triage model | anthropic/claude-haiku-4.5 ($0.00000) |
| writer model | anthropic/claude-sonnet-4.5 ($0.00000) |