Set the provider order
You can also control which provider AI Gateway tries first for a model. Set the cf-aig-provider-order header to list the providers to try first. Set the cf-aig-provider-sort header to price to order the remaining providers by their input and output token price.
For example, anthropic/claude-haiku-5.5 ↗︎ is available from Anthropic and Google Vertex AI. On a gateway with multi-provider routing on, this request tries Google Vertex AI first, and falls back to Anthropic:
curl "https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/messages" \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--header "cf-aig-provider-order: google-vertex-ai" \
--data '{
"model": "anthropic/claude-haiku-5.5",
"messages": [{ "role": "user", "content": "Reply with a short greeting." }],
"max_tokens": 128
}'
The provider order is a preference. It does not remove providers from the pool, and it does not add providers that the gateway does not allow. AI Gateway can still choose a different provider if the preferred one is unhealthy.
For more information, refer to Multi-provider routing.
Nov 30, 2026 …