cloudflare-docs icon indicating copy to clipboard operation
cloudflare-docs copied to clipboard

[AI Gateway] Dynamic Routing - JSON configuration

Open letanloc1998 opened this issue 11 months ago • 5 comments

Existing documentation URL(s)

https://developers.cloudflare.com/ai-gateway/features/dynamic-routing/json-configuration/

Hello team,

How to use REST API to configure dynamic routing? I cannot find endpoint to do that

What changes are you suggesting?

Could you please add example REST API to configure dynamic routing?

Additional information

No response

letanloc1998 avatar Dec 27 '25 20:12 letanloc1998

I can confirm this is missing. The docs say "you can do it using the REST API" but there's no endpoint documented anywhere.

For comparison, the Custom Providers API docs show exactly what we need: https://developers.cloudflare.com/ai-gateway/configuration/custom-providers/

curl -X POST "https://api.cloudflare.com/client/v4/accounts/{account_id}/ai-gateway/custom-providers" \
  -H "Authorization: Bearer {token}" \
  -d '{
    "name": "My Provider",
    "slug": "my-provider",
    "base_url": "https://api.example.com/v1"
  }'

We need the same for dynamic routes.

nilh2a2 avatar Dec 31 '25 06:12 nilh2a2

Good catch, looking into it

roerohan avatar Dec 31 '25 10:12 roerohan

Good catch, looking into it

Could you support create/update BYOK via API?

https://developers.cloudflare.com/ai-gateway/configuration/bring-your-own-keys/

Moreover, could you consider to support "use authorization header" to use authorization header instead of cf-aig-authorization? (Because some client only support authorization header)

https://developers.cloudflare.com/ai-gateway/configuration/authentication/

letanloc1998 avatar Jan 01 '26 08:01 letanloc1998

Dynamic Routes endpoints are now documented

https://developers.cloudflare.com/api/resources/ai_gateway/subresources/dynamic_routing/methods/list/

palashgo avatar Jan 27 '26 18:01 palashgo

Moreover, could you consider to support "use authorization header" to use authorization header instead of cf-aig-authorization? (Because some client only support authorization header)

https://developers.cloudflare.com/ai-gateway/configuration/authentication/

@letanloc1998 this is already supported, we'll take the cloudflare api token from cf-aig-authorization header and other vendor auth headers (Authorization, x-goog-api-key) so you can also pass the cloudflare api token in the apikey field in most vendor SDKs, provided the actual vendor api key is stored with BYOK or you are using Unified Billing

palashgo avatar Jan 27 '26 18:01 palashgo