Skip to content
Rush Commerce
Software & Dev2 min read

Cloudflare createAI Replaces workers-ai-provider: Migrate Now

Cloudflare's Agents SDK createAI replaces workers-ai-provider and ai-gateway-provider, now deprecated. One factory, fallbacks, BYOK. Plan your migration.

If your app calls models on Cloudflare, two of your dependencies just went into maintenance mode. Cloudflare's Agents SDK now ships createAI, one factory for Workers AI, AI Gateway catalog models, dynamic routes and vendor models. The packages it replaces, workers-ai-provider and ai-gateway-provider, are feature frozen and deprecated. There is no removal date yet. That is the time to move, not a reason to wait.

What actually happened

Per the Cloudflare changelog dated October 21:

  • Import: createAI comes from agents/models/ai-sdk for the Vercel AI SDK, with a Pi AI version too. Install with npm i agents.
  • Connect two ways: pass the AI binding inside a Worker, or an account ID plus API token to reach a gateway in another account or call from outside Workers.
  • One ID scheme: Workers AI models use @cf/ IDs. Catalog models use provider/model, such as anthropic/claude-opus-5.5. Dynamic routes use dynamic/<route>. Vendor model objects pass through to provider-native endpoints.
  • Fallbacks: each model call takes a fallback list. Cloudflare's own example sends Claude first and drops to a Workers AI GLM model if it fails.
  • Gateway options: caching, logging, metadata, retries, BYOK aliases and zero data retention.
  • Stream resume: through the binding, a catalog or dynamic-route stream that drops mid-answer picks back up.
  • Migration is mostly a rename: createWorkersAI({ binding }) becomes createAI({ binding }). The apiKey option becomes apiToken. AI Search moves to the separate ai-search-provider package.

The Agents models docs cover the full API.

Why createAI matters for your business

Deprecated means no fixes. A frozen package still runs today. It will not get new models, new gateway features or bug fixes. The longer you wait, the bigger the diff when something breaks.

Fallback is now one line. A model outage used to mean a try/catch and a second client. Now it is an array. For a support bot or an order-status agent, a cheap fallback model keeps the lights on when your main provider has a bad hour.

Model IDs become config, not code. With every model behind one string format, swapping Claude for GLM is an environment variable. That is how you keep a vendor honest on price.

Watch the ZDR and BYOK flags. If you handle customer data, set zero data retention and bring your own keys on purpose, and write down why.

Key takeaways

  • createAI in the Agents SDK replaces workers-ai-provider and ai-gateway-provider
  • Old packages are feature frozen and deprecated, no removal date announced
  • One ID format covers Workers AI, gateway catalog, dynamic routes and vendor models
  • Per-call fallback lists, BYOK and zero data retention are built in
  • Migration is mostly a rename, so do it before you need a new feature

Your AI features hard-wired to one model? We build provider-agnostic model layers with fallbacks and cost logging, on infrastructure you own. See how we build or price the switch.

Sources: Cloudflare changelog, Cloudflare Agents models docs.

  • #cloudflare
  • #agents-sdk
  • #ai-gateway
  • #workers-ai
  • #vercel-ai-sdk
TR

Tommy Rush — Founder, Rush Commerce

Operator turned builder. 15+ years running operations — now shipping the systems businesses run on. More

Get The Rush Report weekly — one email, zero fluff.