# Models and policies

> One catalog of models, and allow and deny lists per organization, team and coding agent; a deny always wins.

Every model in Nexus has one name, and every model call is checked against your organization's policies before it
reaches a provider. Owners and admins decide which models people may use; everyone can see what they may use and
test a rule before relying on it.

## The catalog

Each model is named one way: `provider/model`, such as `anthropic/claude-opus-5.5` or `openai/gpt-5.3-codex`. Nexus
reads every other spelling of the same model (the provider's own, like `claude-opus-5-5`, dots or dashes, a dated
snapshot) as that one name, so a rule written once matches every way a client may ask.

A model is either:

- **Supported**: Nexus calls its provider directly, prices and meters it. Today: Anthropic's Claude models, OpenAI's
  GPT-6 and GPT-5.3-Codex, and open-weight models that Baseten hosts, such as `zai/glm-5.3` and `openai/gpt-oss-120b`.
  Each runs on the APIs its provider serves it on.
- **Coming soon**: listed to show what is planned, and not callable yet.

```sh
nexus models          # the models you may use
nexus models --all    # the whole catalog: supported and coming soon, prices, and whether you may use each
```

The API is [`GET /v1/models`](/docs/api/models#list-models), an OpenAI-compatible list of the models you may use;
`?status=all` gives the whole catalog with each model's status, price and whether it is allowed for you. Nexus UI's
**Models** page shows the same.

## Rules: allow and deny

A policy rule has an **allow** list and a **deny** list of patterns, and optional defaults:

```yaml
allow:
  - anthropic/*                 # a provider
deny:
  - anthropic/claude-fable-*    # a family
defaults:
  chat: anthropic/claude-sonnet-5.5
  claude: anthropic/claude-opus-5.5
```

A pattern is an exact model (any spelling), a provider (`anthropic/*`), a family (`openai/gpt-6-*`) or `*`.

- **No allow list means every supported model** is allowed.
- **A deny always wins**, at any level, over any allow. Only an [override](#pause-limit-and-override) allows a
  denied model.
- A rule may name a model that is coming soon: it is accepted with a note and takes effect once the model is supported.

## Levels intersect

Rules apply at several levels, widest first:

1. the **organization**;
2. each **team** on the path from the top of your team tree down to the team the call is attributed to;
3. the **coding agent** (`claude` for Claude Code, `codex` for Codex), for their calls.

Every allow list on the way must match, and any deny on the way refuses. So a lower level can only narrow what the
levels above allow: a team that allows more than its organization gains nothing. Rules are per organization, team
and agent; there are no rules for individual people.

```sh
nexus policy set org --deny "anthropic/claude-fable-*"
nexus policy set team/platform --allow "anthropic/*" --default anthropic/claude-haiku-5.5
nexus policy set agent/claude --from rule.yaml
nexus policy show team/platform     # its rule, what it inherits, and what it allows
```

`--allow all` and `--deny none` clear a list; `--clear` removes a level's rule. The API is
[`GET` and `PUT /v1/policies/organization`](/docs/api/models#set-organization-policy),
[`/v1/policies/teams/{slug}`](/docs/api/models#set-team-policy) and
[`/v1/policies/agents/{agent}`](/docs/api/models#set-agent-policy); a `PUT` replaces the level's rule, and an empty
rule removes it. Owners and admins set policies. A team lead sets the policy of a team they lead, or one under it,
only to narrow it (else `403` `policy_widens`). Everyone reads them. Every change is in the
[audit log](/docs/concepts/audit-log) as `policy.changed`, with the rule before and after.

## `nexus/auto` and `nexus/default`

Ask for `nexus/auto` in a chat call, and Auto Router picks the model. It sorts the request as light, standard or
heavy, and sends it to the lowest-priced model for that class that your organization allows. The `x-nexus-router`
header names the Auto version that picked. See the [Auto Router changelog](/auto-router/changelog).

If Auto cannot pick, and for Claude Code and Codex, `nexus/auto` runs the same model as `nexus/default`: the default
named by the most specific level for that API (chat, Claude Code or Codex), else Nexus's own default. Neither ever
runs a refused model: if the default is denied, the first allowed supported model runs, and the answer says so.

Every answer names the model that ran: the `model` field of the response, and the `x-nexus-model` header.

```sh
nexus chat "Summarize our refund policy in three bullets"            # nexus/auto
nexus chat "hello" --model anthropic/claude-haiku-5.5 --team platform
nexus claude --model auto                                          # Claude Code on the model Nexus resolves
```

## Pause, limit and override

An **operator control** acts on the organization, a team, a person or a key until it expires. A **pause** refuses every
model call. A **limit** narrows to the models it lists. An **override** allows the models it lists over the rules, but
never over a pause or a limit.

```sh
nexus policy pause person/usr_123 --reason "runaway script" --expires 12h
nexus policy limit team/platform --models anthropic/claude-haiku-5.5 --reason "cost review" --expires 30d
nexus policy controls                # the controls in force that apply to you
nexus policy clear <control-id>
```

Owners and admins set every control. A team lead pauses or limits a team they lead, and the people and keys in it,
with `--team`. Only owners and admins override. Every change is in the audit log as `policy.control_set` or
`policy.control_cleared`. The API is `/v1/policies/controls`.

## Test a rule

The policy test makes the same decision as a real call, without making one, and says which rule decided:

```sh
nexus policy test --agent claude --model claude-haiku-5-5
nexus policy test --as ada@example.com --team platform --model openai/gpt-6-astra
```

It exits `1` when the model would be refused. The answer lists the models allowed in that situation, and warns when a
rule would break a coding agent: Claude Code also calls a small Haiku model in the background, and a rule that denies
it refuses those calls like any other. Testing as someone else needs owner or admin. The API is
[`POST /v1/policies/test`](/docs/api/models#test-policy).

## When a model is refused

A refused call never reaches the provider and costs nothing. It is answered in the provider's own error format, so
SDKs and coding agents show it the way they show the provider's errors, and the message names the level and the rule:

| Status | Code | When |
| --- | --- | --- |
| `403` | `model_not_allowed` | A policy refuses the model |
| `403` | `operator_paused` | An operator control pauses the caller's model calls |
| `404` | `model_not_found` | The catalog has no such model |
| `400` | `model_not_supported` | The model is coming soon, or not served on that API |

On chat completions and the OpenAI pass-through:

```json
{
  "error": {
    "message": "model anthropic/claude-fable-5.1 is not allowed: it matches \"anthropic/claude-fable-*\" on the deny list of the organization's policy",
    "type": "permission_error",
    "code": "model_not_allowed",
    "param": "model"
  }
}
```

On the Anthropic pass-through, the same message in Anthropic's shape:
`{"type": "error", "error": {"type": "permission_error", "message": "…"}}`. A refusal appears in your spend's list of
calls as refused, with no cost.

## Coming

Rules on individual API keys and service accounts are coming. Until then, an operator control can pause or limit
one key.
