> For the list of every page, fetch /llms.txt. The API contract is the OpenAPI file linked from the API reference.

# Models

Meadow serves four model formats. Each one takes a provider's own request format and returns that provider's own response. You send your Meadow API key, and Meadow uses the provider key you stored.

Next step: store a provider key ([Provider keys](/set-up-your-account/provider-keys)), then run the first call below.

```bash
curl -sS "$MEADOW_BASE_URL/v1/chat/completions" \
  -H "Authorization: Bearer $MEADOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.1-flash-lite-preview",
    "messages": [{"role": "user", "content": "Say hello in five words."}],
    "max_tokens": 32
  }'
```

```json
{"choices":[{"finish_reason":"stop","index":0,"message":{"content":"Hello, it is nice meeting.","extra_content":{"google":{"thought_signature":"EqkBCqYB..."}},"role":"assistant"}}],"created":1795472115,"id":"8roEa7-Y...","model":"gemini-3.1-flash-lite-preview","object":"chat.completion","usage":{"completion_tokens":7,"prompt_tokens":7,"total_tokens":14}}
```

That body is Google's answer, byte for byte. Meadow adds three response headers:

```text
x-meadow-provider: google
x-meadow-model: gemini-3.1-flash-lite-preview
x-meadow-attempts: 1
```

## The formats

| Endpoint | Format | Use it when |
| --- | --- | --- |
| `POST /v1/chat/completions` | OpenAI Chat Completions | Your code uses the OpenAI SDK's `chat.completions`, or you want the format most providers accept. |
| `POST /v1/responses` | OpenAI Responses | Your code uses the OpenAI SDK's `responses`, or a tool that speaks only Responses, such as the Codex CLI. |
| `POST /v1/messages` | Anthropic Messages | Your code uses the Anthropic SDK or Claude Code. |
| `POST /v1beta/models/{model}:generateContent` and `:streamGenerateContent` | Google Gemini `generateContent` | Your code uses gemini-cli or a Google GenAI SDK. See [Gemini clients](/call-models/gemini-clients). Not on the hosted beta yet. |

Meadow does not convert between formats. A request goes only to providers that accept the format you sent. This table shows which provider accepts which format:

| Provider | Chat Completions | Responses | Messages | Gemini `generateContent` |
| --- | --- | --- | --- | --- |
| `anthropic` | no | no | yes | no |
| `openai` | yes | yes | no | no |
| `google` | yes | no | no | yes |
| `xai` | yes | yes | yes | no |
| `openrouter` | yes | yes | yes | no |
| `azure` | yes | yes | yes | no |
| `bedrock` | yes (a pinned ID, not Claude) | yes (a pinned ID, models AWS lists for it) | yes (Claude) | no |
| `vertex` | yes (Gemini) | no | yes (Claude) | yes (Gemini) |
| `fireworks` | yes | yes | yes | no |
| `deepseek` | yes | yes | yes | no |

Bedrock serves Chat Completions and Responses on its OpenAI-compatible route for the models it hosts other than Claude, such as `bedrock/openai.gpt-oss-120b-1:0`. None of them is in `GET /v1/models`, so pin the ID. Meadow holds no price for them. So a Claude model on `/v1/chat/completions` can only be served by OpenRouter, and a Gemini model on `/v1/messages` can only be served by OpenRouter. When no provider accepts the format for the model, you get a 400. A pinned ID counts only the pinned provider:

```bash
curl -sS "$MEADOW_BASE_URL/v1/chat/completions" \
  -H "Authorization: Bearer $MEADOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "anthropic/claude-haiku-5-5", "messages": [{"role": "user", "content": "hi"}], "max_tokens": 32}'
```

```json
{"error":{"message":"no provider accepts this format for the requested model","type":"invalid_request_error","param":null,"code":"invalid_request"},"request_id":"req_0000aa38"}
```

What was run on the hosted beta for this page: Google (Chat Completions), xAI (all three formats), Anthropic (Messages), and OpenRouter (all three formats), each blocking and streamed. OpenAI direct, Azure, and Bedrock have not served a call through the beta. Fireworks and DeepSeek have served no real call at all: Meadow follows their published documents. Claude on Vertex was served on a test server with an operator's Google token, not with a stored service account key. See [Known limits](/reference/known-limits#calling-models).

### Responses

```bash
curl -sS "$MEADOW_BASE_URL/v1/responses" \
  -H "Authorization: Bearer $MEADOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "grok-4.7", "input": "Say hello in five words.", "max_output_tokens": 64}'
```

```json
{"created_at":1795472127,"completed_at":1795472128,"id":"68a782f0-...","max_output_tokens":64,"model":"grok-4.7","object":"response","output":[{"id":"rs_0000c06b-...","summary":[{"text":"The user wants a greeting in five words.","type":"summary_text"}],"type":"reasoning","status":"completed","encrypted_content":"D9Goh..."},{"content":[{"type":"output_text","text":"Hello there, hope you're well.","logprobs":[],"annotations":[]}],"id":"msg_0000c06b-...","role":"assistant","type":"message","status":"completed"}],"usage":{"input_tokens":1248,"output_tokens":73,"total_tokens":1321}}
```

The output is trimmed. Meadow keeps no response state. A request with `previous_response_id` must pin one provider (see [Pin a provider](#pin-a-provider)), or it gets a 400 `previous_response_id requires pinning a single provider`.

### Messages

`max_tokens` is required, as it is at Anthropic. `x-api-key` works in place of `Authorization`, so Anthropic clients need no change.

```bash
curl -sS "$MEADOW_BASE_URL/v1/messages" \
  -H "x-api-key: $MEADOW_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-haiku-5-5",
    "max_tokens": 64,
    "messages": [{"role": "user", "content": "Say hello in five words."}]
  }'
```

```json
{"model":"claude-haiku-5-5","id":"msg_00007279...","type":"message","role":"assistant","content":[{"type":"text","text":"Hello there, my friend!"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":16,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":11,"service_tier":"standard"}}
```

The output is trimmed. `POST /v1/messages/count_tokens` does not exist and returns 404.

## Model IDs

A model ID comes in two forms.

| Form | Example | What Meadow does |
| --- | --- | --- |
| Plain | `claude-haiku-5-5` | Picks the provider. The ID is one Meadow lists, a provider alias for one, or an ID of a family whose own provider you have a key for. |
| Pinned | `anthropic/claude-haiku-5-5` | Sends the call to that provider only, with the part after the first slash as the model ID, as written. |

Names written for other routers work as pinned IDs. Read from the server's code and its tests, and not yet run on the hosted beta:

| You send | Meadow reads it as | Where the spelling comes from |
| --- | --- | --- |
| `anthropic/claude-haiku-4.5` | `anthropic/claude-haiku-4-5-20251001` | OpenRouter and Vercel AI Gateway IDs (`author/slug`, with a dot) |
| `x-ai/grok-4.7` | `xai/grok-4.7` | OpenRouter's author name for xAI |
| `gemini/gemini-3.8-flash` | `google/gemini-3.8-flash` | LiteLLM's prefix for Google AI Studio |
| `vertex_ai/gemini-3.8-flash` | `vertex/google/gemini-3.8-flash` | LiteLLM's prefix for Vertex |
| `bedrock/claude-haiku-5-5` | `bedrock/global.anthropic.claude-haiku-5-5`, or the `us.` or `eu.` ID when the Bedrock provider key sets `inference_profile` | A listed ID behind a prefix becomes that provider's ID for it |

The rule: after a prefix, an ID from `GET /v1/models`, or the OpenRouter name of a model behind its own provider, becomes the ID that provider uses, shown as `provider_model_id` in the list. The provider stays pinned, so there is no fallback to another provider. Text Meadow does not recognise is sent as written, as before. A key's `allowed_models` is checked against the provider and ID the name resolves to, so a second spelling never reaches a model the key does not allow.

Meadow has no `auto` model that picks a model for you. With an OpenRouter key you can pin OpenRouter's own router as `openrouter/openrouter/auto`. Not run on the hosted beta.

Either form may start with `meadow/`. Meadow drops that prefix and reads the rest as written, so `meadow/claude-haiku-5-5` is the plain ID and `meadow/anthropic/claude-haiku-5-5` is the pinned one. Use it with a tool that wants a `<provider>/<model>` name. The prefix also works in `models`, in a key's `allowed_models` and in a project's `routing.models.per_model`. Usage records keep `requested_model` as you sent it, and `provider` and `model` name the provider and the ID that served the call. Read from the server's code and its tests. Not yet run on the hosted beta.

Plain IDs come from a fixed list inside Meadow (`GET /v1/models`). A plain ID that is not on it resolves in this order. Each step was run on the hosted beta.

1. A provider's documented alias routes like the model it names. `claude-haiku-4-5` is Anthropic's alias for `claude-haiku-4-5-20251001`, so it can be served by any provider that serves that model.
2. An ID that starts with `claude-`, `gpt-` (also `chatgpt-`, `o1`, `o3`, `o4`), `gemini-` or `grok-` goes to that family's own provider (`anthropic`, `openai`, `google`, `xai`) exactly as written, when you have a provider key for it. No other provider is tried for such an ID. If the provider does not know the ID you get the provider's own 404.
3. Anything else gets a 404 with `error.code` `model_not_found`, as OpenAI and Anthropic answer a model they do not serve, so their SDKs raise `NotFoundError`. The message names the ID and shows how to pin it. Seen on the hosted beta on 2026-11-28, on `POST /v1/chat/completions`:

```json
{"error":{"message":"unknown model \"llama-typo-9\": it is not in GET /v1/models. Pin the provider that serves it by writing the model as \"<provider>/<that provider's model id>\", for example \"openrouter/<the id OpenRouter lists>\". An unlisted claude-, gpt-, gemini- or grok- id is passed through without a pin only when the project has a provider key for its own vendor (anthropic, openai, google, xai).","type":"invalid_request_error","param":"model","code":"model_not_found"},"request_id":"req_0000b95b"}
```

When the ID is close to IDs your key can call in that format, the message names up to three of them after the first sentence, nearest first: `Close matches: "claude-haiku-4-5-20251001", "claude-haiku-5-5".` The list never holds a model outside the key's `allowed_models`, one that no stored provider key serves, or one a locked project excludes. Read from the server's code and its tests. Not yet run on the hosted beta.

On `POST /v1/messages` the same 404 comes in Anthropic's envelope, with `"type":"not_found_error"`, `error.details.error_code` `model_not_found` and `param` `model` (seen on the hosted beta on 2026-11-28). Before 2026-11-28 both routes answered 400 with `parameter_invalid`.

That account had no OpenAI key. `\u003c` and `\u003e` are the JSON escapes for `<` and `>`: a JSON parser returns `<provider>/<that provider's model id>`. On the same account, which had an Anthropic key, `claude-typo-9` went to Anthropic and came back as Anthropic's own 404: `{"type":"error","error":{"type":"not_found_error","message":"model: claude-typo-9"},...}`.

Do: pin the provider when you want a model through a provider other than its own, for example `openrouter/anthropic/claude-opus-4.5` or `bedrock/<profile id>`. Meadow passes a pinned ID through without checking it.

On a key with `allowed_models`, an unlisted ID is served only when the list names that plain ID or pins it to the same provider. OpenRouter differs here: its IDs are always `author/slug`, it resolves aliases to a canonical slug, and its model lookup returns 404 for an ID that is neither.

The prefix must be one of `anthropic`, `openai`, `google`, `xai`, `openrouter`, `azure`, `bedrock`, `vertex`, `fireworks`, or `deepseek`, or one of the three other spellings `gemini`, `vertex_ai` and `x-ai`. Anything else gets a 400 `unknown model provider prefix`. An OpenRouter ID keeps its own slash: `openrouter/z-ai/glm-5.3`. A Fireworks ID keeps its slashes too: `fireworks/accounts/fireworks/models/kimi-k3`.

Fireworks and DeepSeek serve only pinned IDs. None of their models is in `GET /v1/models`, and an unlisted plain ID such as `deepseek-flash` gets the 404 above. Write `deepseek/deepseek-flash` or `fireworks/accounts/fireworks/models/<model>`, with the ID from the provider's own model page.

### List the models your key can reach

```bash
curl -sS "$MEADOW_BASE_URL/v1/models" -H "Authorization: Bearer $MEADOW_API_KEY"
```

```json
{"data":[
  {"created":0,"id":"claude-haiku-5-5","object":"model","owned_by":"anthropic","providers":[
    {"formats":["messages"],"provider":"anthropic","provider_model_id":"claude-haiku-5-5"},
    {"formats":["chat_completions","responses","messages"],"provider":"openrouter","provider_model_id":"anthropic/claude-haiku-5.5"}]},
  {"created":0,"id":"gemini-3.1-flash-lite-preview","object":"model","owned_by":"google","providers":[
    {"formats":["chat_completions","generate_content"],"provider":"google","provider_model_id":"gemini-3.1-flash-lite-preview"},
    {"formats":["chat_completions","responses","messages"],"provider":"openrouter","provider_model_id":"google/gemini-3.1-flash-lite-preview"}]}
],"has_more":false,"object":"list"}
```

The output is trimmed to two of 39 models. Each entry lists the providers that can serve the model with the provider keys you stored, in the order Meadow tries them by default, and the formats each accepts.

With the `mdw` CLI. `mdw` is sent to you during the beta. See [Clients](/run-sandboxes/clients#install).

```bash
mdw models list
```

```text
MODEL                          PROVIDER    PROVIDER MODEL                        FORMATS
claude-fable-5-2               anthropic   claude-fable-5-2                      messages
claude-fable-5-2               openrouter  anthropic/claude-fable-5.2            chat_completions,responses,messages
claude-haiku-4-5-20251001      anthropic   claude-haiku-4-5-20251001             messages
```

Three things to know about the list:

- It shows only models you have a usable provider key for. With no provider keys it is empty.
- A key with `allowed_models` sees only those models. A locked project hides providers its routing excludes.
- It does not ask the provider. A listed model can still fail when your provider account does not allow it. In our test account, OpenRouter rejected most listed models with a 404 because of a setting on that OpenRouter account.

The list has OpenAI's shape: `object` is `list`, and each entry has `object`, `created` (always 0) and `owned_by`, next to Meadow's own `providers`. The OpenAI SDK's `client.models.list()` reads it. `GET /v1/models/{id}` does not exist and returns 404.

<a id="pin-a-vendor"></a>

## Pin a provider

Two ways, with the same effect:

```bash
curl -sS -D - -o /dev/null "$MEADOW_BASE_URL/v1/chat/completions" \
  -H "Authorization: Bearer $MEADOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "google/gemini-3.1-flash-lite-preview", "messages": [{"role": "user", "content": "Say hello in five words."}], "max_tokens": 32}' \
  | grep -i x-meadow
```

```text
x-meadow-attempts: 1
x-meadow-model: gemini-3.1-flash-lite-preview
x-meadow-provider: google
```

Or keep the plain ID and send `"provider": {"only": ["google"]}`. [Routing and fallbacks](/call-models/routing-and-fallbacks) covers `provider` in full.

A pinned call has no other provider to fall back to. If you pin a provider you have no provider key for, you get a 422:

```json
{"error":{"message":"no stored provider key can serve this request","type":"invalid_request_error","param":null,"code":"no_provider_key"},"request_id":"req_00002ee3"}
```

## What passes through unchanged

Meadow reads four fields of the request body: `model`, `models`, `provider`, and `stream`. Before it forwards the request it removes `models` and `provider` and replaces `model` with the provider's own ID. Every other field goes to the provider with its value untouched, including fields Meadow has never heard of. The order of top-level fields can change.

| Part | What happens |
| --- | --- |
| Request body | Forwarded as described above. Message content is never changed. |
| `anthropic-version`, `anthropic-beta` headers | Forwarded. A Messages call without `anthropic-version` gets `2023-06-01`. |
| Other request headers | Not forwarded. This includes `OpenAI-Organization`, `OpenAI-Beta`, and OpenRouter's `HTTP-Referer` and `X-Title`. |
| Query string | Forwarded to Anthropic, OpenAI, xAI, OpenRouter, and Azure. Dropped for Google, Bedrock, Vertex, Fireworks, and DeepSeek. |
| Response body | Returned as the provider wrote it. Streams are relayed as they arrive. |
| Response headers | Only the provider's `retry-after`, `retry-after-ms`, `x-ratelimit-*`, and `anthropic-ratelimit-*`, and on a served call the tier header of the provider that served it (`x-gemini-service-tier` from Google, `x-amzn-bedrock-service-tier` from Bedrock), are returned as sent. The provider's request ID is returned under another name, `x-meadow-provider-request-id`, so that it cannot replace Meadow's `x-request-id`. |

Four exceptions to "untouched":

- Meadow owns the names `provider` and `models`. OpenRouter has its own request fields with those names, and you cannot send them through Meadow. A field Meadow does not know inside `provider` gets a 400 `unknown field in provider routing`.
- Meadow sets `stream_options.include_usage` to `true` on every streamed Chat Completions call and removes the usage-only chunk unless you asked for it. See [Usage and cost](/call-models/usage-and-cost).
- On a key with `allowed_models`, Meadow removes `preset` and `route` from requests sent to OpenRouter.
- For Azure, Bedrock, and Vertex, Meadow rewrites the URL, the authentication, and the envelope fields the host requires.

The `model` field in the response is the provider's ID, which can differ from what you sent. A call to `openrouter/z-ai/glm-5.3` answers with `"model":"z-ai/glm-5.3"`.

Meadow checks the request before any provider sees it. These get a 400 from Meadow: a body that is not one JSON object, a duplicate field, a missing `model`, a missing `messages` or `input`, a missing `max_tokens` on Messages, a `stream` that is not a boolean, and a `Content-Type` other than `application/json`.

## Response headers

| Header | On | Meaning |
| --- | --- | --- |
| `x-request-id` | Every response | Meadow's ID for the request. Quote it to support. See [Errors](/reference/errors#request-ids). |
| `x-meadow-provider-request-id` | Served calls and provider errors passed through, when the provider sent one | The answering provider's own request ID, for that provider's support. Providers tried before a fallback are not listed. |
| `x-meadow-provider` | Served calls and provider errors passed through | The provider that answered. |
| `x-meadow-model` | Same | The provider's own ID for the model. |
| `x-meadow-attempts` | Same | Providers tried, including the one that answered. |
| `x-meadow-route` | Same | Why this provider answered, in stable codes: `direct: xai`, or `fallback: openai quota_exceeded -> openrouter`. New on 2026-11-24, on the hosted beta since 2026-11-27. |
| `x-meadow-provider-auth-failed` | Any model response | Providers that rejected your stored key during this request. Replace that provider key. |
| `x-meadow-abandoned-attempts` | Any model response | Providers that received the request and may bill for it, though their answer was not used. |
| `retry-after` | Every 429 | Seconds to wait. See [Token and request limits](/call-models/token-and-request-limits#the-in-flight-limit-and-retry-after). |
| `x-should-retry` | Some errors | `true` on the 429s for a full server, a full body budget and a busy limit check: no provider was called. `false` on a 5xx on a model route, because a provider may have received the call. The official OpenAI and Anthropic SDKs obey it. |
| `request-id` | Every `/v1/messages` response | The same value as `x-request-id`, in the header the Anthropic SDK reads. |
| `x-gemini-service-tier` | Served calls answered by `google`, when Google sent it | The service tier Google served, as Google wrote it: `standard`, `priority` or `flex`. `standard` after a `priority` request means Google downgraded it and bills it at standard. |
| `x-amzn-bedrock-service-tier` | Served calls answered by `bedrock`, when Bedrock sent it | The service tier Bedrock served, as Bedrock wrote it: `default`, `priority`, `flex` or `reserved`. |
| Provider rate-limit headers | Served calls and errors | The provider's own values, for the provider key you stored. |

An Anthropic call returns its rate-limit headers like this:

```text
anthropic-ratelimit-requests-limit: 45000
anthropic-ratelimit-requests-remaining: 44999
anthropic-ratelimit-requests-reset: 2026-11-24T20:41:01Z
x-meadow-attempts: 1
x-meadow-model: claude-haiku-5-5
x-meadow-provider: anthropic
x-meadow-provider-request-id: req_00000a58...
x-request-id: req_0000ba32
```

## When a call fails

Read the status, then check for `x-meadow-provider`.

- The header is present on a 4xx: the provider rejected your request, and the body is in that provider's shape. Google sends a JSON array, xAI sends `{"code": ..., "error": "..."}`, and Anthropic sends `{"type": "error", ...}`. Fix the request.
- The header is absent: the body is Meadow's, in the route's own format (OpenAI's envelope, or Anthropic's on `/v1/messages`), with `error.type`, `error.code` and `error.message`. A 502 lists every provider tried in `error.attempts`.

[Errors](/reference/errors) has the full list, and [Routing and fallbacks](/call-models/routing-and-fallbacks#how-a-provider-error-reaches-you) shows each case.

## API reference

Operations on this page: [`createChatCompletion`](/reference/api-reference#createchatcompletion), [`createResponse`](/reference/api-reference#createresponse), [`createMessage`](/reference/api-reference#createmessage), [`listModels`](/reference/api-reference#listmodels).