When using an AI Gateway custom provider via the provider-specific endpoint, Gateway appears to prepend /v1 to the upstream path even when the custom provider base_url is configured without /v1.
Per the docs, this route:
https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/custom-{slug}/{provider-path}
should map to:
{base_url}/{provider-path}
Docs reference:
Custom Providers -> Via provider-specific endpoint
In my case, the custom provider is configured as:
slug: exa-provider
base_url: https://api.exa.ai
So this Gateway request:
POST .../custom-exa-provider/search
should go upstream to:
POST https://api.exa.ai/search
But the actual upstream behavior looks like:
POST https://api.exa.ai/v1/search
Steps to reproduce
- Create a custom provider with:
slug: exa-provider
base_url: https://api.exa.ai
- Create a provider config / BYOK alias for that provider.
- Send this request through AI Gateway:
curl -sS -i -X POST \
"https://gateway.ai.cloudflare.com/v1/${ACCOUNT_ID}/${GATEWAY_ID}/custom-exa-provider/search" \
-H "cf-aig-authorization: Bearer ${AI_GATEWAY_TOKEN}" \
-H "cf-aig-byok-alias: ${BYOK_ALIAS}" \
-H "Content-Type: application/json" \
-d '{"query":"Satya Nadella","category":"people","numResults":2}'
When using an AI Gateway custom provider via the provider-specific endpoint, Gateway appears to prepend
/v1to the upstream path even when the custom providerbase_urlis configured without/v1.Per the docs, this route:
https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/custom-{slug}/{provider-path}should map to:
{base_url}/{provider-path}Docs reference:
Custom Providers -> Via provider-specific endpoint
In my case, the custom provider is configured as:
slug:exa-providerbase_url:https://api.exa.aiSo this Gateway request:
POST .../custom-exa-provider/searchshould go upstream to:
POST https://api.exa.ai/searchBut the actual upstream behavior looks like:
POST https://api.exa.ai/v1/searchSteps to reproduce
slug:exa-providerbase_url:https://api.exa.ai