# Agent gateway

> The Anthropic Messages API and the OpenAI Responses API, passed through to the provider. Authenticate with a personal Nexus token (`nexus auth login`) or API key (`Authorization: Bearer` or `x-api-key`); any member may call. Requests and responses, streaming included, are the providers' own; errors use the provider's error shape. Every call is reserved before it is forwarded and settled on the reported usage; a call over budget is refused with 402.

## Anthropic messages

`POST /v1/anthropic/v1/messages`

Anthropic Messages API (Claude Code: ANTHROPIC_BASE_URL=<core>/v1/anthropic). Metered.

Permission: `agents.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `x-nexus-team` | header | string | no | The team (slug) this call's spend goes to; you must be in it (`nexus claude --team`). Default: your default team. |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Request body (application/json, required)

object: the provider's own request.

### Responses

- `200` The provider's response: JSON, or server-sent events when the request streams. (application/json, object)
- `400` The request is not valid: for example, it has no `model`, or its body is not UTF-8, not a JSON object, or repeats a field. So is an `Idempotency-Key` that is not 1 to 255 printable ASCII characters (`invalid_idempotency_key`). (application/json, ProviderError)
- `401` No key (`missing_credential`; send `Authorization: Bearer <key>` or `x-api-key`), or a key Gateway does not accept (`invalid_credential`). (application/json, ProviderError)
- `402` The call's maximum cost is more than the budget left (`budget_exceeded`), or the organization has an unpaid Nexus invoice past its grace (`payment_past_due`). A `budget_exceeded` refusal carries `notified: true` in its details once Gateway has told the refused person and the organization's owners and admins. Its `error.nexus` is a BudgetRefusal: each money figure with its exact decimal twin. (application/json, ProviderError)
- `403` `model_not_allowed`: the model is refused by a model policy (the message names the level and rule; `error.nexus` carries them), or the organization has no provider key (`provider_key_required`: Nexus credit never pays a pass-through call); or the team in `x-nexus-team` is not the caller's (`not_in_team`). `provider_disabled`: the organization has turned off every provider that serves the model. (application/json, ProviderError)
- `404` `model_not_found`: not in the model catalog; or the team in `x-nexus-team` does not exist (`unknown_team`). (application/json, ProviderError)
- `408` The request body stopped arriving for 30 seconds, or took longer than 10 minutes in all (`request_timeout`; `nexus` holds `gap_seconds` and `total_seconds`). (application/json, ProviderError)
- `409` The `Idempotency-Key` cannot run or replay: its first request still runs (`idempotency_in_progress`), was a stream (`idempotency_stream_replay`), or its answer was not kept, being over 2,000,000 bytes (`idempotency_response_not_stored`). The request does not run again. (application/json, ProviderError)
- `413` The request body is over 32,000,000 bytes, the agent gateway's limit (`request_too_large`). (application/json, ProviderError)
- `422` The `Idempotency-Key` was used for a different request: another method, path, query or body (`idempotency_key_reused`). (application/json, ProviderError)
- `426` The `nexus` CLI that sent `x-nexus-cli-version` is older than Gateway supports (`cli_too_old`; `minimum` names the oldest it takes). A request without that header is never refused. (application/json, ProviderError)
- `429` Over the caller's rate limit, in the provider's error shape: retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, ProviderError)
- `502` The provider could not be reached, or the connection to it failed (`api_error`). (application/json, ProviderError)
- `503` The provider's or the Gateway's own; every one may be retried. The provider's: its own 503 passes through as it wrote it, with its `retry-after` (OpenAI's overload; Anthropic's is a 529, not a 503); `/metrics` and the request log count it as `upstream_overloaded`. Retry after its wait, or try another model. The Gateway's, in the provider's error shape: it is at its limit of requests in flight (`overloaded`, retry after 1 s); it is stopping and takes no new request (`draining`, retry after 5 s); it stopped before the call answered (`gateway_stopping`, send the call again: it reaches a running Gateway); or its database is busy (`database_busy`: nothing was committed, retry shortly). (application/json, ProviderError)
- `504` The provider passed one of the call's deadlines (`upstream_timeout`; `nexus.phase` names which). (application/json, ProviderError)

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | The request is not valid: for example, it has no `model`, or its body is not UTF-8, not a JSON object, or repeats a field. So is an `Idempotency-Key` that is not 1 to 255 printable ASCII characters (`invalid_idempotency_key`). |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 402 | `budget_exceeded` | The call's maximum cost is more than the budget left (`budget_exceeded`), or the organization has an unpaid Nexus invoice past its grace (`payment_past_due`). A `budget_exceeded` refusal carries `notified: true` in its details once Gateway has told the refused person and the organization's owners and admins. Its `error.nexus` is a BudgetRefusal: each money figure with its exact decimal twin. |
| 403 | `role_required` | Your role does not have this permission |
| 403 | `model_not_allowed` | `model_not_allowed`: the model is refused by a model policy (the message names the level and rule; `error.nexus` carries them), or the organization has no provider key (`provider_key_required`: Nexus credit never pays a pass-through call); or the team in `x-nexus-team` is not the caller's (`not_in_team`). `provider_disabled`: the organization has turned off every provider that serves the model. |
| 404 |  | `model_not_found`: not in the model catalog; or the team in `x-nexus-team` does not exist (`unknown_team`). |
| 408 |  | The request body stopped arriving for 30 seconds, or took longer than 10 minutes in all (`request_timeout`; `nexus` holds `gap_seconds` and `total_seconds`). |
| 409 |  | The `Idempotency-Key` cannot run or replay: its first request still runs (`idempotency_in_progress`), was a stream (`idempotency_stream_replay`), or its answer was not kept, being over 2,000,000 bytes (`idempotency_response_not_stored`). The request does not run again. |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 413 |  | The request body is over 32,000,000 bytes, the agent gateway's limit (`request_too_large`). |
| 422 |  | The `Idempotency-Key` was used for a different request: another method, path, query or body (`idempotency_key_reused`). |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 426 |  | The `nexus` CLI that sent `x-nexus-cli-version` is older than Gateway supports (`cli_too_old`; `minimum` names the oldest it takes). A request without that header is never refused. |
| 429 |  | Over the caller's rate limit, in the provider's error shape: retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 502 |  | The provider could not be reached, or the connection to it failed (`api_error`). |
| 503 |  | The provider's or the Gateway's own; every one may be retried. The provider's: its own 503 passes through as it wrote it, with its `retry-after` (OpenAI's overload; Anthropic's is a 529, not a 503); `/metrics` and the request log count it as `upstream_overloaded`. Retry after its wait, or try another model. The Gateway's, in the provider's error shape: it is at its limit of requests in flight (`overloaded`, retry after 1 s); it is stopping and takes no new request (`draining`, retry after 5 s); it stopped before the call answered (`gateway_stopping`, send the call again: it reaches a running Gateway); or its database is busy (`database_busy`: nothing was committed, retry shortly). |
| 504 |  | The provider passed one of the call's deadlines (`upstream_timeout`; `nexus.phase` names which). |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/anthropic/v1/messages" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-opus-5-5",
    "max_tokens": 1024,
    "messages": [
      {
        "role": "user",
        "content": "Hello"
      }
    ]
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fanthropic%2Fv1%2Fmessages)

## Anthropic count tokens

`POST /v1/anthropic/v1/messages/count_tokens`

Anthropic token counting. Free (not metered), but checked against the model policies like every call.

Permission: `agents.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Request body (application/json, required)

object: the provider's own request.

### Responses

- `200` The provider's response: JSON, or server-sent events when the request streams. (application/json, object)
- `400` The request is not valid: for example, it has no `model`, or its body is not UTF-8, not a JSON object, or repeats a field. So is an `Idempotency-Key` that is not 1 to 255 printable ASCII characters (`invalid_idempotency_key`). (application/json, ProviderError)
- `401` No key (`missing_credential`; send `Authorization: Bearer <key>` or `x-api-key`), or a key Gateway does not accept (`invalid_credential`). (application/json, ProviderError)
- `402` The call's maximum cost is more than the budget left. (application/json, ProviderError)
- `403` `model_not_allowed`: the model is refused by a model policy (the message names the level and rule; `error.nexus` carries them), or the organization has no provider key (`provider_key_required`: Nexus credit never pays a pass-through call); or the team in `x-nexus-team` is not the caller's (`not_in_team`). (application/json, ProviderError)
- `404` `model_not_found`: not in the model catalog; or the team in `x-nexus-team` does not exist (`unknown_team`). (application/json, ProviderError)
- `408` The request body stopped arriving for 30 seconds, or took longer than 10 minutes in all (`request_timeout`; `nexus` holds `gap_seconds` and `total_seconds`). (application/json, ProviderError)
- `409` The `Idempotency-Key` cannot run or replay: its first request still runs (`idempotency_in_progress`), was a stream (`idempotency_stream_replay`), or its answer was not kept, being over 2,000,000 bytes (`idempotency_response_not_stored`). The request does not run again. (application/json, ProviderError)
- `413` The request body is over 32,000,000 bytes, the agent gateway's limit (`request_too_large`). (application/json, ProviderError)
- `422` The `Idempotency-Key` was used for a different request: another method, path, query or body (`idempotency_key_reused`). (application/json, ProviderError)
- `426` The `nexus` CLI that sent `x-nexus-cli-version` is older than Gateway supports (`cli_too_old`; `minimum` names the oldest it takes). A request without that header is never refused. (application/json, ProviderError)
- `429` Over the caller's rate limit, in the provider's error shape: retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, ProviderError)
- `502` The provider could not be reached, or the connection to it failed (`api_error`). (application/json, ProviderError)
- `503` The provider's or the Gateway's own; every one may be retried. The provider's: its own 503 passes through as it wrote it, with its `retry-after` (OpenAI's overload; Anthropic's is a 529, not a 503); `/metrics` and the request log count it as `upstream_overloaded`. Retry after its wait, or try another model. The Gateway's, in the provider's error shape: it is at its limit of requests in flight (`overloaded`, retry after 1 s); it is stopping and takes no new request (`draining`, retry after 5 s); or its database is busy (`database_busy`, retry shortly). A count is never `gateway_stopping`. (application/json, ProviderError)
- `504` The provider passed one of the call's deadlines (`upstream_timeout`; `nexus.phase` names which). (application/json, ProviderError)

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | The request is not valid: for example, it has no `model`, or its body is not UTF-8, not a JSON object, or repeats a field. So is an `Idempotency-Key` that is not 1 to 255 printable ASCII characters (`invalid_idempotency_key`). |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 402 | `budget_exceeded` | The call's maximum cost is more than the budget left. |
| 403 | `role_required` | Your role does not have this permission |
| 403 | `model_not_allowed` | `model_not_allowed`: the model is refused by a model policy (the message names the level and rule; `error.nexus` carries them), or the organization has no provider key (`provider_key_required`: Nexus credit never pays a pass-through call); or the team in `x-nexus-team` is not the caller's (`not_in_team`). |
| 404 |  | `model_not_found`: not in the model catalog; or the team in `x-nexus-team` does not exist (`unknown_team`). |
| 408 |  | The request body stopped arriving for 30 seconds, or took longer than 10 minutes in all (`request_timeout`; `nexus` holds `gap_seconds` and `total_seconds`). |
| 409 |  | The `Idempotency-Key` cannot run or replay: its first request still runs (`idempotency_in_progress`), was a stream (`idempotency_stream_replay`), or its answer was not kept, being over 2,000,000 bytes (`idempotency_response_not_stored`). The request does not run again. |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 413 |  | The request body is over 32,000,000 bytes, the agent gateway's limit (`request_too_large`). |
| 422 |  | The `Idempotency-Key` was used for a different request: another method, path, query or body (`idempotency_key_reused`). |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 426 |  | The `nexus` CLI that sent `x-nexus-cli-version` is older than Gateway supports (`cli_too_old`; `minimum` names the oldest it takes). A request without that header is never refused. |
| 429 |  | Over the caller's rate limit, in the provider's error shape: retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 502 |  | The provider could not be reached, or the connection to it failed (`api_error`). |
| 503 |  | The provider's or the Gateway's own; every one may be retried. The provider's: its own 503 passes through as it wrote it, with its `retry-after` (OpenAI's overload; Anthropic's is a 529, not a 503); `/metrics` and the request log count it as `upstream_overloaded`. Retry after its wait, or try another model. The Gateway's, in the provider's error shape: it is at its limit of requests in flight (`overloaded`, retry after 1 s); it is stopping and takes no new request (`draining`, retry after 5 s); or its database is busy (`database_busy`, retry shortly). A count is never `gateway_stopping`. |
| 504 |  | The provider passed one of the call's deadlines (`upstream_timeout`; `nexus.phase` names which). |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/anthropic/v1/messages/count_tokens" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-opus-5-5",
    "messages": [
      {
        "role": "user",
        "content": "Hello"
      }
    ]
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fanthropic%2Fv1%2Fmessages%2Fcount_tokens)

## OpenAI responses

`POST /v1/openai/v1/responses`

OpenAI Responses API (Codex: a model provider with base_url <core>/v1/openai/v1). Metered. A hosted tool Nexus cannot price yet (code_interpreter, file_search), or an image_generation model, quality or size it has no price for, is 400 hosted_tool_not_priced.

Permission: `agents.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `x-nexus-team` | header | string | no | The team (slug) this call's spend goes to; you must be in it (`nexus claude --team`). Default: your default team. |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Request body (application/json, required)

object: the provider's own request.

### Responses

- `200` The provider's response: JSON, or server-sent events when the request streams. (application/json, object)
- `400` The request is not valid: for example, it has no `model`, or its body is not UTF-8, not a JSON object, or repeats a field. So is an `Idempotency-Key` that is not 1 to 255 printable ASCII characters (`invalid_idempotency_key`). (application/json, ProviderError)
- `401` No key (`missing_credential`; send `Authorization: Bearer <key>` or `x-api-key`), or a key Gateway does not accept (`invalid_credential`). (application/json, ProviderError)
- `402` The call's maximum cost is more than the budget left (`budget_exceeded`), or the organization has an unpaid Nexus invoice past its grace (`payment_past_due`). A `budget_exceeded` refusal carries `notified: true` in its details once Gateway has told the refused person and the organization's owners and admins. Its `error.nexus` is a BudgetRefusal: each money figure with its exact decimal twin. (application/json, ProviderError)
- `403` `model_not_allowed`: the model is refused by a model policy (the message names the level and rule; `error.nexus` carries them), or the organization has no provider key (`provider_key_required`: Nexus credit never pays a pass-through call); or the team in `x-nexus-team` is not the caller's (`not_in_team`). `provider_disabled`: the organization has turned off every provider that serves the model. (application/json, ProviderError)
- `404` `model_not_found`: not in the model catalog; or the team in `x-nexus-team` does not exist (`unknown_team`). (application/json, ProviderError)
- `408` The request body stopped arriving for 30 seconds, or took longer than 10 minutes in all (`request_timeout`; `nexus` holds `gap_seconds` and `total_seconds`). (application/json, ProviderError)
- `409` The `Idempotency-Key` cannot run or replay: its first request still runs (`idempotency_in_progress`), was a stream (`idempotency_stream_replay`), or its answer was not kept, being over 2,000,000 bytes (`idempotency_response_not_stored`). The request does not run again. (application/json, ProviderError)
- `413` The request body is over 32,000,000 bytes, the agent gateway's limit (`request_too_large`). (application/json, ProviderError)
- `422` The `Idempotency-Key` was used for a different request: another method, path, query or body (`idempotency_key_reused`). (application/json, ProviderError)
- `426` The `nexus` CLI that sent `x-nexus-cli-version` is older than Gateway supports (`cli_too_old`; `minimum` names the oldest it takes). A request without that header is never refused. (application/json, ProviderError)
- `429` Over the caller's rate limit, in the provider's error shape: retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, ProviderError)
- `502` The provider could not be reached, or the connection to it failed (`api_error`). (application/json, ProviderError)
- `503` The provider's or the Gateway's own; every one may be retried. The provider's: its own 503 passes through as it wrote it, with its `retry-after` (OpenAI's overload; Anthropic's is a 529, not a 503); `/metrics` and the request log count it as `upstream_overloaded`. Retry after its wait, or try another model. The Gateway's, in the provider's error shape: it is at its limit of requests in flight (`overloaded`, retry after 1 s); it is stopping and takes no new request (`draining`, retry after 5 s); it stopped before the call answered (`gateway_stopping`, send the call again: it reaches a running Gateway); or its database is busy (`database_busy`: nothing was committed, retry shortly). (application/json, ProviderError)
- `504` The provider passed one of the call's deadlines (`upstream_timeout`; `nexus.phase` names which). (application/json, ProviderError)

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | The request is not valid: for example, it has no `model`, or its body is not UTF-8, not a JSON object, or repeats a field. So is an `Idempotency-Key` that is not 1 to 255 printable ASCII characters (`invalid_idempotency_key`). |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 402 | `budget_exceeded` | The call's maximum cost is more than the budget left (`budget_exceeded`), or the organization has an unpaid Nexus invoice past its grace (`payment_past_due`). A `budget_exceeded` refusal carries `notified: true` in its details once Gateway has told the refused person and the organization's owners and admins. Its `error.nexus` is a BudgetRefusal: each money figure with its exact decimal twin. |
| 403 | `role_required` | Your role does not have this permission |
| 403 | `model_not_allowed` | `model_not_allowed`: the model is refused by a model policy (the message names the level and rule; `error.nexus` carries them), or the organization has no provider key (`provider_key_required`: Nexus credit never pays a pass-through call); or the team in `x-nexus-team` is not the caller's (`not_in_team`). `provider_disabled`: the organization has turned off every provider that serves the model. |
| 404 |  | `model_not_found`: not in the model catalog; or the team in `x-nexus-team` does not exist (`unknown_team`). |
| 408 |  | The request body stopped arriving for 30 seconds, or took longer than 10 minutes in all (`request_timeout`; `nexus` holds `gap_seconds` and `total_seconds`). |
| 409 |  | The `Idempotency-Key` cannot run or replay: its first request still runs (`idempotency_in_progress`), was a stream (`idempotency_stream_replay`), or its answer was not kept, being over 2,000,000 bytes (`idempotency_response_not_stored`). The request does not run again. |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 413 |  | The request body is over 32,000,000 bytes, the agent gateway's limit (`request_too_large`). |
| 422 |  | The `Idempotency-Key` was used for a different request: another method, path, query or body (`idempotency_key_reused`). |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 426 |  | The `nexus` CLI that sent `x-nexus-cli-version` is older than Gateway supports (`cli_too_old`; `minimum` names the oldest it takes). A request without that header is never refused. |
| 429 |  | Over the caller's rate limit, in the provider's error shape: retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 502 |  | The provider could not be reached, or the connection to it failed (`api_error`). |
| 503 |  | The provider's or the Gateway's own; every one may be retried. The provider's: its own 503 passes through as it wrote it, with its `retry-after` (OpenAI's overload; Anthropic's is a 529, not a 503); `/metrics` and the request log count it as `upstream_overloaded`. Retry after its wait, or try another model. The Gateway's, in the provider's error shape: it is at its limit of requests in flight (`overloaded`, retry after 1 s); it is stopping and takes no new request (`draining`, retry after 5 s); it stopped before the call answered (`gateway_stopping`, send the call again: it reaches a running Gateway); or its database is busy (`database_busy`: nothing was committed, retry shortly). |
| 504 |  | The provider passed one of the call's deadlines (`upstream_timeout`; `nexus.phase` names which). |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/openai/v1/responses" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.3-codex",
    "input": "Hello"
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fopenai%2Fv1%2Fresponses)

## Anthropic models

`GET /v1/anthropic/v1/models`

The models you may use on the Anthropic API, by the provider's own ids, in the provider's list shape (for clients that query it).

Permission: `agents.use` (Every member).

### Responses

- `200` OK (application/json, object)
- `401` No key (`missing_credential`; send `Authorization: Bearer <key>` or `x-api-key`), or a key Gateway does not accept (`invalid_credential`). (application/json, ProviderError)
- `403` The caller may not do this: for example, the role does not have the permission (`role_required`), or the team named is not the caller's (`not_in_team`). (application/json, ProviderError)
- `404` The team named in `x-nexus-team` does not exist (`unknown_team`). (application/json, ProviderError)
- `426` The `nexus` CLI that sent `x-nexus-cli-version` is older than Gateway supports (`cli_too_old`; `minimum` names the oldest it takes). A request without that header is never refused. (application/json, ProviderError)
- `429` Over the caller's rate limit, in the provider's error shape: retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, ProviderError)
- `503` Gateway takes no new request now: it is at its limit of requests in flight (`overloaded`), or it is stopping (`draining`). Retry after `Retry-After` seconds. (application/json, ProviderError)

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 |  | The team named in `x-nexus-team` does not exist (`unknown_team`). |
| 426 |  | The `nexus` CLI that sent `x-nexus-cli-version` is older than Gateway supports (`cli_too_old`; `minimum` names the oldest it takes). A request without that header is never refused. |
| 429 |  | Over the caller's rate limit, in the provider's error shape: retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 503 |  | Gateway takes no new request now: it is at its limit of requests in flight (`overloaded`), or it is stopping (`draining`). Retry after `Retry-After` seconds. |

### Example

```sh
curl "$NEXUS_URL/v1/anthropic/v1/models" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "anthropic-version: 2023-06-01"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fanthropic%2Fv1%2Fmodels)

## OpenAI models

`GET /v1/openai/v1/models`

The models you may use on the OpenAI API, by the provider's own ids, in the provider's list shape (for clients that query it).

Permission: `agents.use` (Every member).

### Responses

- `200` OK (application/json, object)
- `401` No key (`missing_credential`; send `Authorization: Bearer <key>` or `x-api-key`), or a key Gateway does not accept (`invalid_credential`). (application/json, ProviderError)
- `403` The caller may not do this: for example, the role does not have the permission (`role_required`), or the team named is not the caller's (`not_in_team`). (application/json, ProviderError)
- `404` The team named in `x-nexus-team` does not exist (`unknown_team`). (application/json, ProviderError)
- `426` The `nexus` CLI that sent `x-nexus-cli-version` is older than Gateway supports (`cli_too_old`; `minimum` names the oldest it takes). A request without that header is never refused. (application/json, ProviderError)
- `429` Over the caller's rate limit, in the provider's error shape: retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, ProviderError)
- `503` Gateway takes no new request now: it is at its limit of requests in flight (`overloaded`), or it is stopping (`draining`). Retry after `Retry-After` seconds. (application/json, ProviderError)

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 |  | The team named in `x-nexus-team` does not exist (`unknown_team`). |
| 426 |  | The `nexus` CLI that sent `x-nexus-cli-version` is older than Gateway supports (`cli_too_old`; `minimum` names the oldest it takes). A request without that header is never refused. |
| 429 |  | Over the caller's rate limit, in the provider's error shape: retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 503 |  | Gateway takes no new request now: it is at its limit of requests in flight (`overloaded`), or it is stopping (`draining`). Retry after `Retry-After` seconds. |

### Example

```sh
curl "$NEXUS_URL/v1/openai/v1/models" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fopenai%2Fv1%2Fmodels)
