Headless cloud sessions: a cloud session that starts with no desktop app, for the assistant, the CLI, MCP and the apps. Each session runs on its own cloud machine of yours, with the cloud machines' limits and charges. A session is its person's alone: to anyone else it does not exist. Off unless NEXUS_SESSIONS_API is on: every route then answers 404.
A user id (yours, for person), an assistant conversation's id, a room's id, or a session of yours (cs_…).
createdAtstring (date-time)required
updatedAtstring (date-time)required
stoppedAtstring (date-time) | nullrequired
When it stopped or failed.
machineCloudMachine | nullrequired
Its cloud machine; null once the machine is deleted.
fencingTokenintegerrequired
The session's current fencing token: 0 until a runner first takes it, then raised by one on each take.
min 0
runnerSessionRunner | nullrequired
The runner that took the session last, and its lease; null until one takes it.
404`NEXUS_SESSIONS_API` is off.
429Over the caller's rate limit (`rate_limit_error`): 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
errorobject
messagestringrequired
typestringrequired
The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
codestring
Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
paramstring
model when the error is a model refusal (a code starting with model_); absent otherwise.
nexusobject
Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
minimumstring
On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.
503No provider account on this Gateway (`cloud_unavailable`); try again later.
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
`NEXUS_SESSIONS_API` is off.
429
Over the caller's rate limit (`rate_limit_error`): 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
No provider account on this Gateway (`cloud_unavailable`); try again later.
Start a headless cloud session: a cloud session with no desktop app. Gateway creates your cloud machine for the session (as POST /v1/cloud/machines does, with its limits and charges), the machine clones repo and runs its .agents/setup at boot with the organization's Nexus GitHub App, and Gateway then starts the agent on the machine with prompt as its first message. The prompt never goes to the provider: Gateway sends it to the machine's host once the host is online. The agent runs on the Nexus route, charged to the organization, in auto permission mode. Send idempotencyKey (or an Idempotency-Key header): the session's id is derived from it, so a resend answers the same session. Read the session (GET) to see it move from starting to running. Off unless NEXUS_SESSIONS_API is on.
Your own GitHub token. Gateway asks GitHub with it whether you may read repo. Used for that check only, never kept, and never sent to the machine. Without it, Gateway uses your own github connection (connect it with POST /v1/connections/github/oauth).
x-nexus-github-accountheader · string
The id of your linked GitHub account when you have more than one.
Idempotency-Keyheader · string
Send the same key again to retry safely: the request runs once. See Idempotency keys.
Request body · application/json
repostring
The GitHub repository, owner/name (a github.com URL also works). Required for now.
projectIdstring
Reserved for projects: refused for now (project_id_unsupported).
agentstring
A coding agent that runs in cloud sessions: claude or codex, and opencode when the Gateway turns it on. Absent, empty or auto: the model picks it (open-weight models run on opencode, Anthropic models on claude, OpenAI models on codex). Another agent is refused with invalid_agent.
modelstring
A catalog model (GET /v1/models) or the agent's own model name; absent for the agent's default. Required when agent is absent. With agent, a catalog model that another agent runs is refused with agent_model_mismatch.
promptstringrequired
The session's first message, 1 to 100000 characters.
titlestring
The session's title, kept on one line, at most 200 characters.
idempotencyKeystring
Names the session: a resend with the same body answers the same session. Else the Idempotency-Key header's.
startedBySessionStartedBy
Who started a session. Absent on a start: you (person).
A user id (yours, for person), an assistant conversation's id, a room's id, or a session of yours (cs_…).
createdAtstring (date-time)required
updatedAtstring (date-time)required
stoppedAtstring (date-time) | nullrequired
When it stopped or failed.
machineCloudMachine | nullrequired
Its cloud machine; null once the machine is deleted.
fencingTokenintegerrequired
The session's current fencing token: 0 until a runner first takes it, then raised by one on each take.
min 0
runnerSessionRunner | nullrequired
The runner that took the session last, and its lease; null until one takes it.
400A field is wrong: `invalid_repo` (not GitHub `owner/name`), `invalid_agent` (not an agent this Gateway runs in cloud sessions), `invalid_model`, `model_required` (no agent and no model), `unknown_model`, `model_coming_soon` or `unsupported_cloud_model` (no cloud agent runs the model), `agent_model_mismatch` (the model runs on another agent; `error.nexus` names `agent`, `model` and `modelAgent`), `invalid_prompt`, `invalid_started_by`, `idempotency_key_required`, or `project_id_unsupported` (`projectId` is reserved).
402Nothing covers 15 minutes of the machine's cloud compute (`budget_exceeded`), or the organization is past due (`payment_past_due`).
403Cloud machines are disabled (`cloud_not_enabled`), the organization disallows the GitHub connection (`connector_disabled`), or it needs reconnecting (`connection_expired`).
404`NEXUS_SESSIONS_API` is off.
409No `x-nexus-github-token` header and no `github` connection of your own (`github_connection_required`, with `error.nexus.connect` set to `github`): connect your GitHub account, then start again. Or the machine may not set the repository up (`repo_setup_unavailable`): you cannot read it, or the organization's Nexus GitHub App does not reach it.
422This key names another session (`idempotency_key_reused`); send a new key.
429Over the caller's rate limit (`rate_limit_error`): 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
errorobject
messagestringrequired
typestringrequired
The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
codestring
Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
paramstring
model when the error is a model refusal (a code starting with model_); absent otherwise.
nexusobject
Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
minimumstring
On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.
502The cloud provider failed or did not answer (`cloud_provider_error`); try again.
503No provider account on this Gateway (`cloud_unavailable`); try again later.
Errors
Status
Code
When
400
invalid_request_error
A field is missing or not valid; the message names it
400
A field is wrong: `invalid_repo` (not GitHub `owner/name`), `invalid_agent` (not an agent this Gateway runs in cloud sessions), `invalid_model`, `model_required` (no agent and no model), `unknown_model`, `model_coming_soon` or `unsupported_cloud_model` (no cloud agent runs the model), `agent_model_mismatch` (the model runs on another agent; `error.nexus` names `agent`, `model` and `modelAgent`), `invalid_prompt`, `invalid_started_by`, `idempotency_key_required`, or `project_id_unsupported` (`projectId` is reserved).
401
authentication_error
No key, or a key Gateway does not accept
402
budget_exceeded
Nothing covers 15 minutes of the machine's cloud compute (`budget_exceeded`), or the organization is past due (`payment_past_due`).
403
role_required
Your role does not have this permission
404
`NEXUS_SESSIONS_API` is off.
409
No `x-nexus-github-token` header and no `github` connection of your own (`github_connection_required`, with `error.nexus.connect` set to `github`): connect your GitHub account, then start again. Or the machine may not set the repository up (`repo_setup_unavailable`): you cannot read it, or the organization's Nexus GitHub App does not reach it.
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
422
This key names another session (`idempotency_key_reused`); send a new key.
422
idempotency_key_reused
The Idempotency-Key was used with a different request
429
Over the caller's rate limit (`rate_limit_error`): 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 cloud provider failed or did not answer (`cloud_provider_error`); try again.
503
No provider account on this Gateway (`cloud_unavailable`); try again later.
A user id (yours, for person), an assistant conversation's id, a room's id, or a session of yours (cs_…).
createdAtstring (date-time)required
updatedAtstring (date-time)required
stoppedAtstring (date-time) | nullrequired
When it stopped or failed.
machineCloudMachine | nullrequired
Its cloud machine; null once the machine is deleted.
fencingTokenintegerrequired
The session's current fencing token: 0 until a runner first takes it, then raised by one on each take.
min 0
runnerSessionRunner | nullrequired
The runner that took the session last, and its lease; null until one takes it.
404No such session of yours: another person's session and another organization's are as absent as a missing one. Every sessions route answers 404 while `NEXUS_SESSIONS_API` is off.
429Over the caller's rate limit (`rate_limit_error`): 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
errorobject
messagestringrequired
typestringrequired
The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
codestring
Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
paramstring
model when the error is a model refusal (a code starting with model_); absent otherwise.
nexusobject
Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
minimumstring
On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.
503No provider account on this Gateway (`cloud_unavailable`); try again later.
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
not_found
Nothing matches the path in your organization
404
No such session of yours: another person's session and another organization's are as absent as a missing one. Every sessions route answers 404 while `NEXUS_SESSIONS_API` is off.
429
Over the caller's rate limit (`rate_limit_error`): 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
No provider account on this Gateway (`cloud_unavailable`); try again later.
Send the session's agent its next message. It waits for the machine's host, after the messages before it, and a sleeping machine wakes for it (with the wake's limits and charges). A message whose answer the host lost is not sent again: the session's error says so.
A user id (yours, for person), an assistant conversation's id, a room's id, or a session of yours (cs_…).
createdAtstring (date-time)required
updatedAtstring (date-time)required
stoppedAtstring (date-time) | nullrequired
When it stopped or failed.
machineCloudMachine | nullrequired
Its cloud machine; null once the machine is deleted.
fencingTokenintegerrequired
The session's current fencing token: 0 until a runner first takes it, then raised by one on each take.
min 0
runnerSessionRunner | nullrequired
The runner that took the session last, and its lease; null until one takes it.
400`text` is blank or longer than 100000 characters (`invalid_text`).
404No such session of yours: another person's session and another organization's are as absent as a missing one. Every sessions route answers 404 while `NEXUS_SESSIONS_API` is off.
409The session stopped or failed (`session_ended`).
429Over the caller's rate limit (`rate_limit_error`): 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
errorobject
messagestringrequired
typestringrequired
The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
codestring
Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
paramstring
model when the error is a model refusal (a code starting with model_); absent otherwise.
nexusobject
Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
minimumstring
On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.
503No provider account on this Gateway (`cloud_unavailable`); try again later.
Errors
Status
Code
When
400
invalid_request_error
A field is missing or not valid; the message names it
400
`text` is blank or longer than 100000 characters (`invalid_text`).
401
authentication_error
No key, or a key Gateway does not accept
403
role_required
Your role does not have this permission
404
not_found
Nothing matches the path in your organization
404
No such session of yours: another person's session and another organization's are as absent as a missing one. Every sessions route answers 404 while `NEXUS_SESSIONS_API` is off.
409
The session stopped or failed (`session_ended`).
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
422
idempotency_key_reused
The Idempotency-Key was used with a different request
429
Over the caller's rate limit (`rate_limit_error`): 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
No provider account on this Gateway (`cloud_unavailable`); try again later.
Stop the session. Before its agent started, it ends now and its machine goes to sleep. After, Gateway asks the machine's host to stop the agent, and the session ends (stopped) once it did; the machine then sleeps when idle. A stop of an ended session changes nothing.
A user id (yours, for person), an assistant conversation's id, a room's id, or a session of yours (cs_…).
createdAtstring (date-time)required
updatedAtstring (date-time)required
stoppedAtstring (date-time) | nullrequired
When it stopped or failed.
machineCloudMachine | nullrequired
Its cloud machine; null once the machine is deleted.
fencingTokenintegerrequired
The session's current fencing token: 0 until a runner first takes it, then raised by one on each take.
min 0
runnerSessionRunner | nullrequired
The runner that took the session last, and its lease; null until one takes it.
404No such session of yours: another person's session and another organization's are as absent as a missing one. Every sessions route answers 404 while `NEXUS_SESSIONS_API` is off.
429Over the caller's rate limit (`rate_limit_error`): 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
errorobject
messagestringrequired
typestringrequired
The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
codestring
Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
paramstring
model when the error is a model refusal (a code starting with model_); absent otherwise.
nexusobject
Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
minimumstring
On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.
503No provider account on this Gateway (`cloud_unavailable`); try again later.
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
not_found
Nothing matches the path in your organization
404
No such session of yours: another person's session and another organization's are as absent as a missing one. Every sessions route answers 404 while `NEXUS_SESSIONS_API` is off.
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
422
idempotency_key_reused
The Idempotency-Key was used with a different request
429
Over the caller's rate limit (`rate_limit_error`): 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
No provider account on this Gateway (`cloud_unavailable`); try again later.
Take the session as its runner: the desktop app, nexus-host or a cloud machine that runs its agent. The runner gets the session's next fencing token and a lease of 60 seconds, which it renews every 20 seconds (POST /v1/sessions/{id}/runner/renew). Without seenToken, the take succeeds only when no runner's lease is live: the first take, or a takeover after the lease passed. With seenToken (the session's fencingToken as you read it), it is a handoff: it takes the session from whoever holds it, while that is still the session's token. Each take raises the token by one, so the runner it replaced gets 409 lost_runner on its next renewal or connector write. Of two takes at once, one wins and the other gets 409 takeover_conflict.
The session's id (cs_…), as POST /v1/sessions answered it
Request body · application/json
runnerIdstringrequired
Who takes the session: a name of the runner's own, such as its device id.
min length 1 · max length 200
seenTokeninteger | null
The session's fencingToken as you read it: take the session over from its holder (a handoff) while that is still its token.
min 0
Responses
200OKapplication/json
runnerIdstringrequired
The runner, as it named itself when it took the session.
fencingTokenintegerrequired
The token the runner holds. Its connector writes inside the session send it in x-nexus-fencing-token.
min 1
leaseExpiresAtstring (date-time)required
When the lease ends unless the runner renews it. After it, another runner may take the session without seenToken.
400`invalid_runner_id` or `invalid_token`.application/json
errorobject
messagestringrequired
typestringrequired
The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
codestring
Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
paramstring
model when the error is a model refusal (a code starting with model_); absent otherwise.
nexusobject
Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
minimumstring
On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.
404No such session of yours: another person's session and another organization's are as absent as a missing one. Every sessions route answers 404 while `NEXUS_SESSIONS_API` is off.application/json
errorobject
messagestringrequired
typestringrequired
The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
codestring
Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
paramstring
model when the error is a model refusal (a code starting with model_); absent otherwise.
nexusobject
Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
minimumstring
On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.
409`takeover_conflict`: another runner's lease is live and the take named no `seenToken`, or the token you saw is no longer the session's (`error.nexus.currentFencingToken`). `session_ended`: the session stopped or failed.application/json
errorobject
messagestringrequired
typestringrequired
The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
codestring
Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
paramstring
model when the error is a model refusal (a code starting with model_); absent otherwise.
nexusobject
Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
minimumstring
On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.
429Over the caller's rate limit (`rate_limit_error`): 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
errorobject
messagestringrequired
typestringrequired
The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
codestring
Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
paramstring
model when the error is a model refusal (a code starting with model_); absent otherwise.
nexusobject
Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
minimumstring
On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.
503No provider account on this Gateway (`cloud_unavailable`); try again later.application/json
errorobject
messagestringrequired
typestringrequired
The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
codestring
Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
paramstring
model when the error is a model refusal (a code starting with model_); absent otherwise.
nexusobject
Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
minimumstring
On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.
Errors
Status
Code
When
400
invalid_request_error
A field is missing or not valid; the message names it
400
`invalid_runner_id` or `invalid_token`.
401
authentication_error
No key, or a key Gateway does not accept
403
role_required
Your role does not have this permission
404
not_found
Nothing matches the path in your organization
404
No such session of yours: another person's session and another organization's are as absent as a missing one. Every sessions route answers 404 while `NEXUS_SESSIONS_API` is off.
409
`takeover_conflict`: another runner's lease is live and the take named no `seenToken`, or the token you saw is no longer the session's (`error.nexus.currentFencingToken`). `session_ended`: the session stopped or failed.
409
lost_runner
Each take raises the token by one, so the runner it replaced gets 409 `lost_runner` on its next renewal or connector write
409
takeover_conflict
Of two takes at once, one wins and the other gets 409 `takeover_conflict`
429
Over the caller's rate limit (`rate_limit_error`): 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
No provider account on this Gateway (`cloud_unavailable`); try again later.
Renew the runner's lease for 60 seconds more. Only the holder of the session's current fencing token renews; a lease that passed renews too while no other runner took the session. Send it without Idempotency-Key: a retry has the same effect while the token is current. A key, when sent, is kept and replayed as on any write.
The session's id (cs_…), as POST /v1/sessions answered it
Request body · application/json
fencingTokenintegerrequired
The token the runner got when it took the session.
min 1
Responses
200OKapplication/json
runnerIdstringrequired
The runner, as it named itself when it took the session.
fencingTokenintegerrequired
The token the runner holds. Its connector writes inside the session send it in x-nexus-fencing-token.
min 1
leaseExpiresAtstring (date-time)required
When the lease ends unless the runner renews it. After it, another runner may take the session without seenToken.
400The body is not `{ fencingToken }`.application/json
errorobject
messagestringrequired
typestringrequired
The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
codestring
Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
paramstring
model when the error is a model refusal (a code starting with model_); absent otherwise.
nexusobject
Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
minimumstring
On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.
404No such session of yours: another person's session and another organization's are as absent as a missing one. Every sessions route answers 404 while `NEXUS_SESSIONS_API` is off.application/json
errorobject
messagestringrequired
typestringrequired
The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
codestring
Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
paramstring
model when the error is a model refusal (a code starting with model_); absent otherwise.
nexusobject
Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
minimumstring
On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.
409`lost_runner`: another runner took the session, so stop running it and stop writing for it (`error.nexus.currentFencingToken`). `session_ended`: the session stopped or failed.application/json
errorobject
messagestringrequired
typestringrequired
The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
codestring
Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
paramstring
model when the error is a model refusal (a code starting with model_); absent otherwise.
nexusobject
Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
minimumstring
On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.
429Over the caller's rate limit (`rate_limit_error`): 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
errorobject
messagestringrequired
typestringrequired
The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
codestring
Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
paramstring
model when the error is a model refusal (a code starting with model_); absent otherwise.
nexusobject
Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
minimumstring
On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.
503No provider account on this Gateway (`cloud_unavailable`); try again later.application/json
errorobject
messagestringrequired
typestringrequired
The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
codestring
Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
paramstring
model when the error is a model refusal (a code starting with model_); absent otherwise.
nexusobject
Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
minimumstring
On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.
Errors
Status
Code
When
400
invalid_request_error
A field is missing or not valid; the message names it
400
The body is not `{ fencingToken }`.
401
authentication_error
No key, or a key Gateway does not accept
403
role_required
Your role does not have this permission
404
not_found
Nothing matches the path in your organization
404
No such session of yours: another person's session and another organization's are as absent as a missing one. Every sessions route answers 404 while `NEXUS_SESSIONS_API` is off.
409
`lost_runner`: another runner took the session, so stop running it and stop writing for it (`error.nexus.currentFencingToken`). `session_ended`: the session stopped or failed.
429
Over the caller's rate limit (`rate_limit_error`): 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
No provider account on this Gateway (`cloud_unavailable`); try again later.