# Models API

> GET /api/v1/models lists every model, with pricing, context windows, capabilities, how to access each one and whether you can route it now.


# Models API

Read the model catalog over REST. Each model has a `provider/model` slug, the same value as the chat completions `model` field. Use `GET /api/v1/models` (or `https://api.anyrouter.dev/api/v1/models`) for JSON; other `/models` URLs on some hosts serve HTML.

::endpoint{method="GET" path="/api/v1/models"}
::endpoint{method="GET" path="/api/v1/models/{owner}/{model}"}
::endpoint{method="GET" path="/api/v1/models/{owner}/{model}/routing-preview"}
::endpoint{method="GET" path="/api/v1/models/count"}
::endpoint{method="GET" path="/api/v1/providers"}

:::note
The list works anonymously. Send an **LLM API key** (`sk-ar-v1-…`) from [/dashboard/keys](https://anyrouter.dev/dashboard/keys) to also receive your saved presets.
:::

## Request

### List models

Returns every listed model to every caller, signed in or not. Access is a label, never a filter: each model says how it is reached (`access`) and whether this caller can route it now (`can_route`). Only your own choices remove a model: the key's allow/deny lists and your privacy blocks. Models the catalog hides or disables are not listed. The old `all=1` and `include=unavailable` params from earlier clients are ignored: the list always has every model.

| Param | Type | Description |
|---|---|---|
| `provider` | string | Filter by provider id (`openai`, `anthropic`, `google`, …). |
| `category` | string | `text` / `image` / `audio` / `embedding`. |
| `min_context` | integer | Minimum context window in tokens. |
| `capability` | string | Repeatable. E.g. `?capability=vision&capability=function_calling`. |
| `supported` | string | Legacy comma-separated capability filter kept for compatibility. |
| `free` | `true` / `false` | Keep models with a platform route at an explicit $0 (`true`) or those without one (`false`). |
| `zdr` | `true` / `false` | Keep models with a public upstream that declares zero data retention (`true`), or those without one (`false`). |
| `byok` | `true` / `false` | Keep models with at least one BYOK route (`true`), or those without one (`false`). |
| `pool` | `true` / `false` | Keep models a donated BYOK key in the Pool can serve (`true`), or those Pool cannot serve (`false`). |
| `price_min` | number | Minimum catalog headline input price, $ per 1M tokens (inclusive). |
| `price_max` | number | Maximum catalog headline input price, $ per 1M tokens (inclusive). `0` keeps only headline-$0 rows. Unit-billed rows are excluded when a price bound is set. |
| `privacy` | `0` / `false` | Skip the authenticated caller's `blocked_providers` filter. Route health and BYOK only change `can_route`, never the list. |
| `presets` | `0` | Omit your saved presets from an authenticated response (included by default when authenticated). |
| `sort` | string | `added` (aliases `newest`, `new`, `created`; newest first), `usage` (aliases `top`, `top-usage`, `popular`; 7-day request volume), or `name` (alias `id`). |

Invalid filter values (e.g. `zdr=banana` or a non-numeric `price_max`) are ignored, not errors.

### Get one model

`GET /api/v1/models/{owner}/{model}` takes the slug as two path segments, for example `/api/v1/models/anthropic/claude-sonnet-4-6`. Nested routes (`/routing-preview`, `/metrics`, `/privacy`, `/uptime`) accept the slash form too; the encoded form (`anthropic%2Fclaude-sonnet-4-6`) also works.

Platform presets (`anyrouter/auto`, `anyrouter/free`, other first-party `anyrouter/*` ids) expose their live failover chain at `GET /api/v1/models/anyrouter/auto/routing-preview`, without auth, in the order inference tries it.

### Count

`GET /api/v1/models/count` returns `{ "count": N }`, the number of rows the list returns for the same query. It takes the same filters (`provider`, `category`, ...). Saved presets are not counted.

## Response

```json
{
  "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.

`pricing.input_cache_read_per_1m` is the cache-read rate per 1M tokens; omitted when the provider publishes none.

### Who pays: `pricing.billing`

`pricing.billing` says how a request is paid for:

- `"credits"`: a paid AnyRouter route serves the model and your credits pay for it.
- `"free"`: a public $0 route serves it on the free tier.
- `"byok"`: every route needs your own provider key. AnyRouter charges $0 and your provider bills you.

The default list can include `"byok"` models, so read the field. For them, `pricing.list_pricing` (`input_per_1m`, `output_per_1m`) holds the provider's published rate when known. A `per_upstream` entry priced at 0 only because it is BYOK carries `billing: "byok"` (plus `list_pricing` when published). Read `0` there as "billed by your provider", not free.

### Access and routing: `access`, `can_route`

Every model carries three fields about how you can use it:

| Field | Values | Meaning |
|---|---|---|
| `access` | `free`, `paid`, `byok`, `pool` | How the model is reached. Same for every caller. `free`: a free-tier route. `paid`: a credit-billed route. `byok`: a route that takes your own provider key. `pool`: a BYOK route the donated-key pool can serve. These are the names in the **Access** column on [/models](https://anyrouter.dev/models). |
| `can_route` | `true` / `false` | Whether this caller can call the model right now. |
| `can_route_reason` | `needs_key`, `disabled`, `no_route` | Present only when `can_route` is `false`. `needs_key`: every route needs your own provider key and you have none for it. `disabled`: health checks switched it off for now. `no_route`: no route can serve it right now. |

A model you cannot call is still in the list. Filter on `can_route` to show only models that work today:

```json
{
  "id": "openai/gpt-6-cyber",
  "object": "model",
  "access": ["byok"],
  "can_route": false,
  "can_route_reason": "needs_key"
}
```

The same model for a caller with an OpenAI key saved in BYOK settings:

```json
{
  "id": "openai/gpt-6-cyber",
  "object": "model",
  "access": ["byok"],
  "can_route": true
}
```

### Reasoning and output limits

- `reasoning.levels` and `reasoning.default` are the model's effort enum when it declares one; omitted otherwise, so do not invent levels.
- `per_upstream[].reasoning` is a route-specific effort override; if omitted, the route inherits the model-level enum. `per_upstream[].features.reasoning` is a capability flag, not an effort list.
- `supported_parameters` is authoritative. For a selected route use `per_upstream[].supported_parameters`; the top-level field is a model-level projection, not a promise for every fallback route. Advertising reasoning does not add a reasoning parameter.
- `top_provider.max_completion_tokens` is the strictest completion cap declared by any serving upstream, or `null` when none declares one (not a promise of unlimited). Per-route caps are at `per_upstream[].context.max_completion_tokens`.
- AnyRouter does not infer toggle, token-budget or interleaved-thinking support from a model name. Toggle and budget controls are 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 capability flag; support depends on the provider.

### Your presets in the response

When the request is authenticated, the response also includes a `presets` array of your saved [presets](/api-reference/presets) alongside `data`:

```json
{
  "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"
    }
  ]
}
```

Omitted for unauthenticated requests; pass `?presets=0` to skip it when authenticated. Use a preset in any inference call as `@preset/<slug>`.

### List providers

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

```json
{
  "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

::::tabs

:::tab{label="curl"}
```bash
# Every model, anonymous. Use the api. host if apex returns HTML.
curl https://api.anyrouter.dev/api/v1/models

# The same list, labelled for this LLM API key (can_route, plus your presets)
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"

# Models with a public ZDR upstream
curl "https://anyrouter.dev/api/v1/models?zdr=true" \
  -H "Authorization: Bearer sk-ar-your-key"

# Free-tier platform routes only
curl "https://anyrouter.dev/api/v1/models?free=true" \
  -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
```
:::

:::tab{label="Python"}
```python
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"])
```
:::

:::tab{label="TypeScript"}
```typescript
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

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

See [Errors](/guides/errors) for the full status table.


## Related

- [Providers API](/docs/api-reference/providers.md)
- [Chat Completions API](/docs/api-reference/chat-completions.md)
