Skip to content

Models API

GET /api/v1/models — list models you can call, plus pricing, context windows, capabilities, and live provider routing. Pass all=1 for the full catalog.

AnyRouter exposes the model catalog via REST. Every model is uniquely identified by a provider/model slug — the same format used in the chat completions model field.

The JSON list is GET /api/v1/models (or https://api.anyrouter.dev/api/v1/models). Use that path when you need JSON — some hosts serve HTML on other /models URLs.

GET/api/v1/models
GET/api/v1/models/{owner}/{model}
GET/api/v1/models/{owner}/{model}/routing-preview
GET/api/v1/models/count
GET/api/v1/providers

The list endpoint works anonymously, but authenticate with an LLM API key (sk-ar-v1-…) from /dashboard/keys to also receive your saved presets in the response.

Request

List models

Returns models the current caller can reach — platform routes, matching BYOK keys, and (when you send an LLM API key) that key's allow/deny lists. Anonymous requests omit BYOK-only rows such as Anthropic Sonnet. Pass all=1 or include=unavailable for the full catalog, including models you cannot call yet.

Accepts these query parameters:

ParamTypeDescription
all1 / true / yesInclude models the current caller cannot reach.
includeunavailable / allSame as all=1.
providerstringFilter by provider id (openai, anthropic, google, …).
categorystringtext / image / audio / embedding.
min_contextintegerMinimum context window in tokens.
capabilitystringRepeatable. E.g. ?capability=vision&capability=function_calling.
supportedstringLegacy comma-separated capability filter kept for compatibility.
privacy0 / falseSkip the authenticated caller's blocked_providers filter. Route health and BYOK still apply unless all=1.
presets0Omit your saved presets from an authenticated response (included by default when authenticated).
sortstringadded (aliases newest, new, created; newest first), usage (aliases top, top-usage, popular; 7-day request volume), or name (alias id).

Get one model

GET /api/v1/models/{owner}/{model} — use the catalog slug as two path segments. For anthropic/claude-sonnet-4.6, request /api/v1/models/anthropic/claude-sonnet-4.6. Nested routes on the same id (/routing-preview, /metrics, /privacy, /uptime) accept that slash form too. The single-segment encoded form (anthropic%2Fclaude-sonnet-4.6) still works.

Platform auto-routing presets (anyrouter/auto, anyrouter/free, and the other first-party anyrouter/* ids) expose their live failover chain at GET /api/v1/models/anyrouter/auto/routing-preview (no auth for platform presets). The unique member list is the same order inference will try.

Count

GET /api/v1/models/count returns a lightweight JSON object with the current model count — useful for health checks and cache warming.

Response

{
  "object": "list",
  "data": [
    {
      "id": "openai/gpt-5.4-mini",
      "object": "model",
      "provider": "OpenAI",
      "providers": ["OpenAI", "Groq"],
      "category": "text",
      "context_length": 128000,
      "pricing": {
        "prompt": "10",
        "completion": "30",
        "input_per_1m": 10,
        "output_per_1m": 30
      },
      "capabilities": ["chat", "function-calling", "vision"],
      "links": {
        "details": "/api/v1/models/openai/gpt-4-turbo",
        "metrics": "/api/v1/models/openai%2Fgpt-4-turbo/metrics"
      }
    }
  ]
}

provider is the organization that owns the model. providers lists the public upstream providers that can serve it.

Reasoning and output limits

The model response exposes only facts present in the catalog:

  • reasoning.levels and reasoning.default are the exact model-level effort enum when the model declares one. The field is omitted when no enum is declared; clients must not invent a level list.
  • per_upstream[].reasoning is a route-specific effort override. If it is omitted, the route inherits the model-level enum. per_upstream[].features.reasoning is a capability flag, not an effort list.
  • supported_parameters remains authoritative. For a selected route, use per_upstream[].supported_parameters; the top-level field is a model-level/legacy projection and is not a promise shared by every fallback route. The API does not add a reasoning parameter because a model advertises reasoning.
  • top_provider.max_completion_tokens is the strictest completion cap declared by any serving upstream, or null when no upstream declares one. It is not a promise that an undeclared route is unlimited. Per-route caps are available at per_upstream[].context.max_completion_tokens.
  • AnyRouter does not infer universal toggle, token-budget, or interleaved-thinking support from a model name or description. Toggle and budget controls remain endpoint-specific (reasoning.enabled / reasoning.max_tokens on Responses, thinking on Messages). Anthropic interleaved thinking is a provider beta request (anthropic-beta: interleaved-thinking-2025-05-14), not a model or preset capability flag; whether the selected provider honors it is provider-specific.

Your presets in the response

When the request is authenticated, the response also includes a presets array of your account's saved presets alongside data. This lets a model picker show your presets next to raw models in a single call:

{
  "object": "list",
  "data": [ /* … models … */ ],
  "presets": [
    {
      "id": "preset_abc123",
      "object": "preset",
      "slug": "code-reviewer",
      "name": "Code Reviewer",
      "description": "Strict senior-engineer review.",
      "config": { "model": "anthropic/claude-sonnet-4.6", "temperature": 0.2 },
      "created_at": "2026-03-01T12:00:00Z",
      "updated_at": "2026-03-01T12:00:00Z"
    }
  ]
}

The field is omitted entirely for unauthenticated requests. Pass ?presets=0 to skip it on an authenticated request. Reference a preset in any inference call with the @preset/<slug> model syntax.

List providers

GET /api/v1/providers lists the upstream backends AnyRouter dispatches to:

{
  "object": "list",
  "data": [
    {
      "id": "openai",
      "name": "OpenAI",
      "description": "GPT models",
      "website": "https://openai.com",
      "status": "operational",
      "model_count": 4,
      "regions": ["us", "eu"],
      "model_prefix": "openai/",
      "endpoints": ["/api/v1/chat/completions", "/api/v1/responses", "/api/v1/models"]
    }
  ]
}

Examples

# Models you can call without a key (anonymous). Use the api. host if apex returns HTML.
curl https://api.anyrouter.dev/api/v1/models

# Full catalog, including BYOK-only rows
curl "https://api.anyrouter.dev/api/v1/models?all=1"

# Models reachable with this LLM API key
curl https://anyrouter.dev/api/v1/models \
  -H "Authorization: Bearer sk-ar-your-key"

# Filter + newest first
curl "https://anyrouter.dev/api/v1/models?provider=anthropic&min_context=200000&sort=added" \
  -H "Authorization: Bearer sk-ar-your-key"

# Top usage this week
curl "https://anyrouter.dev/api/v1/models?sort=usage"

# One model (slash path)
curl https://anyrouter.dev/api/v1/models/anthropic/claude-sonnet-4.6 \
  -H "Authorization: Bearer sk-ar-your-key"

# Live failover chain for a platform preset (slash path; %2F also works)
curl https://anyrouter.dev/api/v1/models/anyrouter/auto/routing-preview

# List providers (no auth required)
curl https://anyrouter.dev/api/v1/providers
import requests

resp = requests.get(
    "https://anyrouter.dev/api/v1/models",
    params={"provider": "anthropic", "min_context": 200000},
    headers={"Authorization": "Bearer sk-ar-your-key"},
)
for model in resp.json()["data"]:
    print(model["id"], model["context_length"])
const res = await fetch(
  "https://anyrouter.dev/api/v1/models?provider=anthropic&min_context=200000",
  { headers: { Authorization: "Bearer sk-ar-your-key" } },
)
const { data } = await res.json()
data.forEach((m: { id: string; context_length: number }) =>
  console.log(m.id, m.context_length),
)

Errors

StatusMeaningFix
401Invalid API key on an authenticated request.Send a valid sk-ar-… key, or drop the header to list anonymously.
404Unknown model id.Use /api/v1/models/{owner}/{model} and confirm the slug appears in the list response.

See Errors for the full status table.

Related