Skip to content

Compute API

Use https://rsibox.ai/compute as the base URL for sandbox, run, exec, network, and file requests. These routes follow Breadboard’s versioned HTTP contract and native resource IDs. Account, project, billing, and price endpoints live under https://rsibox.ai/v1.

Authenticate with Authorization: Bearer … (API key or CLI session token); browser sessions can also call from the console’s origin. Set X-Breadboard-Project to an RSI project slug. A project-scoped API key defaults to its bound project; other credentials default to default. If the project has no compute backend enabled, requests return 409 project_not_provisioned.

The rsibox CLI and Python SDK target this base URL automatically, using RSIBOX_API_KEY and --project / RSIBOX_PROJECT. See the CLI quickstart, Authentication, Project selection, and Python SDK.

Pass short catalog names such as rtx5080 or rtxpro6000maxq (the suffix of the gpu.* SKUs from GET /v1/prices).

export RSIBOX_PROJECT=default
rsi box create --accelerator rtx5080 --network none --life 5m
from rsibox import RsiboxClient
client = RsiboxClient()
sandbox = client.create_sandbox({
"accelerator": {"model": "rtx5080", "count": 1},
"network": "none",
"life": "5m",
})

The gateway resolves the short name against the project’s current GPU inventory and returns short names in create, get, and list responses. If no matching model is available to the project, creation returns 409 gpu_unavailable. When matching cards exist but are busy, the sandbox queues until capacity frees up.

GPU resolution is saved with the admitted request, so retrying with the same Idempotency-Key preserves the original model even if inventory changes.

GPU Boxes also have proportional CPU, memory, and disk limits: requesting N of a machine’s M cards permits at most N/M of each advertised resource. Memory uses memory_limit_mb when set. An oversized request returns 400 gpu_resource_ratio_exceeded, with allowed configurations in error.detail and structured amounts in error.details. Change the configuration before retrying; see GPU resource limit errors.

Sandbox responses include hardware (null until placed on a node). To request the same machine shape again, pass its profile:

first = client.get_sandbox(sandbox_id) # once running
profile = first["hardware"]["profile"] # e.g. "hw_3fa91c07"
again = client.create_sandbox({
"cpu": {"vcpus": 8, "memory_mb": 32768},
"hardware": {"profile": profile},
"life": "30m",
})

hardware also accepts exact cpu_model, cpu_sockets, memory_channels, and memory_speed_mhz. See Hardware for field details, matching rules, and 409 hardware_unavailable. Like GPU resolution, hardware placement is resolved once and saved with the admitted request.

New Boxes reserve dedicated host CPU cores by default (cpu.exclusive: true). Set cpu.exclusive: false to use shared CPUs explicitly. An omitted or null value selects the exclusive default. The returned spec.cpu.exclusive reports the actual mode, including for older shared Boxes. Requests queue when there are not enough free cores; existing Boxes keep their CPU mode.

Retries of requests admitted before this default changed keep their original CPU mode and payload. To change modes, submit a new request with a new Idempotency-Key.

curl -sS https://rsibox.ai/compute/v1/sandboxes \
-H "Authorization: Bearer $RSIBOX_API_KEY" \
-H 'X-Breadboard-Project: default' \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: training-0001' \
-d '{"name":"training","spec":{"runtime":"sandbox-vm","cpu":{"vcpus":2,"memory_mb":4096},"disk_mb":20480,"network":"none","life":"30m"}}'

A successful create returns the native sandbox record; use its id for subsequent /compute calls. The same sandbox appears under its billing ID (sbx_…) in /v1/boxes, sharing the organization’s credits, prices, limits, and lifetime cap. Optional cpu.memory_limit_mb reserves and bills memory up to that ceiling (max 524288); 0 or omission fixes the ceiling at memory_mb. JSON request bodies are capped at 2 MiB (413 body_too_large).

Idempotency and retry rules:

  • Retry a create with the same project, Idempotency-Key, and request body to recover the original sandbox.
  • Reusing a key with a different request returns 409 idempotency_conflict.
  • Replaying a key after its sandbox leaves backend retention returns 410 sandbox_gone.
  • A failed create is resubmitted only within 10 minutes of the original request. Afterward, replaying the key returns the sandbox if the backend accepted it, or 409 create_failed (send a new key to start again).
  • POST /v1/sandboxes/{id}/exec also accepts a project-scoped Idempotency-Key.

Every error response sets X-BB-Error-Code and X-Request-Id and returns {"error":{"code":"…","detail":"…"}} (exposed by the Python SDK as RsiboxAPIError with status, code, detail, and request_id). A 429, 502, or 503 invites an automatic retry only when it includes Retry-After — specifically transient compute_error, create_pending, and service_busy. Limit and configuration errors (sandbox_limit_reached, accelerator_limit_reached, cpu_limit_reached, memory_limit_reached, node_pool_sync_pending, pricing_unavailable, compute_unavailable) and 504 compute_timeout do not set Retry-After (for 503 node_pool_sync_pending, an administrator must retry saving the org/project machine pool). The CLI and SDK follow this rule automatically.

Method Path under /compute Result
GET /healthz Availability and supported hosted features
POST /v1/sandboxes Admit a priced sandbox VM
GET /v1/sandboxes, /v1/runs Paginated project resources
GET /v1/sandboxes/{id} Current sandbox record
GET /v1/sandboxes/{id}/events Lifecycle state changes and public reason codes
GET /v1/sandboxes/{id}/gpu Latest per-GPU utilization and VRAM; quota is always null
GET /v1/sandboxes/{id}/wait Bounded long-poll for a lifecycle state change
POST /v1/sandboxes/{id}/network Update guest egress and optionally wait for confirmation
POST /v1/sandboxes/{id}/stop Stop the sandbox
POST /v1/sandboxes/{id}/exec Submit a command vector; returns exec_id and run_id
GET /v1/execs/{id} Execution state and exit code (optional wait_s, 0–25, default 0)
GET /v1/execs/{id}/output Resumable stdout and stderr with output_complete
GET /v1/sandboxes/{id}/runs, /v1/runs/{id} Run history and details
GET /v1/runs/{id}/logs Paginated stdout or stderr stream
POST /v1/sandboxes/{id}/files Stream a multipart file upload; returns size and sha256
GET /v1/sandboxes/{id}/files Stream a file download with a trailing integrity receipt

Lists: GET /v1/sandboxes and GET /v1/runs return live records in the selected project. Both accept limit (1–200, default 50), cursor, and state. Sandbox lists also accept runtime=sandbox-vm and repeated state filters. Pass next_cursor back as cursor with the same project and filters until next_cursor is null; intermediate pages may be short or empty. For history beyond backend retention, use /v1/boxes.

Exec and logs: Send {"cmd":["echo","hello"]} with optional cwd, env, user, and timeout_s. Poll GET /v1/execs/{id} with optional wait_s (0–25, default 0), or poll GET /v1/execs/{id}/output with stdout_since, stderr_since, and wait_s (0–25, default 0). Advance both next_since cursors before checking output_complete. Run logs (GET /v1/runs/{id}/logs) take stream (stdout or stderr), since, and wait_s (0–25, default 0).

Startup wait: Call GET /v1/sandboxes/{id}/wait?while_state=queued&wait_s=25 with the last observed state (wait_s accepts 0–25, default 25). Returns the current sandbox record even on timeout, including state_reason_code and state_reason from the public reason codes. Loop until running or a terminal state.

Network updates: Send {"network":"none","allowed_hosts":[]} or {"network":"gateway","allowed_hosts":[...]} to POST /v1/sandboxes/{id}/network?wait_s=25 (wait_s accepts 0–25, default 0). With wait_s > 0, the call waits for node confirmation and returns 504 compute_timeout if confirmation does not arrive in time. With wait_s=0, the switch is queued asynchronously. The same public-hostname allowlist rules used at creation apply.

File uploads: Send multipart/form-data with a file part and X-BB-File-Path relative to the guest root (for example tmp/example.bin, not /tmp/example.bin). Optional headers: X-BB-File-Mode (decimal 0–511), X-BB-File-Size, and X-BB-File-SHA256. Verify the returned size and sha256 against the source. Absolute paths, Windows drive paths, and escaping .. segments return 400 invalid_request.

File downloads: Use rsi box download SANDBOX_ID tmp/example.bin ./example.bin or the Python SDK’s get_file. The HTTP endpoint takes ?path=tmp/example.bin (relative to the guest root) and returns multipart/mixed: first the file bytes, then a JSON {"size":…,"sha256":"…"} receipt emitted only after transfer succeeds. Verify byte count, SHA-256, and complete multipart framing before accepting the file.

Creation supports fixed vCPU, memory, disk, priced GPUs, exact hardware requests, lifetime limits, and gateway or none networking. GPUs are fixed at creation (allow_gpu_dynamic_allocation: true returns 400). Under gateway networking, allowed_hosts restricts egress to public DNS names (empty list or * allows general public egress; private/internal names return 400).

An explicit spec.life above the team’s maximum returns 400 with error.code: "life_limit_exceeded"; a duration above what current credits can pay for returns 402 with error.code: "insufficient_credits". Creation is refused and error.detail gives the allowed duration. Omitted spec.life uses the smaller of the team limit and affordable duration. Accepted requests retain their original lifetime on retry.

SSH relays, research-data capability tokens, custom streams, project secrets, host exports, node selection, and resizing are not part of the hosted compute API.