zcode-usage-synclisted
Install: claude install-skill techysy/10router
# Usage Sync → 10Router
Export this machine's ZCode **or OpenCode** model-usage ledger into 10Router's usage statistics.
## Preconditions (check before running)
1. **10Router endpoint** — default `http://127.0.0.1:20127`. If the user runs 10Router elsewhere (NAS, LAN), ask or infer from context. For a NAS/remote instance use its address, e.g. `http://192.168.31.101:20127`. *(Online modes only — `--export` needs neither endpoint nor credentials.)*
2. **Source** — `--source zcode` (default) or `--source opencode` (opencode.ai desktop app). OpenCode is **not** auto-detected — pass `--source opencode` explicitly to read the OpenCode ledger.
3. **Credential (one of)** —
- Virtual key (recommended): created in 10Router dashboard → API Keys, format `sk-…`. Pass via `--key`.
- Dashboard password: pass via `--password`.
- The script also reads env vars `TENROUTER_ENDPOINT` / `TENROUTER_KEY` / `TENROUTER_PASSWORD`.
4. Never ask the user to paste credentials into chat if they already configured them; prefer env/config over interactive prompts.
## Run
**Choose the mode first**: if this machine can reach the 10Router endpoint (same
LAN / localhost / tunnel), sync online. If it **cannot** (different network, no
route to the instance), export offline instead — write a JSON file here, the
user carries it to any machine that can reach 10Router, and imports there.
### Online (direct)
Dry-run first (shows row counts per provider, imports nothing):
```bash
node "$ZCODE_PLUGIN_RO