PuppyIP Resource Center
AI Tools & Networking 4 min Published 2026-12-03

How Cloudflare AI Gateway multi-provider routing chooses a provider

Check which providers serve the same model, then set gateway defaults and per-request preferences separately.

Cloudflare AI Gateway Multi-provider routing Model APIs AI gateways

Service eligibility and regional restrictions

PuppyIP serves only compliant overseas businesses and their authorized personnel. Proxy services are not available in mainland China. The service may only be used for lawful business activities outside mainland China. Use of this service within mainland China is prohibited.

Hosting a proxy IP or server overseas does not change these restrictions. The service must not be provided to end users in mainland China through relaying, forwarding, sharing or resale. Before use, read the Terms of Service.

Key Takeaways

  • Cloudflare announced multi-provider routing on Dec. 2, 2026. When enabled, a request for a model can go to any provider that serves that model.
  • Cloudflare plans to default multi-provider routing to on for new gateways starting December 9. Existing gateways retain their current settings.
  • With the gateway setting off, a request can still name providers with cf-aig-allowed-providers. Model aliases can use every provider for their models as well.
  • cf-aig-provider-order expresses a preferred order. provider-sort=price sorts only providers omitted from that order by token price.

The change is provider choice for the same model

On Dec. 2, 2026, Cloudflare announced multi-provider routing for AI Gateway. Many models are served by more than one provider; Anthropic Claude models, for example, are also available from Google Vertex AI. When the feature is on, a request for a model can go to any provider that serves it. If one provider fails or is unhealthy, the gateway can use another.

The scope is which providers serve the requested model, rather than automatic switching among arbitrary models. Check the model catalog in the Cloudflare dashboard to see a model’s available providers. The Anthropic, Google Vertex AI, Groq, Google AI Studio, and Fireworks combinations in the release note are examples added at that time, not a complete catalog.

New and existing gateways have different defaults

Cloudflare plans to turn on multi-provider routing by default for new gateways starting December 9, 2026. Existing gateways keep their saved settings. To enable it on an existing gateway, open that gateway’s Settings, turn on Multi-Provider Routing, and save.

Cloudflare also documents an API configuration: set multiprovider_enabled to true in the request body used to update a gateway. The release note links to the gateway update API. If you make the change in the dashboard or through configuration management, verify the target gateway and record when the setting changed so the default and saved state are not confused.

Limit or prefer providers with request headers

With the gateway setting off, a single request can still name providers in cf-aig-allowed-providers. The header takes comma-separated provider IDs and makes the request use only those providers. If none of them serves the requested model, AI Gateway returns a 400 error. Use the provider slugs shown for that model in Cloudflare’s model catalog.

Model aliases have a separate rule: an alias can use every provider for its models whether multi-provider routing is on or off. A providers list configured on the alias still limits which providers it can use; the exception means the gateway multi-provider switch does not restrict the alias.

What ordering and price sorting control

cf-aig-provider-order takes comma-separated provider IDs and lists which ones to try first, in order. List each provider once. It is a preference: it does not remove unlisted providers from the pool or add providers the gateway does not allow. If the preferred provider is unhealthy, the gateway can still choose another available provider. When the setting is off, use cf-aig-allowed-providers to name a non-primary provider.

To sort the remaining providers, set cf-aig-provider-sort to price. The documentation defines this as ordering providers omitted from provider-order by their input and output token prices, lowest first. Providers without price data keep their default order. This describes candidate ordering; it does not guarantee that every request’s total bill will be lower.

Check which provider served a request

The response itself does not include the provider name. Cloudflare’s documentation says to find the request in AI Gateway logs: the provider field identifies who served it, and the cf-aig-log-id response header helps locate the log entry. Before rollout, check the target model’s provider list in the catalog and confirm the gateway you are changing. Afterward, use logs to verify actual routing instead of inferring the final provider from the requested preference alone.

Sources

Frequently Asked Questions

Will the Dec. 9 default turn on routing for existing gateways?

The December 9 default applies to new gateways. Existing gateways keep their current settings, which you can change in each gateway’s Settings.

Can I request a non-primary provider while the setting is off?

Yes. Name it for that request with cf-aig-allowed-providers. The request uses only the listed providers and returns 400 if none serves the model. Model aliases can use every provider for their models regardless of the setting.

Does provider-sort=price guarantee the lowest total bill?

No such guarantee is documented. It sorts providers omitted from provider-order by input and output token prices; providers without price data keep their default order.