Skip to content
NewNexus 2.0 is here, and it’s open source. Read the launch post

API reference

Cloud machines

Cloud machines: a Linux machine at a cloud provider (boat.dev in v1) for each person, on Nexus's own provider account. Nobody opens a provider account or sees Nexus's key. Gateway charges a machine's running time to the organization as cloud compute (product cloud, capability compute in GET /v1/spend), at the provider's price per second, when it sleeps or is deleted and every 15 minutes while it runs. A machine is its person's alone: to anyone else it does not exist. One live machine per person in an organization. Without a provider account on the Gateway (BOAT_API_KEY), every route answers 503 cloud_unavailable.

View as Markdown

List cloud machines

get/v1/cloud/machines

Your live cloud machines in this organization, one for each desktop session at most, each state read from the provider.

cloud.machines.useEvery memberTry it in the API Explorer

Responses

200OKapplication/json

  • machinesarray of CloudMachinerequired
    • idstringrequired

      cm_ and up to 64 base64url characters

    • sessionIdstring | nullrequired

      The desktop session the machine is for; null on a machine made before sessions.

    • titlestring | nullrequired

      The session's title, on one line; null when the create sent none.

    • namestringrequired

      The session's title, cut to 120 characters, or Cloud.

    • provider"boat"required
    • size"small" | "default" | "large" | "xlarge"required

      Nexus chooses it: NEXUS_CLOUD_DEFAULT_SIZE when made.

    • state"queued" | "creating" | "starting" | "ready" | "sleeping" | "stopping" | "failed" | "gone"required

      The desktop's CloudState. queued waits for a place, the person's next start or the provider; nothing runs. Running time is charged in creating, starting and ready.

    • errorstring | nullrequired

      Why it failed; null otherwise.

    • createdAtstring (date-time)required
    • sleepingSincestring (date-time) | nullrequired

      When it went to sleep; null unless sleeping.

    • stopReason"budget" | "max_run" | "not_enabled" | "idle" | "resize" | nullrequired

      Why Gateway put it to sleep: budget when its compute was refused, max_run after its longest run with no interaction (24 hours by default, from the person's last interaction, create, wake or access), not_enabled when the organization may no longer run machines, idle when nobody needs it (its agent idle 5 minutes and its person idle 20 minutes, or its host silent 15 minutes, or no report from its host in the 5 minutes after its last create, wake, access or connect), resize while it restarts one size bigger after it ran out of memory. Null otherwise, and cleared by a wake.

    • queuedUntilstring (date-time) | nullrequired

      While queued: the earliest time Gateway tries to start it (the person's next start, the provider's nextStartAt, or the meter's next pass). Null otherwise.

    • hostOnlinebooleanrequired

      The machine's host has its control connection open on this copy of Gateway: GET /v1/cloud/machines/{id}/connect can open a stream.

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`), or the provider has no free machine (`cloud_capacity`) or the machine is not ready yet (the provider's code, such as `sandbox_restoring`); try again later.

Errors

StatusCodeWhen
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
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).
429rate_limit_errorToo many requests from this key in a minute
503No provider account on this Gateway (`cloud_unavailable`), or the provider has no free machine (`cloud_capacity`) or the machine is not ready yet (the provider's code, such as `sandbox_restoring`); try again later.

Example

curl
curl "$NEXUS_URL/v1/cloud/machines" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Create cloud machine

post/v1/cloud/machines

Create the cloud machine of a desktop session. Send sessionId and the session's title: a create for a session that has a live machine returns that machine. Nexus names and sizes every machine (NEXUS_CLOUD_DEFAULT_SIZE), so name and size are read and ignored. The machine starts from Nexus's image, with its own Nexus token in ~/.nexus/host/credentials; deleting the machine revokes that token. Send an Idempotency-Key: the machine's id is derived from it, so a resend names the machine the first send made, and finishes it when the provider's answer was lost. A machine that cannot start now waits in the queue (202, state queued): Gateway runs its most machines, the person runs their share (NEXUS_CLOUD_MAX_PER_PERSON), the person started 20 machines and gets one more every 5 minutes, or the provider is at its limits. The meter starts the queue oldest first. A person asks for at most 200 starts (creates and wakes) in a UTC day, and an organization's people 500 together: one more answers 429 cloud_daily_starts until 00:00 UTC (Retry-After). An organization with only the free start is on the trial: it runs one machine at a time, and all trial organizations together a few. A trial machine never waits in the queue: one more answers 429 cloud_trial_limit or cloud_trial_busy (Retry-After), which name Billing. Credits, a card or a contract lift the trial. A person keeps at most 50 machines, asleep or not: one more answers 429 cloud_machine_limit. Read the queued machine (GET) while you wait: one nobody read for 10 minutes ends, failed. Its running time is charged as cloud compute from its start.

cloud.machines.useEvery memberTry it in the API Explorer

Parameters

  • x-nexus-github-tokenheader · string

    The person's own GitHub token. With repo, Gateway asks GitHub with it whether the person may read the repository, and only then starts the machine from the organization's saved copy of it. Used for that check only, never kept.

  • Idempotency-Keyheader · string

    Send the same key again to retry safely: the request runs once. See Idempotency keys.

Request body · application/json

  • sessionIdstring

    The desktop session the machine is for (t_<uuid>). One live machine for each session. An older app sends none, and gets a new machine each time.

    pattern ^[A-Za-z0-9_-]{1,128}$

  • titlestring

    The session's title. Gateway keeps its first line, cut to 200 characters.

  • namestring

    Read and ignored: the machine's name is the session's title.

  • sizestring

    Read and ignored: Nexus sizes every machine.

  • repostring

    The repository the session clones: a URL, or a GitHub owner/name. With NEXUS_CLOUD_WARM_SNAPSHOTS on, a GitHub one starts the machine from the organization's saved copy of it, when there is one and GitHub lets the person read it (x-nexus-github-token). Anything else is ignored.

    max length 512

Responses

200The machine a send with this key made, or the live machine of this sessionapplication/json

  • idstringrequired

    cm_ and up to 64 base64url characters

  • sessionIdstring | nullrequired

    The desktop session the machine is for; null on a machine made before sessions.

  • titlestring | nullrequired

    The session's title, on one line; null when the create sent none.

  • namestringrequired

    The session's title, cut to 120 characters, or Cloud.

  • provider"boat"required
  • size"small" | "default" | "large" | "xlarge"required

    Nexus chooses it: NEXUS_CLOUD_DEFAULT_SIZE when made.

  • state"queued" | "creating" | "starting" | "ready" | "sleeping" | "stopping" | "failed" | "gone"required

    The desktop's CloudState. queued waits for a place, the person's next start or the provider; nothing runs. Running time is charged in creating, starting and ready.

  • errorstring | nullrequired

    Why it failed; null otherwise.

  • createdAtstring (date-time)required
  • sleepingSincestring (date-time) | nullrequired

    When it went to sleep; null unless sleeping.

  • stopReason"budget" | "max_run" | "not_enabled" | "idle" | "resize" | nullrequired

    Why Gateway put it to sleep: budget when its compute was refused, max_run after its longest run with no interaction (24 hours by default, from the person's last interaction, create, wake or access), not_enabled when the organization may no longer run machines, idle when nobody needs it (its agent idle 5 minutes and its person idle 20 minutes, or its host silent 15 minutes, or no report from its host in the 5 minutes after its last create, wake, access or connect), resize while it restarts one size bigger after it ran out of memory. Null otherwise, and cleared by a wake.

  • queuedUntilstring (date-time) | nullrequired

    While queued: the earliest time Gateway tries to start it (the person's next start, the provider's nextStartAt, or the meter's next pass). Null otherwise.

  • hostOnlinebooleanrequired

    The machine's host has its control connection open on this copy of Gateway: GET /v1/cloud/machines/{id}/connect can open a stream.

201Created: the machine is startingapplication/json

  • idstringrequired

    cm_ and up to 64 base64url characters

  • sessionIdstring | nullrequired

    The desktop session the machine is for; null on a machine made before sessions.

  • titlestring | nullrequired

    The session's title, on one line; null when the create sent none.

  • namestringrequired

    The session's title, cut to 120 characters, or Cloud.

  • provider"boat"required
  • size"small" | "default" | "large" | "xlarge"required

    Nexus chooses it: NEXUS_CLOUD_DEFAULT_SIZE when made.

  • state"queued" | "creating" | "starting" | "ready" | "sleeping" | "stopping" | "failed" | "gone"required

    The desktop's CloudState. queued waits for a place, the person's next start or the provider; nothing runs. Running time is charged in creating, starting and ready.

  • errorstring | nullrequired

    Why it failed; null otherwise.

  • createdAtstring (date-time)required
  • sleepingSincestring (date-time) | nullrequired

    When it went to sleep; null unless sleeping.

  • stopReason"budget" | "max_run" | "not_enabled" | "idle" | "resize" | nullrequired

    Why Gateway put it to sleep: budget when its compute was refused, max_run after its longest run with no interaction (24 hours by default, from the person's last interaction, create, wake or access), not_enabled when the organization may no longer run machines, idle when nobody needs it (its agent idle 5 minutes and its person idle 20 minutes, or its host silent 15 minutes, or no report from its host in the 5 minutes after its last create, wake, access or connect), resize while it restarts one size bigger after it ran out of memory. Null otherwise, and cleared by a wake.

  • queuedUntilstring (date-time) | nullrequired

    While queued: the earliest time Gateway tries to start it (the person's next start, the provider's nextStartAt, or the meter's next pass). Null otherwise.

  • hostOnlinebooleanrequired

    The machine's host has its control connection open on this copy of Gateway: GET /v1/cloud/machines/{id}/connect can open a stream.

202Accepted: the machine waits in the queue (`queued`, with `queuedUntil`)application/json

  • idstringrequired

    cm_ and up to 64 base64url characters

  • sessionIdstring | nullrequired

    The desktop session the machine is for; null on a machine made before sessions.

  • titlestring | nullrequired

    The session's title, on one line; null when the create sent none.

  • namestringrequired

    The session's title, cut to 120 characters, or Cloud.

  • provider"boat"required
  • size"small" | "default" | "large" | "xlarge"required

    Nexus chooses it: NEXUS_CLOUD_DEFAULT_SIZE when made.

  • state"queued" | "creating" | "starting" | "ready" | "sleeping" | "stopping" | "failed" | "gone"required

    The desktop's CloudState. queued waits for a place, the person's next start or the provider; nothing runs. Running time is charged in creating, starting and ready.

  • errorstring | nullrequired

    Why it failed; null otherwise.

  • createdAtstring (date-time)required
  • sleepingSincestring (date-time) | nullrequired

    When it went to sleep; null unless sleeping.

  • stopReason"budget" | "max_run" | "not_enabled" | "idle" | "resize" | nullrequired

    Why Gateway put it to sleep: budget when its compute was refused, max_run after its longest run with no interaction (24 hours by default, from the person's last interaction, create, wake or access), not_enabled when the organization may no longer run machines, idle when nobody needs it (its agent idle 5 minutes and its person idle 20 minutes, or its host silent 15 minutes, or no report from its host in the 5 minutes after its last create, wake, access or connect), resize while it restarts one size bigger after it ran out of memory. Null otherwise, and cleared by a wake.

  • queuedUntilstring (date-time) | nullrequired

    While queued: the earliest time Gateway tries to start it (the person's next start, the provider's nextStartAt, or the meter's next pass). Null otherwise.

  • hostOnlinebooleanrequired

    The machine's host has its control connection open on this copy of Gateway: GET /v1/cloud/machines/{id}/connect can open a stream.

400The body is not an object, or `sessionId` is not 1 to 128 letters, digits, `_` and `-` (`invalid_session_id`).

402Nothing covers 15 minutes of this machine's cloud compute (`budget_exceeded`), so no new compute starts. Nexus pays for cloud compute: it is held on the organization's Nexus balance (its subsidy, then its credits, then its contract), and on its budget. An organization past due gets `payment_past_due`. The refusal is recorded. When a running machine's next 15 minutes are refused, Gateway puts it to sleep, with `stopReason` `budget`.

403Cloud machines are not turned on for this organization (`cloud_not_enabled`). Only the organizations Nexus lists may start or use a machine; anyone may still list, sleep and delete their own.

409The create took so long that Gateway ended it (`machine_gone`); send a new one.

422This `Idempotency-Key` names another machine (`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

StatusCodeWhen
202queuedA machine that cannot start now waits in the queue (202, state `queued`): Gateway runs its most machines, the person runs their share (`NEXUS_CLOUD_MAX_PER_PERSON`), the person started 20 machines and gets one more every 5 minutes, or the provider is at its limits
400invalid_request_errorA field is missing or not valid; the message names it
400The body is not an object, or `sessionId` is not 1 to 128 letters, digits, `_` and `-` (`invalid_session_id`).
401authentication_errorNo key, or a key Gateway does not accept
402budget_exceededNothing covers 15 minutes of this machine's cloud compute (`budget_exceeded`), so no new compute starts. Nexus pays for cloud compute: it is held on the organization's Nexus balance (its subsidy, then its credits, then its contract), and on its budget. An organization past due gets `payment_past_due`. The refusal is recorded. When a running machine's next 15 minutes are refused, Gateway puts it to sleep, with `stopReason` `budget`.
403role_requiredYour role does not have this permission
409The create took so long that Gateway ended it (`machine_gone`); send a new one.
409idempotency_in_progressA request with the same Idempotency-Key is still running
409idempotency_interruptedThe first request with this Idempotency-Key was cut off and may have run in part
422This `Idempotency-Key` names another machine (`idempotency_key_reused`); send a new key.
422idempotency_key_reusedThe Idempotency-Key was used with a different request
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).
429cloud_daily_startsOne more answers 429 `cloud_daily_starts` until 00:00 UTC (`Retry-After`)
429cloud_trial_limitOne more answers 429 `cloud_trial_limit` or `cloud_trial_busy` (`Retry-After`), which name Billing
429cloud_machine_limitOne more answers 429 `cloud_machine_limit`
429rate_limit_errorToo many requests from this key in a minute
502The cloud provider failed or did not answer (`cloud_provider_error`); try again.
503No provider account on this Gateway (`cloud_unavailable`); try again later.

Example

curl
curl -X POST "$NEXUS_URL/v1/cloud/machines" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "sessionId": "<sessionId>",
    "title": "<title>",
    "name": "Platform",
    "size": "<size>",
    "repo": "<repo>"
  }'

Pair cloud server

post/v1/cloud/machines/pair

Pair your own server, so Nexus Desktop reaches it through Gateway with no SSH and no open port. nexus-host login calls this with the token its device sign-in got, and that token becomes the machine's own: only it opens the machine's host connection, and deleting the machine revokes it. It reads ready, with provider own; hostOnline says whether it answers. Nexus never starts, stops, sizes or charges it, and any organization may pair one. A second pairing with the same token answers the same machine. A person pairs at most 10 servers (409 own_servers_full).

cloud.machines.useEvery memberTry it in the API Explorer

Request body · application/json

  • namestringrequired

    The server's name for your list. Gateway keeps its first line, cut to 120 characters.

Responses

200OKapplication/json

  • idstringrequired

    cm_ and up to 64 base64url characters

  • sessionIdstring | nullrequired

    The desktop session the machine is for; null on a machine made before sessions.

  • titlestring | nullrequired

    The session's title, on one line; null when the create sent none.

  • namestringrequired

    The session's title, cut to 120 characters, or Cloud.

  • provider"boat"required
  • size"small" | "default" | "large" | "xlarge"required

    Nexus chooses it: NEXUS_CLOUD_DEFAULT_SIZE when made.

  • state"queued" | "creating" | "starting" | "ready" | "sleeping" | "stopping" | "failed" | "gone"required

    The desktop's CloudState. queued waits for a place, the person's next start or the provider; nothing runs. Running time is charged in creating, starting and ready.

  • errorstring | nullrequired

    Why it failed; null otherwise.

  • createdAtstring (date-time)required
  • sleepingSincestring (date-time) | nullrequired

    When it went to sleep; null unless sleeping.

  • stopReason"budget" | "max_run" | "not_enabled" | "idle" | "resize" | nullrequired

    Why Gateway put it to sleep: budget when its compute was refused, max_run after its longest run with no interaction (24 hours by default, from the person's last interaction, create, wake or access), not_enabled when the organization may no longer run machines, idle when nobody needs it (its agent idle 5 minutes and its person idle 20 minutes, or its host silent 15 minutes, or no report from its host in the 5 minutes after its last create, wake, access or connect), resize while it restarts one size bigger after it ran out of memory. Null otherwise, and cleared by a wake.

  • queuedUntilstring (date-time) | nullrequired

    While queued: the earliest time Gateway tries to start it (the person's next start, the provider's nextStartAt, or the meter's next pass). Null otherwise.

  • hostOnlinebooleanrequired

    The machine's host has its control connection open on this copy of Gateway: GET /v1/cloud/machines/{id}/connect can open a stream.

400The name is empty (`invalid_name`), or the token may not pair a server (`not_a_host_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.

409You have 10 servers paired already (`own_servers_full`)

503No provider account on this Gateway (`cloud_unavailable`), or the machine is not ready yet (the provider's code, such as `sandbox_restoring`); try again later.

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
400The name is empty (`invalid_name`), or the token may not pair a server (`not_a_host_token`)
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
409You have 10 servers paired already (`own_servers_full`)
409own_servers_fullA person pairs at most 10 servers (409 `own_servers_full`)
429rate_limit_errorToo many requests from this key in a minute
503No provider account on this Gateway (`cloud_unavailable`), or the machine is not ready yet (the provider's code, such as `sandbox_restoring`); try again later.

Example

curl
curl -X POST "$NEXUS_URL/v1/cloud/machines/pair" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Platform"
  }'

Get cloud machine

get/v1/cloud/machines/{id}

One of your machines, its state read from the provider. A machine the provider no longer has is gone.

cloud.machines.useEvery memberTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The machine's id (cm_…), as POST /v1/cloud/machines answered it

Responses

200OKapplication/json

  • idstringrequired

    cm_ and up to 64 base64url characters

  • sessionIdstring | nullrequired

    The desktop session the machine is for; null on a machine made before sessions.

  • titlestring | nullrequired

    The session's title, on one line; null when the create sent none.

  • namestringrequired

    The session's title, cut to 120 characters, or Cloud.

  • provider"boat"required
  • size"small" | "default" | "large" | "xlarge"required

    Nexus chooses it: NEXUS_CLOUD_DEFAULT_SIZE when made.

  • state"queued" | "creating" | "starting" | "ready" | "sleeping" | "stopping" | "failed" | "gone"required

    The desktop's CloudState. queued waits for a place, the person's next start or the provider; nothing runs. Running time is charged in creating, starting and ready.

  • errorstring | nullrequired

    Why it failed; null otherwise.

  • createdAtstring (date-time)required
  • sleepingSincestring (date-time) | nullrequired

    When it went to sleep; null unless sleeping.

  • stopReason"budget" | "max_run" | "not_enabled" | "idle" | "resize" | nullrequired

    Why Gateway put it to sleep: budget when its compute was refused, max_run after its longest run with no interaction (24 hours by default, from the person's last interaction, create, wake or access), not_enabled when the organization may no longer run machines, idle when nobody needs it (its agent idle 5 minutes and its person idle 20 minutes, or its host silent 15 minutes, or no report from its host in the 5 minutes after its last create, wake, access or connect), resize while it restarts one size bigger after it ran out of memory. Null otherwise, and cleared by a wake.

  • queuedUntilstring (date-time) | nullrequired

    While queued: the earliest time Gateway tries to start it (the person's next start, the provider's nextStartAt, or the meter's next pass). Null otherwise.

  • hostOnlinebooleanrequired

    The machine's host has its control connection open on this copy of Gateway: GET /v1/cloud/machines/{id}/connect can open a stream.

404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.

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`), or the provider has no free machine (`cloud_capacity`) or the machine is not ready yet (the provider's code, such as `sandbox_restoring`); try again later.

Errors

StatusCodeWhen
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.
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).
429rate_limit_errorToo many requests from this key in a minute
503No provider account on this Gateway (`cloud_unavailable`), or the provider has no free machine (`cloud_capacity`) or the machine is not ready yet (the provider's code, such as `sandbox_restoring`); try again later.

Example

curl
curl "$NEXUS_URL/v1/cloud/machines/<id>" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Delete cloud machine

DEL/v1/cloud/machines/{id}

Delete your machine at the provider, disk and all, and charge its running time. You may then create another.

cloud.machines.useEvery memberTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The machine's id (cm_…), as POST /v1/cloud/machines answered it

  • Idempotency-Keyheader · string

    Send the same key again to retry safely: the request runs once. See Idempotency keys.

Responses

200OKapplication/json

  • idstringrequired
  • deletedbooleanrequired

404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.

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`), or the provider has no free machine (`cloud_capacity`) or the machine is not ready yet (the provider's code, such as `sandbox_restoring`); try again later.

Errors

StatusCodeWhen
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.
409idempotency_in_progressA request with the same Idempotency-Key is still running
409idempotency_interruptedThe first request with this Idempotency-Key was cut off and may have run in part
422idempotency_key_reusedThe Idempotency-Key was used with a different request
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).
429rate_limit_errorToo many requests from this key in a minute
502The cloud provider failed or did not answer (`cloud_provider_error`); try again.
503No provider account on this Gateway (`cloud_unavailable`), or the provider has no free machine (`cloud_capacity`) or the machine is not ready yet (the provider's code, such as `sandbox_restoring`); try again later.

Example

curl
curl -X DELETE "$NEXUS_URL/v1/cloud/machines/<id>" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"

Wake cloud machine

post/v1/cloud/machines/{id}/wake

Wake your machine from its saved disk. Its address and host key change: ask for access again. Its running time is charged from now. When Gateway runs its most machines, the person woke 20 machines and gets one more wake a minute, or the provider is at its limits, the wake waits in the queue (202, state queued); the meter starts it in turn. A wake counts toward the day's starts: past them it answers 429 cloud_daily_starts. An organization with only the free start is on the trial: it runs one machine at a time, and all trial organizations together a few. A trial machine never waits in the queue: one more answers 429 cloud_trial_limit or cloud_trial_busy (Retry-After), which name Billing. Credits, a card or a contract lift the trial. A trial machine sleeps 2 hours after its wake (max_run). A run that stops in its first minute is charged a minute.

cloud.machines.useEvery memberTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The machine's id (cm_…), as POST /v1/cloud/machines answered it

  • Idempotency-Keyheader · string

    Send the same key again to retry safely: the request runs once. See Idempotency keys.

Responses

200OKapplication/json

  • idstringrequired

    cm_ and up to 64 base64url characters

  • sessionIdstring | nullrequired

    The desktop session the machine is for; null on a machine made before sessions.

  • titlestring | nullrequired

    The session's title, on one line; null when the create sent none.

  • namestringrequired

    The session's title, cut to 120 characters, or Cloud.

  • provider"boat"required
  • size"small" | "default" | "large" | "xlarge"required

    Nexus chooses it: NEXUS_CLOUD_DEFAULT_SIZE when made.

  • state"queued" | "creating" | "starting" | "ready" | "sleeping" | "stopping" | "failed" | "gone"required

    The desktop's CloudState. queued waits for a place, the person's next start or the provider; nothing runs. Running time is charged in creating, starting and ready.

  • errorstring | nullrequired

    Why it failed; null otherwise.

  • createdAtstring (date-time)required
  • sleepingSincestring (date-time) | nullrequired

    When it went to sleep; null unless sleeping.

  • stopReason"budget" | "max_run" | "not_enabled" | "idle" | "resize" | nullrequired

    Why Gateway put it to sleep: budget when its compute was refused, max_run after its longest run with no interaction (24 hours by default, from the person's last interaction, create, wake or access), not_enabled when the organization may no longer run machines, idle when nobody needs it (its agent idle 5 minutes and its person idle 20 minutes, or its host silent 15 minutes, or no report from its host in the 5 minutes after its last create, wake, access or connect), resize while it restarts one size bigger after it ran out of memory. Null otherwise, and cleared by a wake.

  • queuedUntilstring (date-time) | nullrequired

    While queued: the earliest time Gateway tries to start it (the person's next start, the provider's nextStartAt, or the meter's next pass). Null otherwise.

  • hostOnlinebooleanrequired

    The machine's host has its control connection open on this copy of Gateway: GET /v1/cloud/machines/{id}/connect can open a stream.

202Accepted: the wake waits in the queue (`queued`, with `queuedUntil`)application/json

  • idstringrequired

    cm_ and up to 64 base64url characters

  • sessionIdstring | nullrequired

    The desktop session the machine is for; null on a machine made before sessions.

  • titlestring | nullrequired

    The session's title, on one line; null when the create sent none.

  • namestringrequired

    The session's title, cut to 120 characters, or Cloud.

  • provider"boat"required
  • size"small" | "default" | "large" | "xlarge"required

    Nexus chooses it: NEXUS_CLOUD_DEFAULT_SIZE when made.

  • state"queued" | "creating" | "starting" | "ready" | "sleeping" | "stopping" | "failed" | "gone"required

    The desktop's CloudState. queued waits for a place, the person's next start or the provider; nothing runs. Running time is charged in creating, starting and ready.

  • errorstring | nullrequired

    Why it failed; null otherwise.

  • createdAtstring (date-time)required
  • sleepingSincestring (date-time) | nullrequired

    When it went to sleep; null unless sleeping.

  • stopReason"budget" | "max_run" | "not_enabled" | "idle" | "resize" | nullrequired

    Why Gateway put it to sleep: budget when its compute was refused, max_run after its longest run with no interaction (24 hours by default, from the person's last interaction, create, wake or access), not_enabled when the organization may no longer run machines, idle when nobody needs it (its agent idle 5 minutes and its person idle 20 minutes, or its host silent 15 minutes, or no report from its host in the 5 minutes after its last create, wake, access or connect), resize while it restarts one size bigger after it ran out of memory. Null otherwise, and cleared by a wake.

  • queuedUntilstring (date-time) | nullrequired

    While queued: the earliest time Gateway tries to start it (the person's next start, the provider's nextStartAt, or the meter's next pass). Null otherwise.

  • hostOnlinebooleanrequired

    The machine's host has its control connection open on this copy of Gateway: GET /v1/cloud/machines/{id}/connect can open a stream.

402Nothing covers 15 minutes of this machine's cloud compute (`budget_exceeded`), so no new compute starts. Nexus pays for cloud compute: it is held on the organization's Nexus balance (its subsidy, then its credits, then its contract), and on its budget. An organization past due gets `payment_past_due`. The refusal is recorded. When a running machine's next 15 minutes are refused, Gateway puts it to sleep, with `stopReason` `budget`.

403Cloud machines are not turned on for this organization (`cloud_not_enabled`). Only the organizations Nexus lists may start or use a machine; anyone may still list, sleep and delete their own.

404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.

409The machine slept 14 days and the provider deleted its disk (`snapshot_data_expired`): it is now `gone`.

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`), or the machine is not ready yet (the provider's code, such as `sandbox_restoring`); try again later.

Errors

StatusCodeWhen
202queuedWhen Gateway runs its most machines, the person woke 20 machines and gets one more wake a minute, or the provider is at its limits, the wake waits in the queue (202, state `queued`); the meter starts it in turn
401authentication_errorNo key, or a key Gateway does not accept
402budget_exceededNothing covers 15 minutes of this machine's cloud compute (`budget_exceeded`), so no new compute starts. Nexus pays for cloud compute: it is held on the organization's Nexus balance (its subsidy, then its credits, then its contract), and on its budget. An organization past due gets `payment_past_due`. The refusal is recorded. When a running machine's next 15 minutes are refused, Gateway puts it to sleep, with `stopReason` `budget`.
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.
409The machine slept 14 days and the provider deleted its disk (`snapshot_data_expired`): it is now `gone`.
409idempotency_in_progressA request with the same Idempotency-Key is still running
409idempotency_interruptedThe first request with this Idempotency-Key was cut off and may have run in part
422idempotency_key_reusedThe Idempotency-Key was used with a different request
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).
429cloud_daily_startsPast them it answers 429 `cloud_daily_starts`
429cloud_trial_limitOne more answers 429 `cloud_trial_limit` or `cloud_trial_busy` (`Retry-After`), which name Billing
429rate_limit_errorToo many requests from this key in a minute
502The cloud provider failed or did not answer (`cloud_provider_error`); try again.
503No provider account on this Gateway (`cloud_unavailable`), or the machine is not ready yet (the provider's code, such as `sandbox_restoring`); try again later.

Example

curl
curl -X POST "$NEXUS_URL/v1/cloud/machines/<id>/wake" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"

Sleep cloud machine

post/v1/cloud/machines/{id}/sleep

Put your machine to sleep: the provider saves its disk and frees the machine. Its running time is charged up to now. A queued wake leaves the queue, and the machine stays asleep.

cloud.machines.useEvery memberTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The machine's id (cm_…), as POST /v1/cloud/machines answered it

  • Idempotency-Keyheader · string

    Send the same key again to retry safely: the request runs once. See Idempotency keys.

Responses

200OKapplication/json

  • idstringrequired

    cm_ and up to 64 base64url characters

  • sessionIdstring | nullrequired

    The desktop session the machine is for; null on a machine made before sessions.

  • titlestring | nullrequired

    The session's title, on one line; null when the create sent none.

  • namestringrequired

    The session's title, cut to 120 characters, or Cloud.

  • provider"boat"required
  • size"small" | "default" | "large" | "xlarge"required

    Nexus chooses it: NEXUS_CLOUD_DEFAULT_SIZE when made.

  • state"queued" | "creating" | "starting" | "ready" | "sleeping" | "stopping" | "failed" | "gone"required

    The desktop's CloudState. queued waits for a place, the person's next start or the provider; nothing runs. Running time is charged in creating, starting and ready.

  • errorstring | nullrequired

    Why it failed; null otherwise.

  • createdAtstring (date-time)required
  • sleepingSincestring (date-time) | nullrequired

    When it went to sleep; null unless sleeping.

  • stopReason"budget" | "max_run" | "not_enabled" | "idle" | "resize" | nullrequired

    Why Gateway put it to sleep: budget when its compute was refused, max_run after its longest run with no interaction (24 hours by default, from the person's last interaction, create, wake or access), not_enabled when the organization may no longer run machines, idle when nobody needs it (its agent idle 5 minutes and its person idle 20 minutes, or its host silent 15 minutes, or no report from its host in the 5 minutes after its last create, wake, access or connect), resize while it restarts one size bigger after it ran out of memory. Null otherwise, and cleared by a wake.

  • queuedUntilstring (date-time) | nullrequired

    While queued: the earliest time Gateway tries to start it (the person's next start, the provider's nextStartAt, or the meter's next pass). Null otherwise.

  • hostOnlinebooleanrequired

    The machine's host has its control connection open on this copy of Gateway: GET /v1/cloud/machines/{id}/connect can open a stream.

404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.

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`), or the provider has no free machine (`cloud_capacity`) or the machine is not ready yet (the provider's code, such as `sandbox_restoring`); try again later.

Errors

StatusCodeWhen
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.
409idempotency_in_progressA request with the same Idempotency-Key is still running
409idempotency_interruptedThe first request with this Idempotency-Key was cut off and may have run in part
422idempotency_key_reusedThe Idempotency-Key was used with a different request
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).
429rate_limit_errorToo many requests from this key in a minute
502The cloud provider failed or did not answer (`cloud_provider_error`); try again.
503No provider account on this Gateway (`cloud_unavailable`), or the provider has no free machine (`cloud_capacity`) or the machine is not ready yet (the provider's code, such as `sandbox_restoring`); try again later.

Example

curl
curl -X POST "$NEXUS_URL/v1/cloud/machines/<id>/sleep" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"

Report cloud machine activity

post/v1/cloud/machines/{id}/activity

A cloud machine's heartbeat, sent by its host (nexus-host) every minute with the machine's own Nexus token (the one in ~/.nexus/host/credentials): whether its agent works, since when it is idle, the person's last interaction and the kernel's out-of-memory kill count. Gateway stores the last report. A time after now is taken as now. The report never extends the machine's longest run (NEXUS_CLOUD_MAX_RUN_HOURS, from the person's last create, wake or access). Gateway puts the machine to sleep (idle) when its agent was idle 5 minutes and its person did not interact for 20 minutes, and never while its agent works. A machine whose host sends no report for 15 minutes (or never sent one) sleeps 20 minutes after its last interaction, create, wake or access. A rise in the out-of-memory count restarts the machine one size bigger, up to large (resize).

cloud.machines.useEvery memberTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The machine's id (cm_…), as POST /v1/cloud/machines answered it

Request body · application/json

  • busybooleanrequired

    Whether an agent on the machine works now. A permission prompt counts as idle.

  • agentIdleSincestring (date-time) | null

    Since when every agent is idle; null while one works or before the first.

  • interactedAtstring (date-time) | null

    The person's last interaction with the machine's sessions; null when there is none.

  • oomKillsinteger

    How many processes the kernel killed for want of memory since the machine started (its cgroup's oom_kill, else the system's).

    min 0

Responses

200OKapplication/json

  • idstringrequired

    cm_ and up to 64 base64url characters

  • sessionIdstring | nullrequired

    The desktop session the machine is for; null on a machine made before sessions.

  • titlestring | nullrequired

    The session's title, on one line; null when the create sent none.

  • namestringrequired

    The session's title, cut to 120 characters, or Cloud.

  • provider"boat"required
  • size"small" | "default" | "large" | "xlarge"required

    Nexus chooses it: NEXUS_CLOUD_DEFAULT_SIZE when made.

  • state"queued" | "creating" | "starting" | "ready" | "sleeping" | "stopping" | "failed" | "gone"required

    The desktop's CloudState. queued waits for a place, the person's next start or the provider; nothing runs. Running time is charged in creating, starting and ready.

  • errorstring | nullrequired

    Why it failed; null otherwise.

  • createdAtstring (date-time)required
  • sleepingSincestring (date-time) | nullrequired

    When it went to sleep; null unless sleeping.

  • stopReason"budget" | "max_run" | "not_enabled" | "idle" | "resize" | nullrequired

    Why Gateway put it to sleep: budget when its compute was refused, max_run after its longest run with no interaction (24 hours by default, from the person's last interaction, create, wake or access), not_enabled when the organization may no longer run machines, idle when nobody needs it (its agent idle 5 minutes and its person idle 20 minutes, or its host silent 15 minutes, or no report from its host in the 5 minutes after its last create, wake, access or connect), resize while it restarts one size bigger after it ran out of memory. Null otherwise, and cleared by a wake.

  • queuedUntilstring (date-time) | nullrequired

    While queued: the earliest time Gateway tries to start it (the person's next start, the provider's nextStartAt, or the meter's next pass). Null otherwise.

  • hostOnlinebooleanrequired

    The machine's host has its control connection open on this copy of Gateway: GET /v1/cloud/machines/{id}/connect can open a stream.

400The body is not `{ busy, agentIdleSince, interactedAt, oomKills }`, or a time is not RFC 3339 (`invalid_time`).

403The caller's token is not this machine's own (`not_machine_token`): only the machine reports its activity.

404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.

409The provider has not made the machine yet (`machine_not_made`).

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`).

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
400The body is not `{ busy, agentIdleSince, interactedAt, oomKills }`, or a time is not RFC 3339 (`invalid_time`).
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.
409The provider has not made the machine yet (`machine_not_made`).
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).
429rate_limit_errorToo many requests from this key in a minute
503No provider account on this Gateway (`cloud_unavailable`).

Example

curl
curl -X POST "$NEXUS_URL/v1/cloud/machines/<id>/activity" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "busy": false
  }'

Cloud machine setup token

post/v1/cloud/machines/{id}/setup-token

The machine's own setup at boot (on with NEXUS_CLOUD_BOOT_SETUP). The machine's host sends the sealed grant from its cloud.json with the machine's own Nexus token. Gateway answers the repository and a GitHub App token that may only read it, for an hour at most. Gateway seals a grant only when GitHub lets the session's person read the repository and the organization's GitHub App reaches it. The grant works for one hour after the create, and ends sooner when the machine's setup is ready (setup-done). Gateway never logs the token.

cloud.machines.useEvery memberTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The machine's id (cm_…), as POST /v1/cloud/machines answered it

Request body · application/json

  • grantstringrequired

    The sealed grant from the machine's cloud.json (setup.grant). It holds no credential.

    max length 4096

Responses

200OKapplication/json

  • repostringrequired

    The repository the machine sets up (owner/name).

  • tokenstringrequired

    A GitHub App token that may only read repo, for an hour at most. Keep it in memory only.

400The body is not `{ grant }`.

403The caller's token is not this machine's own (`not_machine_token`), or the grant is not this machine's, ran out, or the setup is off (`setup_grant_refused`). The app clones the repository instead.

404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.

409The organization's GitHub App no longer reaches the repository (`github_app_not_installed`), or the provider has not made the machine yet (`machine_not_made`).

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.

502GitHub gave no token (`github_unavailable`). Try again.

503No provider account on this Gateway (`cloud_unavailable`).

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
400The body is not `{ grant }`.
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.
409The organization's GitHub App no longer reaches the repository (`github_app_not_installed`), or the provider has not made the machine yet (`machine_not_made`).
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).
429rate_limit_errorToo many requests from this key in a minute
502GitHub gave no token (`github_unavailable`). Try again.
503No provider account on this Gateway (`cloud_unavailable`).

Example

curl
curl -X POST "$NEXUS_URL/v1/cloud/machines/<id>/setup-token" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "grant": "<grant>"
  }'

Cloud machine setup done

post/v1/cloud/machines/{id}/setup-done

The machine's own setup at boot is ready. The machine's host sends the sealed grant from its cloud.json with the machine's own Nexus token, and Gateway ends the grant: no setup token is given for the machine again. A repeat is fine.

cloud.machines.useEvery memberTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The machine's id (cm_…), as POST /v1/cloud/machines answered it

Request body · application/json

  • grantstringrequired

    The sealed grant from the machine's cloud.json (setup.grant). It holds no credential.

    max length 4096

Responses

200OKapplication/json

  • endedbooleanrequired

    True: the grant ended, and no setup token is given for the machine again.

400The body is not `{ grant }`.

403The caller's token is not this machine's own (`not_machine_token`), or the grant is not this machine's, ran out, or the setup is off (`setup_grant_refused`). The app clones the repository instead.

404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.

409The provider has not made the machine yet (`machine_not_made`).

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`).

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
400The body is not `{ grant }`.
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.
409The provider has not made the machine yet (`machine_not_made`).
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).
429rate_limit_errorToo many requests from this key in a minute
503No provider account on this Gateway (`cloud_unavailable`).

Example

curl
curl -X POST "$NEXUS_URL/v1/cloud/machines/<id>/setup-done" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "grant": "<grant>"
  }'

Cloud machine access

post/v1/cloud/machines/{id}/access

Add this device's SSH public key to your machine. Answers where to connect and the host key to pin. Both change on every wake. An access with the machine's own Nexus token does not count as the person's activity.

cloud.machines.useEvery memberTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The machine's id (cm_…), as POST /v1/cloud/machines answered it

  • Idempotency-Keyheader · string

    Send the same key again to retry safely: the request runs once. See Idempotency keys.

Request body · application/json

  • publicKeystringrequired

    One SSH public key line, such as ssh-ed25519 AAAA….

    max length 4096

Responses

200OKapplication/json

  • hoststringrequired
  • portintegerrequired

    min 1 · max 65535

  • userstringrequired
  • hostKeystringrequired

    The machine's SSH host key, to pin.

400`publicKey` is not one SSH public key line (`invalid_ssh_key`), or the machine is not running (`machine_not_running`).

403Cloud machines are not turned on for this organization (`cloud_not_enabled`). Only the organizations Nexus lists may start or use a machine; anyone may still list, sleep and delete their own.

404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.

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`), or the provider has no free machine (`cloud_capacity`) or the machine is not ready yet (the provider's code, such as `sandbox_restoring`); try again later.

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
400`publicKey` is not one SSH public key line (`invalid_ssh_key`), or the machine is not running (`machine_not_running`).
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.
409idempotency_in_progressA request with the same Idempotency-Key is still running
409idempotency_interruptedThe first request with this Idempotency-Key was cut off and may have run in part
422idempotency_key_reusedThe Idempotency-Key was used with a different request
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).
429rate_limit_errorToo many requests from this key in a minute
502The cloud provider failed or did not answer (`cloud_provider_error`); try again.
503No provider account on this Gateway (`cloud_unavailable`), or the provider has no free machine (`cloud_capacity`) or the machine is not ready yet (the provider's code, such as `sandbox_restoring`); try again later.

Example

curl
curl -X POST "$NEXUS_URL/v1/cloud/machines/<id>/access" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "publicKey": "<publicKey>"
  }'

Cloud machine connect

get/v1/cloud/machines/{id}/connect

A stream to your machine's host, a WebSocket, with your Gateway token: the desktop app's connection to its cloud session, with no SSH. Gateway asks the host to open its side and joins the two. Each text and binary frame and the close pass on as they came. Gateway reads and stores no frame. A frame is at most 16 MiB. Gateway pings every 20 seconds. When the host does not open its side within 10 seconds, the stream closes with 1013 (try again later); when Gateway stops, with 1012. A joined stream counts as an interaction, as an access does. Gateway holds the streams in memory, on one copy.

cloud.machines.useEvery memberTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The machine's id (cm_…), as POST /v1/cloud/machines answered it

  • Upgradeheader · "websocket"required

    A WebSocket upgrade (RFC 6455).

Responses

101Switching Protocols: Gateway asks the host to open its side.

400The request is not a WebSocket upgrade (`websocket_required`).

403Cloud machines are not turned on for this organization (`cloud_not_enabled`).

404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.

409The machine's host is not connected (`host_offline`): it is asleep or still starting. Wake it, or try again after `Retry-After` seconds.

429The machine has its most streams open, 8 (`too_many_streams`): close one first. Also over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds.

503No provider account on this Gateway (`cloud_unavailable`). Also `machine_not_ready`: the provider has not made the machine yet.

Errors

StatusCodeWhen
400The request is not a WebSocket upgrade (`websocket_required`).
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.
409The machine's host is not connected (`host_offline`): it is asleep or still starting. Wake it, or try again after `Retry-After` seconds.
429The machine has its most streams open, 8 (`too_many_streams`): close one first. Also over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds.
429rate_limit_errorToo many requests from this key in a minute
503No provider account on this Gateway (`cloud_unavailable`). Also `machine_not_ready`: the provider has not made the machine yet.

Example

curl
curl "$NEXUS_URL/v1/cloud/machines/<id>/connect" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Cloud machine host

get/v1/cloud/machines/{id}/host

The control connection of a cloud machine's host (nexus-host), a WebSocket, with the machine's own Nexus token (the one in ~/.nexus/host/credentials). Gateway sends it a text frame {"type":"open","stream":"<id>"} for each app stream, and the host opens that stream within 10 seconds (GET /v1/cloud/machines/{id}/host/streams/{stream}). The host sends nothing but pings. One per machine: a new one closes the old one (close code 1000, replaced). Gateway pings every 20 seconds and closes with 1012 when it stops. While it is open, the machine's hostOnline is true.

cloud.machines.useEvery memberTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The machine's id (cm_…), as POST /v1/cloud/machines answered it

  • Upgradeheader · "websocket"required

    A WebSocket upgrade (RFC 6455).

Responses

101Switching Protocols: the control connection is open.

400The request is not a WebSocket upgrade (`websocket_required`).

403The caller's token is not this machine's own (`not_machine_token`): only the machine's host opens it.

404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.

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`).

Errors

StatusCodeWhen
100replacedA new one closes the old one (close code 1000, `replaced`)
400The request is not a WebSocket upgrade (`websocket_required`).
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.
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).
429rate_limit_errorToo many requests from this key in a minute
503No provider account on this Gateway (`cloud_unavailable`).

Example

curl
curl "$NEXUS_URL/v1/cloud/machines/<id>/host" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Cloud machine host stream

get/v1/cloud/machines/{id}/host/streams/{stream}

A stream from a cloud machine's host, a WebSocket, with the machine's own Nexus token: the answer to an open frame of its control connection. Gateway joins it to the app that waits, and passes each text and binary frame and the close on as they came. Gateway reads and stores no frame. A frame is at most 16 MiB.

cloud.machines.useEvery memberTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The machine's id (cm_…), as POST /v1/cloud/machines answered it

  • streampath · stringrequired

    The stream's id, from the control connection's open frame

  • Upgradeheader · "websocket"required

    A WebSocket upgrade (RFC 6455).

Responses

101Switching Protocols: the stream is joined to the app's.

400The request is not a WebSocket upgrade (`websocket_required`).

403The caller's token is not this machine's own (`not_machine_token`): only the machine's host opens it.

404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one. Also `no_such_stream`: no app waits for this stream (it gave up after 10 seconds, or the id is another machine's).

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`).

Errors

StatusCodeWhen
400The request is not a WebSocket upgrade (`websocket_required`).
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one. Also `no_such_stream`: no app waits for this stream (it gave up after 10 seconds, or the id is another machine's).
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).
429rate_limit_errorToo many requests from this key in a minute
503No provider account on this Gateway (`cloud_unavailable`).

Example

curl
curl "$NEXUS_URL/v1/cloud/machines/<id>/host/streams/<stream>" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
post/v1/cloud/machines/{id}/links

A private link to a port on your machine ({kind: "port", port}, until it sleeps), or to its desktop stream ({kind: "desktop"}, for 10 minutes). On the cloud trial, a port link answers 403 cloud_trial_no_links.

cloud.machines.useEvery memberTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The machine's id (cm_…), as POST /v1/cloud/machines answered it

  • Idempotency-Keyheader · string

    Send the same key again to retry safely: the request runs once. See Idempotency keys.

Request body · application/json

  • kind"port" | "desktop"required
  • portinteger

    Required with kind: port.

    min 1 · max 65535

Responses

200OKapplication/json

  • urlstring (uri)required
  • expiresAtstring (date-time) | nullrequired

    When the link stops working; null when it lasts until the machine sleeps.

400`kind` or `port` is not valid (`invalid_port`: 1 to 65535, not 22, 6080, 8090, 8911 or 47984 to 48010).

403Cloud machines are not turned on for this organization (`cloud_not_enabled`). Only the organizations Nexus lists may start or use a machine; anyone may still list, sleep and delete their own.

404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.

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`), or the provider has no free machine (`cloud_capacity`) or the machine is not ready yet (the provider's code, such as `sandbox_restoring`); try again later.

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
400`kind` or `port` is not valid (`invalid_port`: 1 to 65535, not 22, 6080, 8090, 8911 or 47984 to 48010).
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
403cloud_trial_no_linksOn the cloud trial, a port link answers 403 `cloud_trial_no_links`
404not_foundNothing matches the path in your organization
404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.
409idempotency_in_progressA request with the same Idempotency-Key is still running
409idempotency_interruptedThe first request with this Idempotency-Key was cut off and may have run in part
422idempotency_key_reusedThe Idempotency-Key was used with a different request
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).
429rate_limit_errorToo many requests from this key in a minute
502The cloud provider failed or did not answer (`cloud_provider_error`); try again.
503No provider account on this Gateway (`cloud_unavailable`), or the provider has no free machine (`cloud_capacity`) or the machine is not ready yet (the provider's code, such as `sandbox_restoring`); try again later.

Example

curl
curl -X POST "$NEXUS_URL/v1/cloud/machines/<id>/links" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "kind": "port"
  }'

Cloud machine sleep key

post/v1/cloud/machines/{id}/sleep-key

A provider key that may only read and stop this one machine, for the machine's own idle timer, with the provider API it calls and the machine's id there. Gateway makes it once and keeps it sealed with the machine: each call answers the same key, a new one is made only when the provider no longer takes the old one, and the key is revoked when the machine is deleted. key is null when the provider refuses to make one. It is the only provider key that leaves Gateway.

cloud.machines.useEvery memberTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The machine's id (cm_…), as POST /v1/cloud/machines answered it

  • Idempotency-Keyheader · string

    Send the same key again to retry safely: the request runs once. See Idempotency keys.

Responses

200OKapplication/json

  • keystring | nullrequired

    A provider key that may only read and stop this machine; null when the provider refused.

  • apiUrlstring (uri)required

    The provider API the key calls.

  • providerIdstringrequired

    The machine's id at the provider.

403Cloud machines are not turned on for this organization (`cloud_not_enabled`). Only the organizations Nexus lists may start or use a machine; anyone may still list, sleep and delete their own.

404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.

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`), or the provider has no free machine (`cloud_capacity`) or the machine is not ready yet (the provider's code, such as `sandbox_restoring`); try again later.

Errors

StatusCodeWhen
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.
409idempotency_in_progressA request with the same Idempotency-Key is still running
409idempotency_interruptedThe first request with this Idempotency-Key was cut off and may have run in part
422idempotency_key_reusedThe Idempotency-Key was used with a different request
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).
429rate_limit_errorToo many requests from this key in a minute
502The cloud provider failed or did not answer (`cloud_provider_error`); try again.
503No provider account on this Gateway (`cloud_unavailable`), or the provider has no free machine (`cloud_capacity`) or the machine is not ready yet (the provider's code, such as `sandbox_restoring`); try again later.

Example

curl
curl -X POST "$NEXUS_URL/v1/cloud/machines/<id>/sleep-key" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"

List cloud history threads

get/v1/cloud/machines/{id}/history

The machine's workbench threads that have stored history, most recently updated first, at most 500, with each one's stored range. The machine's owner reads it, and so does the machine's own Nexus token, which backfills after the last stored event when it wakes. enabled is false, with no threads, while the organization's cloudHistory is off.

cloud.machines.useEvery memberTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The machine's id (cm_…), as POST /v1/cloud/machines answered it

Responses

200OKapplication/json

  • machineIdstringrequired
  • enabledbooleanrequired

    The organization's cloudHistory

  • threadsarray of CloudHistoryThreadrequired
    • threadIdstringrequired
    • firstSeqintegerrequired

      The first stored event's number

    • lastSeqintegerrequired

      The last stored event's number: every number from firstSeq to it is stored

    • lastEventAtintegerrequired

      The machine's time of the last event, in milliseconds since 1970

    • updatedAtstring (date-time)required

404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.

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.

Errors

StatusCodeWhen
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.
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).
429rate_limit_errorToo many requests from this key in a minute

Example

curl
curl "$NEXUS_URL/v1/cloud/machines/<id>/history" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Delete cloud history thread

DEL/v1/cloud/machines/{id}/history/{threadId}

Deletes a thread's stored history, as the workbench deleted or archived the thread. The machine's owner or its own Nexus token. A repeat changes nothing.

cloud.machines.useEvery memberTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The machine's id (cm_…), as POST /v1/cloud/machines answered it

  • threadIdpath · stringrequired

    The workbench thread id on the machine: the session's sessionId (t_…) for its main thread

Responses

200OKapplication/json

  • machineIdstringrequired
  • threadIdstringrequired
  • deletedbooleanrequired

400The thread id is not 1 to 128 letters, digits, `_` and `-` (`invalid_request`).

404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.

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.

Errors

StatusCodeWhen
400The thread id is not 1 to 128 letters, digits, `_` and `-` (`invalid_request`).
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.
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).
429rate_limit_errorToo many requests from this key in a minute

Example

curl
curl -X DELETE "$NEXUS_URL/v1/cloud/machines/<id>/history/<threadId>" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

List cloud history events

get/v1/cloud/machines/{id}/history/{threadId}/events

A page of a thread's stored events, in number order, for the machine's owner only. Without after or before, the page is the thread's latest events. With before, it ends just before that event; with after, it starts just after it. A page holds at most limit events and about 4 MiB of bodies after its first event. An event whose body was over the per-event cap (256 KiB) has a null body and its size in omittedBytes. A thread with nothing stored answers no events and null numbers. While the organization's cloudHistory is off, enabled is false and there are no events.

cloud.machines.useEvery memberTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The machine's id (cm_…), as POST /v1/cloud/machines answered it

  • threadIdpath · stringrequired

    The workbench thread id on the machine: the session's sessionId (t_…) for its main thread

  • afterquery · integer

    Start just after this event number

  • beforequery · integer

    End just before this event number; not with after

  • limitquery · integer

    The most events a page holds

Responses

200OKapplication/json

  • machineIdstringrequired
  • threadIdstringrequired
  • enabledbooleanrequired

    The organization's cloudHistory

  • firstSeqinteger | nullrequired

    The first stored event's number; null when none is stored

  • lastSeqinteger | nullrequired

    The last stored event's number; null when none is stored

  • eventsarray of CloudHistoryEventrequired
    • seqintegerrequired

      The machine's workbench event number

      min 1

    • atintegerrequired

      The machine's time of the event, in milliseconds since 1970

    • bodystring | nullrequired

      The workbench event's JSON text, as the machine sent it; null when it was over the per-event cap

    • omittedBytesinteger

      The size of a body over the per-event cap; absent when body is there

      min 0

400`after` with `before`, a number that is not a whole number, a `limit` outside 1 to 500, or a bad thread id (`invalid_request`).

404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.

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.

Errors

StatusCodeWhen
256bodyAn event whose body was over the per-event cap (256 KiB) has a null `body` and its size in `omittedBytes`
400invalid_request_errorA field is missing or not valid; the message names it
400`after` with `before`, a number that is not a whole number, a `limit` outside 1 to 500, or a bad thread id (`invalid_request`).
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.
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).
429rate_limit_errorToo many requests from this key in a minute

Example

curl
curl "$NEXUS_URL/v1/cloud/machines/<id>/history/<threadId>/events" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Append cloud history events

post/v1/cloud/machines/{id}/history/{threadId}/events

Stores a thread's next events, sent by the machine's host (nexus-host) with the machine's own Nexus token as its workbench log appends them. 1 to 64 events with consecutive numbers. The first is at most one past the last stored, or 1 for a new thread. An event already stored must come back identical, so a retried batch never duplicates. All or nothing. A body over 256 KiB is stored as omitted, with its size, and never refused. While the organization's cloudHistory is off, nothing is stored and enabled is false.

cloud.machines.useEvery memberTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The machine's id (cm_…), as POST /v1/cloud/machines answered it

  • threadIdpath · stringrequired

    The workbench thread id on the machine: the session's sessionId (t_…) for its main thread

Request body · application/json

  • eventsarray of objectrequired

    at most 64 items

    • seqintegerrequired

      min 1

    • atintegerrequired

      Milliseconds since 1970

      min 0

    • bodystring

      The workbench event's JSON text

    • omittedBytesinteger

      Instead of body: the host dropped a body over the per-event cap, of this size

      min 0

Responses

200OKapplication/json

  • machineIdstringrequired
  • threadIdstringrequired
  • enabledbooleanrequired

    The organization's cloudHistory; false, and nothing was stored

  • lastSeqinteger | nullrequired

    The last stored event's number: send the next one after it; null when nothing is stored

  • appendedintegerrequired

    How many events this call stored

    min 0

400No events, more than 64, numbers that are not consecutive or under 1, a bad time, a body that is not JSON, or an event with both or neither of `body` and `omittedBytes` (`invalid_request`).

403The caller's token is not this machine's own (`not_machine_token`): only the machine sends its history.

404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.

409The first event is past the next one Gateway expects (`seq_gap`): read listCloudHistoryThreads and send from its `lastSeq` + 1. Or an event already stored differs from the one sent (`event_conflict`).

413The person's cloud history in this organization holds its cap (`cloud_history_full`), or the body is over 1 MB.

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.

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
400No events, more than 64, numbers that are not consecutive or under 1, a bad time, a body that is not JSON, or an event with both or neither of `body` and `omittedBytes` (`invalid_request`).
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
404No such machine of yours: another person's machine, another organization's and a deleted one are as absent as a missing one.
409The first event is past the next one Gateway expects (`seq_gap`): read listCloudHistoryThreads and send from its `lastSeq` + 1. Or an event already stored differs from the one sent (`event_conflict`).
413The person's cloud history in this organization holds its cap (`cloud_history_full`), or the body is over 1 MB.
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).
429rate_limit_errorToo many requests from this key in a minute

Example

curl
curl -X POST "$NEXUS_URL/v1/cloud/machines/<id>/history/<threadId>/events" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "events": [
      {
        "seq": 1,
        "at": 0
      }
    ]
  }'