> ## 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.

> ## Agent Instructions
> Agents: start with https://docs.pre.dev/agents.md, which has complete recipes, plan access, polling rules, errors and limits.
> Authenticate with the workspace API key (pdk_…) from Integrations → Built-in, sent as Authorization: Bearer <key>.
> REST API: https://api.pre.dev (OpenAPI: https://docs.pre.dev/api-reference/openapi.json). AI Gateway: https://api.pre.dev/v1, OpenAI-compatible (OpenAPI: https://docs.pre.dev/api-reference/ai-gateway.openapi.json).
> pre.dev MCP server: https://api.pre.dev/mcp. Search these docs over MCP at https://docs.pre.dev/mcp.

# 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 ids: `anthropic/claude-sonnet-5`, `deepseek/deepseek-v4.1-flash`, `google/gemini-3.8-flash`, and `openai/gpt-6-luna`.

Some models also have variant ids in the catalog, such as a `:free` or `:batch` suffix; use them exactly as listed. Append `:online` to a model id to add web search, the same as the `web` plugin. See [fallbacks and advanced options](/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`, supported modalities and parameters, and so on) and carries a `predev` object with its prices in credits:

```json theme={null}
{
  "id": "deepseek/deepseek-v4.1-flash",
  "name": "DeepSeek: DeepSeek V4.1 Flash",
  "context_length": 1048576,
  "predev": {
    "credits_per_m_input": 2.5,
    "credits_per_m_output": 10
  }
}
```

The numbers above are illustrative; read the live row for current prices. The [catalog reference](/ai-gateway/api/models#the-predev-object) lists every `predev` field.

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/embeddings/models`, `/v1/images/models`, and `/v1/videos/models`. 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 serve returns a `4xx` error in the OpenAI error shape. The message keeps what the model service said about the request; check the id against [`GET /v1/models`](/ai-gateway/api/models). See [errors](/api-reference/errors#ai-gateway-errors).

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


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.