> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pre.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Models

> Use any model id from the pre.dev catalog and read credit prices from it.

The gateway serves hundreds of models from every major lab. Use the model id exactly as listed by [`GET /v1/models`](/ai-gateway/api/models): if the catalog lists it, `model: "<author>/<slug>"` works here.

| Example id                     | Author    |
| ------------------------------ | --------- |
| `anthropic/claude-sonnet-5`    | Anthropic |
| `deepseek/deepseek-v4.1-flash` | DeepSeek  |
| `google/gemini-3.8-flash`      | Google    |
| `openai/gpt-5.6-luna`          | OpenAI    |

Variant suffixes are accepted: `deepseek/deepseek-v4.1-flash:free`, `anthropic/claude-sonnet-5:nitro`, `google/gemini-3.8-flash:online`, `openai/gpt-5.6-luna:batch`. `:free` variants are rate-limited and may train on prompts; `:nitro` is shorthand for throughput-sorted provider routing and `:online` for the web search plugin. See [routing and fallbacks](/ai-gateway/routing-and-fallbacks).

## List models with prices

```bash theme={null}
curl --fail-with-body https://api.pre.dev/v1/models \
  -H "Authorization: Bearer $PREDEV_API_KEY"
```

Each row describes the model (`id`, `name`, `context_length`, dollar `pricing`, and so on) and carries a `predev` object with its prices in credits:

```json theme={null}
{
  "id": "deepseek/deepseek-v4.1-flash",
  "name": "DeepSeek V4.1 Flash",
  "context_length": 262144,
  "pricing": { "prompt": "0.0000002", "completion": "0.0000008" },
  "predev": {
    "credits_per_m_input": 2.86,
    "credits_per_m_output": 11.43
  }
}
```

| `predev` field              | Present when                      |
| --------------------------- | --------------------------------- |
| `credits_per_m_input`       | Always                            |
| `credits_per_m_output`      | Always                            |
| `credits_per_m_cache_read`  | The model prices cache reads      |
| `credits_per_m_cache_write` | The model prices cache writes     |
| `credits_per_image`         | The model prices image inputs     |
| `credits_per_request`       | The model has a per-request price |

The catalog refreshes every 15 minutes. The `x-predev-catalog-age` response header reports seconds since the last refresh. Catalog reads are free and not rate-limited.

Other catalog endpoints: `/v1/models/count`, `/v1/models/{author}/{slug}/endpoints` for the providers behind one model, `/v1/embeddings/models`, `/v1/images/models`, `/v1/videos/models`, and `/v1/providers`. See the [catalog reference](/ai-gateway/api/models).

## Pick a model in code

Filter the catalog rather than hard-coding assumptions about price or context length:

<CodeGroup>
  ```typescript Node.js theme={null}
  const response = await fetch('https://api.pre.dev/v1/models', {
    headers: { Authorization: `Bearer ${process.env.PREDEV_API_KEY}` },
  });
  const { data } = await response.json();
  const cheapest = data
    .filter((m: any) => m.context_length >= 128000)
    .sort((a: any, b: any) => a.predev.credits_per_m_output - b.predev.credits_per_m_output)[0];
  console.log(cheapest.id, cheapest.predev);
  ```

  ```python Python theme={null}
  import os
  import requests

  rows = requests.get(
      "https://api.pre.dev/v1/models",
      headers={"Authorization": f"Bearer {os.environ['PREDEV_API_KEY']}"},
  ).json()["data"]
  cheapest = min(
      (m for m in rows if m["context_length"] >= 128000),
      key=lambda m: m["predev"]["credits_per_m_output"],
  )
  print(cheapest["id"], cheapest["predev"])
  ```
</CodeGroup>

## Invalid ids

An id the catalog does not recognize returns the provider's error with its original status and message; the gateway does not rewrite it. See [errors](/ai-gateway/api/errors).

Send several ids in `models` to fall back automatically. See [routing and fallbacks](/ai-gateway/routing-and-fallbacks).
