Skip to main content

opencode-dashboard-server

FastAPI aggregation backend for the opencode-dashboard project. Reads opencode's local SQLite storage via the opencode db CLI and exposes a JSON + SSE API for the dashboard front end.

Install (PyPI)

pip install opencode-dashboard-server

Requires:

  • Python ≥ 3.10
  • opencode CLI on the same host — the server shells out to opencode db "<SQL>" and never opens the SQLite file directly (it's WAL-mode and actively written while opencode runs).

Quick start

Run one aggregator per opencode host:

uvicorn app:app --port 8791

Run on more hosts with different ports (8792, 8793, …) and list each in the front end's dashboard.yaml. Environment switches:

  • DASHBOARD_CORS_ORIGINS — comma-separated CORS allow-list (defaults to the loopback dev origins localhost/127.0.0.1:5173 and :4173; tighten or widen for your deployment).
  • DASHBOARD_POLL_SECONDS — SSE poll interval in seconds (default 5).
  • OPENCODE_BIN — path to the opencode binary if it's not on PATH.

API

  • GET /health — liveness
  • GET /overview — whole-host aggregate (tokens by type + cost, session counts, updatedAt)
  • GET /projects — per-project rollups
  • GET /projects/{id} — one project's sessions (parent/child tree)
  • GET /sessions/{id} — per-model breakdown for one session (handles mid-conversation model switches)
  • GET /stream — SSE: updated events when the DB changes (polled ~5s)

JSON is camelCase, timestamps are epoch-ms. Full contract in the repo's API.md.

From source (development)

git clone https://github.com/GCS-ZHN/opencode-dashboard
cd opencode-dashboard/server
uv sync          # install deps (fastapi, uvicorn) + dev (pytest, httpx)
uv run pytest    # run tests
uvx ruff check . # lint

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opencode_dashboard_server-0.2.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opencode_dashboard_server-0.2.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file opencode_dashboard_server-0.2.0.tar.gz.

File metadata

File hashes

Hashes for opencode_dashboard_server-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9191706edc012b3f5ddc9095190020d59c83a329555fb310ba6e098534893a5e
MD5 bb0ff7c912fd659aca9cfcb5f6e28ab1
BLAKE2b-256 cf4313f42b30156e213e8bd426b2c42350e51da71d3b0a12affae3670b52cb92

See more details on using hashes here.

File details

Details for the file opencode_dashboard_server-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for opencode_dashboard_server-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eedadd87e34e55414d18a9c649e32c11df8d0bbc7be2cf0ba2a6c2bb69131f3a
MD5 00176454c52bc1c4d8e74a354064b88a
BLAKE2b-256 278d9aa0b5600d218c82926a6c14bf0811ac50ee41d8b6fcbb10fef84f9ddc67

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page