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
# or with uv:
uv tool 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

Configure once (interactive; writes ~/.config/opencode-dashboard/server.yaml), then serve:

opencode-dashboard-server configure
opencode-dashboard-server serve

configure walks you through port (default 8791), host (default 0.0.0.0), cors_origins (comma-separated; empty = built-in loopback whitelist), poll_seconds (default 5), and opencode_bin (default opencode). Empty input keeps the default.

serve accepts overrides: --port N, --host H, --config PATH (instead of the XDG file). Precedence for port/host: CLI flag > env PORT/HOST > config file > default.

Run one aggregator per opencode host:

uvicorn app:app --port 8791

or directly with uvicorn (still works — reads env/defaults only). Run on more hosts with different ports (8792, 8793, …) and list each in the front end's config (opencode-dashboard configure). Environment switches (used when no config file value is set):

  • 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

Metadata

Release files for opencode-dashboard-server 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opencode-dashboard-server 0.5.0
File Size Uploaded Provenance Actions
opencode_dashboard_server-0.5.0.tar.gz 19.3 kB Without provenance Details for opencode_dashboard_server-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opencode-dashboard-server 0.5.0
File Interpreter ABI Platform Actions
opencode_dashboard_server-0.5.0-py3-none-any.whl Python 3 none any Details for opencode_dashboard_server-0.5.0-py3-none-any.whl

Total release size: 34.0 kB

Release files / opencode_dashboard_server-0.5.0.tar.gz

Download URL opencode_dashboard_server-0.5.0.tar.gz
Size 19.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c7f6e38e618e62cbaeaadfd8ec5c85fa2d8a2a23516a16e3efb20cd206d1368e
BLAKE2b-256 checksum
How to use checksums
1a5ffd600e9c243f6ae943a96f628dd95f1cc8462529a4844d1c82e3c675364e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / opencode_dashboard_server-0.5.0-py3-none-any.whl

Download URL opencode_dashboard_server-0.5.0-py3-none-any.whl
Size 14.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
802e9acaf4fd716e66e9c52fdee7c576e15beb29b27194f53c17d9a236545add
BLAKE2b-256 checksum
How to use checksums
d7efedbbf36b43dcb759942d7b50c8580452ec5e39d01f74f609183afcfd9d4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for opencode-dashboard-server 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page