Platform & Ecosystem Cloudflare AI Gateway changelog ·

Cloudflare Unifies Agents SDK Model Routing with createAI Function

Open source ↗

Development

Cloudflare introduced the createAI function in its Agents SDK, consolidating workers-ai-provider and ai-gateway-provider into a unified interface for AI SDK and Pi AI. The update allows developers to query Workers AI models, AI Gateway catalog models, dynamic routes, and third-party vendor models through a single invocation pattern. Cloudflare announced that the legacy provider libraries are feature-frozen and deprecated.

Key facts

  • Cloudflare released the createAI function in its Agents SDK supporting the AI SDK and Pi AI.
  • The createAI function unifies workers-ai-provider and ai-gateway-provider, both of which are now feature-frozen and deprecated.
  • The function supports Workers AI models (@cf/ IDs), the AI Gateway catalog, dynamic routes (dynamic/), and vendor models routed to AI Gateway’s provider-native endpoint.
  • Supported operational features include model fallbacks, mid-answer stream resumption via bindings, caching, logging, metadata, retries, byokAlias, zdr, and vendorKey.
  • Developers can authenticate via the env.AI Worker binding or an account ID and API token for external access.
  • AI Search capabilities previously invoked via createAISearch in workers-ai-provider were relocated to createAISearchNamespace in ai-search-provider.

Why it matters

Autonomous agent reliability depends heavily on robust fallback routing and observability. Unifying agent model access with gateway middleware simplifies the operational overhead of managing multi-model failovers and client attribution across distributed infrastructure.

Trend impact

  • agent-middleware-consolidation
  • ai-gateway-routing

Evidence

  • Primary source
  • Evidence ID: cf-changelog-ai-gateway--8f0caccb1b2dbb46