
# Model access and limits

Choose which workspaces can call a model or a provider, and how long their keys live and how fast they call.

**Dashboard**

1. On **Models & Routing**, choose **Manage access** beside the model. For a provider, choose it beside the provider on **Providers**.
2. Choose **Selected workspaces** and tick the workspaces that keep it.
3. Choose **Save**. The review lists the keys that lose the model.
4. Choose **Save access**.

The model is refused at once in the workspaces you left out, and **Models & Routing** marks it **Restricted** there.

You need: an organisation Owner or Admin account.

**HTTP API**

```bash
curl -sS -X PUT "$TOKEDEX_URL/control/v1/policy/model-access" \
  -H "Authorization: Bearer $TOKEDEX_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "modelId": "openai/gpt-6-luna", "workspaces": ["<workspace-id>"] }'
```

A change that takes access away first answers `409` with the keys that lose the model:

```json
{
  "error": {
    "code": "review_required",
    "message": "this change reduces access: review it, then send its digest as acknowledge",
    "review": {
      "changes": [{ "op": "+", "path": "modelAccess.openai/gpt-6-luna", "before": null, "after": ["platform"] }],
      "keysLosingModels": [{ "keyId": "01M7V8Z2…", "name": "research-app", "workspaceId": "ws_01M7V8K7…", "restricted": ["openai/gpt-6-luna"] }],
      "digest": "sha256:4cb690b0…"
    }
  }
}
```

Send the same body with `"acknowledge": "<digest>"` to apply it. The gateway answers `200` with every restricted model and the workspaces that keep it:

```json
{ "object": "list", "data": [{ "modelId": "openai/gpt-6-luna", "workspaces": [{ "id": "ws_01M7V8S8…", "slug": "platform", "name": "Platform" }] }] }
```

You need: an admin key with the `admin` preset in `TOKEDEX_ADMIN_KEY`, and `export TOKEDEX_URL='http://127.0.0.1:4000'`.

`"workspaces": "all"` gives the model back to every workspace, with no review. `PUT /control/v1/policy/provider-access` takes `providerId`, such as `anthropic`, in place of `modelId`.

Every workspace can call every model the gateway serves, including models added later, until you restrict it. A workspace created later starts without a restricted model or provider. Restrict each workspace to the models and providers it needs, so a key that leaks there cannot reach the rest.

## Workspaces left out

| You restrict | In the workspaces left out |
| --- | --- |
| A model | Keys are refused the model, and it leaves their model list. A [router](/gateway/router) is its own model ID: restrict the router itself. |
| A provider | The gateway never calls the provider for those keys. A model that other connected providers serve routes to them; one that only this provider serves is refused. A conversation that continues a response from the provider stops. A custom model on the provider's own API is turned off with it. |

A key there that asks for the model is refused with `403` before the gateway calls a provider:

```json
{"error":{"code":"permission_denied","message":"permission denied","type":"invalid_request_error"}}
```

## Limit one workspace's models

**Dashboard**

1. Choose the workspace at the top of the sidebar and open **Settings**.
2. Under **Model access**, choose **Only listed models** and pick them.
3. Choose **Save model access**, then **Apply changes** in the review.

New models stay off in the workspace until you list them. **Everything the organization connects** lifts the list. Use **Only listed models** where each new model should be reviewed first, such as production, and keep the other where a team should get new models as you connect them.

To change the organisation's own limits for one workspace, use **Policy as a file** under **Settings** with **All workspaces**: download the policy as YAML, edit a copy, plan it and apply it.

**HTTP API**

```bash
curl -sS -X PUT "$TOKEDEX_URL/control/v1/workspaces/<workspace-id>/guardrail" \
  -H "Authorization: Bearer $TOKEDEX_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "guardrail": { "models": ["openai/gpt-6-luna", "anthropic/claude-haiku-5.5"] } }'
```

`guardrail` replaces the organisation's limits for the workspace, and the change is reviewed like any that reduces access. `GET /control/v1/workspaces/<workspace-id>/availability` then lists every model with its `status` there: `available`, `restricted`, `not_listed`, `provider_off`, `needs_provider_key` or `workspace_paused`.

Applying a policy file is dashboard only. `GET /control/v1/policy/export` downloads the policy as YAML.

An organisation Owner or Admin sets the list. A Workspace admin can narrow it further with the workspace's own list, never widen it.

## Limit key lifetime and rate

**Dashboard**

1. Choose the workspace and open **Settings**. Its policies card is named after it, such as **Research's policies**.
2. Enter **Longest a key lives (days)** and **Requests a minute per key**.
3. Choose **Save**. Lowering a limit opens **Review before applying**; choose **Apply changes**.

For every workspace at once, choose **All workspaces** and open **Settings**. **Organization policy** holds the same limits, the models and providers every workspace may use, and the **Maximum allowed per-key default (USD)**. While you are the gateway's only user, **Key defaults & limits** takes the place of **Organization policy**.

**HTTP API**

```bash
curl -sS -X PUT "$TOKEDEX_URL/control/v1/workspaces/<workspace-id>/rules" \
  -H "Authorization: Bearer $TOKEDEX_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "rules": { "maxKeyLifetimeDays": 30, "keyRpmMax": 120 } }'
```

`rules` replaces the workspace's own policy, so send every field you want to keep; `models` and `providers` lists go in it too. It needs the `admin` or `workspace-admin` preset. The organisation's policy for every workspace takes the same fields as `"policy"` on `PUT /control/v1/policy`, with `"keyBudgetMax": { "window": "month", "limit": "100" }` to cap the default budget per API key, and needs the `admin` preset.

The tightest of the organisation's policy, its limits for each workspace and the workspace's own policy wins. A new key is shortened to fit. Existing keys keep their expiry unless you shorten them in the review.

Each replica counts requests for each key separately and returns `429` `rate_limited` when it reaches the key's limit. See [Rate limits](/gateway/errors-and-limits#rate-limits).

Set the request limit above what your busiest key needs per replica at its peak, so normal traffic stays within the limit. The dashboard's **Production service** key template gives 600 requests a minute per replica. Set the longest lifetime to how often you can replace keys, since every new key must be replaced within it.

## Review before a change applies

A change that takes access away, such as restricting a model, lowering a limit or pausing a workspace, is reviewed first. Others apply at once.

**Dashboard**

The review lists **What changes**, **Providers turned off**, **Keys that lose access**, **Limits that go down** and the keys that won't meet the new policy. To shorten keys a shorter lifetime leaves outside it, tick **Shorten their expiry to fit**. Then choose its button, such as **Apply changes**. If the settings changed meanwhile, it refreshes first. Read **Keys that lose access** before you apply, and tell those keys' owners: their next request is refused.

**HTTP API**

The first request answers `409` `review_required` with `review`: `changes`, `providersNarrowed`, `keysLosingModels`, `keysSuspended`, `limitsLowered`, `budgetsLowered` and `nonCompliant` keys. To shorten keys that no longer fit, add `"remediation": { "clampExpiryDays": 7 }` (1, 7 or 30, the days a key that is already over the limit keeps) and read `review.remediationEffects`. Send the same body with `"acknowledge": "<digest>"`. If anything it depends on changed since, the gateway refuses the digest; request the review again. Read `keysLosingModels` and `keysSuspended` before you send the digest, and tell those keys' owners: their next request is refused.

## The Models & Routing page

**Models & Routing** lists every model ID the gateway serves. It is shared by all workspaces and shows how the chosen workspace sees each one.

**Dashboard**

- Filter by **Enabled**, **Needs attention** or **Disabled**; by **Available in <workspace>**, **Restricted in <workspace>**, **Provider turned off** or **Needs a provider key**; or with **Search models**, **API format** and **Provider**.
- **Routes to** names what requests go to; **Setup status** reads **Needs attention** when an API route is not available, such as for want of a provider key.
- **In <workspace>** reads **Available**, **Restricted**, **Not on its list**, **Provider off**, **Needs a provider key** or **Workspace paused**, beside **Price per 1M tokens** and **Workspace access**.
- Choose a model ID for **Model details**: **Copy model ID**, its price there, **Routing by API format**, and on each route **Open in Playground** and **Technical details & Batch support**.

![The Models page listing the models the gateway serves](/images/dashboard/models.png)

**HTTP API**

`GET /control/v1/workspaces/<workspace-id>/availability` gives the same view of one workspace. The models an API key can call are on [Find a model](/gateway/models).

## Hide a model from the model list

Each model has two settings that apply in every workspace: whether it accepts requests, and whether it appears in the model list. A hidden model still accepts requests, within each workspace's and key's access, so hide a model to steer people to another without breaking apps that call it, and stop it accepting requests only when it must stop everywhere. A router that chooses among several models has its own **In /v1/models** and **Enabled** switches; see [Routers and fallback](/gateway/router).

**Dashboard**

1. On **Models & Routing**, open the model. Under **Access & discovery**, clear **Show in model list**, or **Accept requests** to refuse it everywhere.
2. In the **Unsaved changes** bar, choose **Save changes**, or **Discard changes**.

**HTTP API**

Both settings are changed in the dashboard only, under **Access & discovery** on a model.

Next: [Budgets](/gateway/budgets), [API keys](/gateway/api-keys) or [People and workspaces](/gateway/people-and-workspaces).
