Cascadedocs

API reference

API overview and auth

Everything the UI does goes through this HTTP API. It serves JSON over the app's URL, the one Get started opens, which cascade deploy prints as app:.

Every response on these pages was captured from a running server, by landing/docs-src/capture_examples.py. The sims in that run replayed a recorded Accel-Sim log of BabelStream on an RTX 3070, so the cycles, IPC and kernel names come from that log, not from the uploaded trace. That's also why a finished sim shows kernels_done 6 against kernels_total 4: the log has six kernels and the uploaded trace has four. Long lists and maps are trimmed, and each cut is marked with a /* ... trimmed */ comment.

Base URL#

The samples read the app's URL and your token from the environment.

bash
export CASCADE_URL=https://<your-app>
export CASCADE_TOKEN=<your token>

Locally, the app's URL is http://127.0.0.1:8000.

Authentication#

Send the token the app was started with as a bearer token on every request.

bash
curl -H "Authorization: Bearer $CASCADE_TOKEN" "$CASCADE_URL/api/traces"

A missing or wrong token gets 401 with a WWW-Authenticate: Bearer header. Two routes differ.

There is one token per app, shared by the UI, the profiler and every sim. The app compares it in constant time.

Conventions#

Routes#

methodpathwhat it does
GET/api/healthLiveness check. Needs no token.
GET/api/tracesEvery trace, newest first.
GET/api/traces/{trace_id}One trace with its metadata and kernels.
GET/api/gpu-configsThe GPU configs a run can use.
POST/api/runsLaunch sims for a ready trace.
GET/api/runsEvery run, newest first.
GET/api/runs/{run_id}One run with its trace and every sim.
POST/api/runs/{run_id}/cancelCancel every unfinished sim.
GET/api/runs/{run_id}/comparisonPer-kernel real time against simulated time per config.
GET/api/runs/{run_id}/kernelsEvery sim's per-kernel stats, without the full stats maps.
GET/api/runs/{run_id}/step-timelinesEach sim's predicted step timeline and its comparison with the real run.
GET/api/runs/{run_id}/resultsOne JSON file with the run, trace, every sim's stats and the comparison.
GET/api/sims/{sim_id}/resultsOne sim's config, per-kernel stats and totals.
GET/api/sims/{sim_id}/logThe sim's full raw output.
GET/api/runs/{run_id}/filesEvery output file the run's sims uploaded.
GET/api/runs/{run_id}/perfettoThe run's simulated kernels as a Chrome trace JSON for ui.perfetto.dev.
GET/api/sims/{sim_id}/filesThe output files one sim uploaded.
GET/api/sims/{sim_id}/files/{name}One output file, as the sim uploaded it.
GET/api/runs/{run_id}/eventsServer-sent events for one run.
POST/api/sims/{sim_id}/heartbeatReport a sim's state. The reply says whether to stop.
POST/api/sims/{sim_id}/logsAppend a chunk of simulator output.
POST/api/sims/{sim_id}/step-timelineStore a sim's predicted step timeline and its comparison.
PUT/api/sims/{sim_id}/files/{name}Store one of the simulator's output files.

Any other path under /api/ returns 404 with {"detail": "Not Found"}, without checking the token. Paths outside /api/ serve the web UI.

Check health#

GET/api/healthno auth

Returns {"ok": true, "auth": true, "workspace": ...} while the app process is serving requests. auth is false only when the app runs with CASCADE_NO_AUTH=1, a local-dev mode where no token is needed and the web UI skips its token screen. workspace is CASCADE_WORKSPACE, the name the web UI shows in its rail, or null. Health does not check the database, the S3 endpoint or the launcher.

Returns#

200 with {"ok": true, "auth": true, "workspace": "<name or null>"}.

Example#

bash
curl "$CASCADE_URL/api/health"
Response · 200 OK · application/json
{
  "ok": true,
  "auth": true,
  "workspace": "acme-lab",
  "s3_endpoint": "http://127.0.0.1:9020"
}