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

# Model and provider allowlists

A Meadow API key can carry three lists: the models it may call (`allowed_models`), the model providers its calls may go to (`allowed_providers`), and the sandbox providers it may create sandboxes on (`allowed_sandbox_providers`). Meadow checks them before it calls any provider or holds any spend. A key created from another key is held by its own lists and by those of every key above it.

Next step: give a key handed to a job or a customer the lists it needs, and check the result with `GET /v1/models`.

Not on the hosted beta yet. `allowed_providers`, `allowed_sandbox_providers`, the two new error codes and changing a list with `PATCH /v1/keys/{key_id}` arrive with its next update. Nothing on this page was run against the hosted beta: the behavior is read from the server's code and its tests, so no output is shown.

## Set the lists

Set them when you create a key, or later with `PATCH /v1/keys/{key_id}`. Both need an admin key.

```bash
curl -sS -X POST "$MEADOW_BASE_URL/v1/keys" \
  -H "Authorization: Bearer $MEADOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "project_id": "'"$PROJECT_ID"'",
    "name": "eval-worker",
    "scopes": ["models", "sandboxes"],
    "allowed_models": ["claude-haiku-5-5", "gpt-4o-mini"],
    "allowed_providers": ["anthropic", "openai"],
    "allowed_sandbox_providers": ["modal"]
  }'
```

```bash
curl -sS -X PATCH "$MEADOW_BASE_URL/v1/keys/$KEY_ID" \
  -H "Authorization: Bearer $MEADOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"allowed_providers": ["anthropic"]}'
```

| Field | Entries | Left out |
| --- | --- | --- |
| `allowed_models` | Model IDs, written as in a request's `model`. | Any model. |
| `allowed_providers` | `anthropic`, `openai`, `google`, `xai`, `openrouter`, `azure`, `bedrock`, `vertex`, `fireworks`, `deepseek`. | Any model provider. |
| `allowed_sandbox_providers` | `daytona`, `modal`. | Any sandbox provider. |

Things to know before you rely on them:

- An empty list returns 400. Leave the field out to allow everything. On `PATCH`, `null` removes a list.
- An unknown provider, a sandbox provider in `allowed_providers` or a model provider in `allowed_sandbox_providers` returns 400 with the field in `error.param`.
- A key object shows its own lists, and leaves out a list it does not have. The lists of the keys above it can narrow it further. `GET /v1/models` shows the result.
- `allowed_models` and `allowed_providers` are the names OpenRouter uses on its guardrails.

## How model IDs match

Matching is exact and case-sensitive, after Meadow reads the ID the way it reads a request's `model`:

- A plain ID such as `claude-haiku-5-5` allows that model on every provider that serves it, including a pinned request such as `bedrock/claude-haiku-5-5`.
- A prefixed ID such as `anthropic/claude-haiku-5-5` allows the model on that provider only.
- A provider alias counts as the model it names: `claude-haiku-4-5` and `claude-haiku-4-5-20251001` are one model. Another version of the same family is another model.
- A leading `meadow/` is dropped. OpenRouter, LiteLLM and Vercel spellings such as `openrouter/anthropic/claude-haiku-4.5` resolve as they do in a request. See [Models](/call-models/models).
- An ID Meadow does not list, such as a new `claude-` ID, matches only the same plain ID or that ID pinned to its own provider.
- A prefix Meadow does not know, such as `acme/model-1`, returns 400 when you set the list.

The list is checked against the model your request names, before any provider is called. When the provider answers with another snapshot, or reroutes the model to a newer one, the call is served. The usage record's `served_model` shows what answered. See [Usage and cost](/call-models/usage-and-cost).

`openrouter/openrouter/auto` on the list lets OpenRouter pick any model. On a key with an `allowed_models` list, Meadow removes `preset` and `route` from requests sent to OpenRouter.

## How provider lists apply

`allowed_providers` applies to every attempt of a model call: the default route, `provider.order`, `provider.only`, a pinned model ID, each model in `models` and each fallback to the next provider. A fallback never goes to a provider off the list. When the route keeps no provider on the list, the call returns 403 before any provider is called.

The provider is the Meadow provider whose stored key pays for the call. With `openrouter` on the list, OpenRouter still picks its own upstream for the model.

A key with a dollar `limit` can only call providers Meadow has prices for. `allowed_providers` keeps the route to those, so such a key can use a project whose default route includes `openrouter`. See [Spend limits](/call-models/spend-limits).

`allowed_sandbox_providers` applies to `POST /v1/sandboxes`, to its fallback to the next provider, and to `POST /v1/images` and its `build_on`. A sandbox already running stays reachable after its provider leaves the list.

<a id="what-a-refused-call-looks-like"></a>

## What a rejected call looks like

On the model routes the body is in the format's own envelope, with the status the providers use for a model a key may not use: 403. OpenAI's SDK raises `PermissionDeniedError` and Anthropic's raises `PermissionDeniedError`.

| `error.code` | When |
| --- | --- |
| `key_model_access_denied` | The model, or a model in `models`, is not in the `allowed_models` of the key or of a key above it. `error.param` is `model` or `models`. Also sent when the list allows the model only on providers that do not serve this format. |
| `key_provider_access_denied` | No provider in the route is in the key's `allowed_providers`, or for a sandbox or image build, its `allowed_sandbox_providers`. The message names the providers the key may use. |
| `no_provider_key` (422) | Providers on the list serve the model, and none of them has a stored key. The message names the list. |

```json
{"error":{"message":"model \"gpt-4.1\" is not in this api key's allowed_models","type":"invalid_request_error","param":"model","code":"key_model_access_denied"},"request_id":"req_000000000000000000005fda"}
```

```json
{"type":"error","error":{"type":"permission_error","message":"model \"anthropic/claude-haiku-5-5\" has no provider in this route that this api key may use in the Messages format: its allowed_providers allow openrouter","details":{"error_code":"key_provider_access_denied"},"code":"key_provider_access_denied"},"request_id":"req_000000000000000000005fda"}
```

See [Errors](/reference/errors) for every code.

## Child keys

A key created by a key with a list must name a list inside it. Leaving the field out, or naming a model or provider the parent key may not use, returns 403 `key_grant_exceeds_parent`.

A change applies to every key below at once. When you narrow a parent's list, each child is held by the narrower list from its next call, though the child's own list stays as it was. A `PATCH` must also stay inside the lists of the keys above the changed key, and inside the calling key's own lists, so a key cannot widen itself or any other key past what it holds.

A key Meadow makes for a sandbox with `model_access` or `sandbox_access` gets the three lists of the key that created the sandbox.

## Changes and calls in flight

Meadow reads the lists once, when it authenticates a request, and plans the route from them. A call that is already running when you change a list keeps that route, fallbacks included. Every call authenticated after the `PATCH` returns uses the new list.

## API reference

Operations on this page: [`createKey`](/reference/api-reference#createkey), [`updateKey`](/reference/api-reference#updatekey), [`listModels`](/reference/api-reference#listmodels), [`createChatCompletion`](/reference/api-reference#createchatcompletion), [`createMessage`](/reference/api-reference#createmessage), [`createResponse`](/reference/api-reference#createresponse), [`createSandbox`](/reference/api-reference#createsandbox), [`createImage`](/reference/api-reference#createimage).