Live token and cost visibility for Backboard apps. Run the server, open the UI, see usage in real time.
Project description
Backboard Usage
Live token and cost visibility for Backboard apps. See usage in real time as your agents run—no need to wait for the billing dashboard.
Install
pip install backboard-usage
Quick start
-
Start the usage server (one terminal, leave it running):
backboard-usage-server
-
Open the UI in your browser: http://localhost:8766
-
Run your Backboard app in another terminal. Your app must send usage data to
ws://localhost:8765in the expected JSON format (e.g. using the pattern in the example below).
You’ll see live tokens, cost, and breakdown by agent and model. Run history is stored in the browser (last 10 runs).
Wire format
Your app connects to the WebSocket and sends JSON messages.
During a run (after each message or step):
{
"event": "usage",
"total_tokens": 1234,
"total_cost": 0.0123,
"by_agent": {
"Idea Analyzer": { "tokens": 600, "cost": 0.006 },
"Market Researcher": { "tokens": 634, "cost": 0.0063 }
},
"by_model": {
"openai/gpt-4o": { "tokens": 1234, "cost": 0.0123 }
}
}
When the run finishes:
{
"event": "done",
"total_tokens": 1234,
"total_cost": 0.0123,
"by_agent": { ... },
"by_model": { ... }
}
The UI shows “This run” (current session), “Total (all runs)” (aggregate from history), and “Run history” (last 10 runs).
Example: Python
Use the Backboard SDK and send usage after each add_message (tokens/cost from the response, or estimate with backboard_usage.cost.estimate_cost). Connect to ws://localhost:8765 and push the JSON above. See orchestrator.py in this repo for a full example with multiple agents.
Optional env
| Variable | Default | Description |
|---|---|---|
USAGE_WS_URL |
ws://localhost:8765 |
WebSocket URL your app uses. |
Development from repo
pip install -e .
# Build UI (first time or after UI changes):
cd usage-ui && npm ci && npm run build && cd ..
# Copy UI into package (so server serves it):
# Windows PowerShell:
Copy-Item -Path usage-ui\dist\* -Destination backboard_usage\ui -Recurse -Force
# Then run:
backboard-usage-server
# Or: python usage_server.py
License
MIT
Project details
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 backboard_usage-0.1.0.tar.gz.
File metadata
- Download URL: backboard_usage-0.1.0.tar.gz
- Upload date:
- Size: 61.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8af833000a892be304221cb32c504c23dc319600a8c5612e3a4b172db442c26
|
|
| MD5 |
d858c3aa806237cafabdd40fa8e2f244
|
|
| BLAKE2b-256 |
1a7673756c2c9ab19240aad65b9a8cbdb6d65c3578e1479697c93c41b796732d
|
File details
Details for the file backboard_usage-0.1.0-py3-none-any.whl.
File metadata
- Download URL: backboard_usage-0.1.0-py3-none-any.whl
- Upload date:
- Size: 60.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f33ee1d74af5dea25bf748b17acc4ebbe737ab0a2ef2cbe21d01bb232208a712
|
|
| MD5 |
1ceb872ee8c9ffd51ed85c9c33eaaca4
|
|
| BLAKE2b-256 |
abb66c279c1f710b0d7eab8662965e9976e03eb80f035f6c528aa3b1aa784ab2
|