Skip to content

AI Gateway custom providers appear to prepend /v1 to provider-specific endpoint paths #476

@matijagrcic

Description

@matijagrcic

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

  1. Create a custom provider with:
    • slug: exa-provider
    • base_url: https://api.exa.ai
  2. Create a provider config / BYOK alias for that provider.
  3. 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}'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions