Skip to main content
The pre.dev AI Gateway is an OpenAI-compatible API for hundreds of models from every major lab. Point an OpenAI-compatible client at the AI Gateway base URL, send your pre.dev API key, and call any model in the pre.dev catalog by the id listed in GET /v1/models. Calls are paid with pre.dev credits. Copy your pre.dev API key from Integrations → Built-in in the dashboard: pre.dev/projects/integrations for your personal workspace, or the Integrations page of a team workspace. Workspace keys start with pdk_.

Quickstart

First request with curl, the OpenAI SDK, the Vercel AI SDK, or the Anthropic SDK.

In apps you build

Call models from apps built on pre.dev, with the key already in place.

Pricing

Credits per call, the free allowance, and what happens when credits run out.

Models

Browse the catalog with credit prices attached.

How a call is handled

How the AI Gateway handles a call: it authenticates your pre.dev key, admits the call only with enough credits and under the rate limit, routes it to the model you named or your fallback list, and charges credits when the response finishes. How the AI Gateway handles a call: it authenticates your pre.dev key, admits the call only with enough credits and under the rate limit, routes it to the model you named or your fallback list, and charges credits when the response finishes.
  1. Authenticate. Your pre.dev key, sent as Authorization: Bearer or x-api-key, identifies the workspace. A missing or invalid key returns 401.
  2. Admit. The call needs enough credits and must stay under the workspace rate limit. Otherwise it returns 402 or 429, and no model runs.
  3. Route. The model you named answers, or the models in your models list, tried in order. You choose the model; pre.dev chooses how to serve it.
  4. Charge. Credits for the call’s metered usage are charged once the response or stream finishes. See response headers for how the charge is reported.

What you send

Model ids are <author>/<slug> strings exactly as listed by GET /v1/models, for example anthropic/claude-sonnet-5, deepseek/deepseek-v4.1-flash, google/gemini-3.8-flash, or openai/gpt-6-luna. There are no separate pre.dev-specific model names. The standard chat completion fields (messages, temperature, max_tokens, stop, and so on) work as you would expect. The pre.dev AI API also supports these options, described on fallbacks and advanced options:

What you get back

Responses use the standard OpenAI-compatible shapes, and the Anthropic Messages shape on /v1/messages. Model responses carry a pre.dev generation id (pdg-…) and token counts in usage. Streaming chat completions end with a chunk that carries usage.

Endpoints

Any other /v1 path returns 404.

Response headers

Every inference call returns x-predev-request-id (pdr_…). Completed non-streaming calls also return x-predev-credits-charged and x-predev-credits-remaining (omitted when the workspace has no credit limit). Streamed calls carry only the request id; read their charge from GET /v1/usage or GET /v1/generation. Send x-predev-project-id to attribute usage to one of your projects.

Billing

Each call is charged in credits from the model’s metered usage for that call. The credit price per model is listed on GET /v1/models under predev.credits_per_m_input and predev.credits_per_m_output. Catalog reads are free. Details and the free allowance are on pricing.