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
opencodeCLI on the same host — the server shells out toopencode 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 originslocalhost/127.0.0.1:5173and:4173; tighten or widen for your deployment).DASHBOARD_POLL_SECONDS— SSE poll interval in seconds (default5).OPENCODE_BIN— path to theopencodebinary if it's not onPATH.
API
GET /health— livenessGET /overview— whole-host aggregate (tokens by type + cost, session counts,updatedAt)GET /projects— per-project rollupsGET /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:updatedevents 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file opencode_dashboard_server-0.4.1.tar.gz.
File metadata
- Download URL: opencode_dashboard_server-0.4.1.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0714768d6d3c93dc7fb371fdf046e236c0ee25278b6eebcc8958eb3493b7786f
|
|
| MD5 |
fdf5c8e7f81f1416296a59506d04d156
|
|
| BLAKE2b-256 |
f7a709a24592515030c1b62a02878673600ba833fd6728fa6a96129b4b97a8c4
|
File details
Details for the file opencode_dashboard_server-0.4.1-py3-none-any.whl.
File metadata
- Download URL: opencode_dashboard_server-0.4.1-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0524ddcdac71e1a74ca5c2beaddf7219128447395fa8ed72dc3bcafada8ff5dd
|
|
| MD5 |
e68c420c81c41cbfb53bb3bae68d67c7
|
|
| BLAKE2b-256 |
9d3c2d7502a6c1c3594a982e71406845e0f24c35c5f4d0260ea250219e3e7736
|