Skip to content

AI Gateway REST: add /ai/v1/models for third-party model discovery #549

Description

@pemontto

The new REST API at api.cloudflare.com/client/v4/accounts/{ACCT}/ai/v1/* has no /models endpoint, so there is no way to programmatically enumerate the third-party models available to an account through Unified Billing.

Current behaviour

curl -X GET "https://api.cloudflare.com/client/v4/accounts/${ACCT}/ai/v1/models" \
  -H "Authorization: Bearer ${CF_API_TOKEN}"
HTTP 405
{"result":null,"success":false,"errors":[{"code":7001,"message":"GET not supported for requested URI."}],"messages":[]}

The existing Workers AI catalogue at /ai/models/search?task=Text%20Generation returns 37 entries, all @cf/*. It does not include third-party Unified Billing models (openai/*, google/*, anthropic/*, openrouter/*, etc.).

Why this matters

  • Admin UIs that let operators pick a model cannot populate the dropdown without hardcoding or trial-and-error inference calls.
  • Capability and pricing discovery requires falling back to external sources like models.dev or each provider's own API.
  • There is no way to detect which third-party providers have Unified Billing enabled on an account without making a probe request per candidate model.
  • OpenAI, OpenRouter, Anthropic, and Google all expose a /models GET on their native APIs. AI Gateway is the unification layer but the catalogue is the missing piece.

Suggested shape

Add GET /ai/v1/models returning the union of:

  • Workers AI models (the existing /ai/models/search set)
  • Third-party models whose providers have Unified Billing enabled on the account

Each entry should carry:

  • id (e.g. openai/gpt-5.4-mini, google/gemini-3-flash, @cf/meta/llama-3.3-70b-instruct-fp8-fast)
  • provider
  • context_window
  • Pricing per million input/output tokens (and cached input where applicable)
  • Capability flags (function_calling, reasoning, vision, audio, streaming)

Mirroring the shape of /ai/models/search would let existing clients reuse parsing logic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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