Verified Platform & Ecosystem Cloudflare AI Gateway changelog ·

Cloudflare Unifies Agents SDK Model Routing with createAI Function

Open source ↗

Summary

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.

Insight

By merging direct model invocation and proxy mediation into a single SDK function, Cloudflare embeds gateway-level governance—such as dynamic fallbacks, observability logging, and stream recovery—directly into the default agent development stack.

Implication

Developers building autonomous agents on Cloudflare must migrate existing integrations to createAI or ai-search-provider. Upstream AI agent traffic will increasingly flow through unified gateway middleware by default, standardizing logging and failover behavior across disparate model providers.

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.

Evidence

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