Implement LLM-WP-0008: provider-scoped account balance CLI
Add pluggable balance registry, OpenRouter credits/key limit client, and llm-connect balance with one-shot --provider that does not change library defaults.
This commit is contained in:
parent
c0d5c4ad08
commit
ed7c632155
11 changed files with 783 additions and 14 deletions
|
|
@ -4,7 +4,7 @@ type: workplan
|
|||
title: "Provider-scoped account balance CLI"
|
||||
domain: agents
|
||||
repo: llm-connect
|
||||
status: ready
|
||||
status: finished
|
||||
owner: codex
|
||||
topic_slug: provider-account-balance-cli
|
||||
planning_priority: high
|
||||
|
|
@ -19,7 +19,7 @@ state_hub_workstream_id: "b8302848-5437-44ad-aec9-5c2df8cd5a47"
|
|||
|
||||
# LLM-WP-0008 — Provider-scoped account balance CLI
|
||||
|
||||
**status:** ready
|
||||
**status:** finished
|
||||
**owner:** codex
|
||||
|
||||
## Purpose
|
||||
|
|
@ -196,7 +196,7 @@ shipping a fake production path.
|
|||
|
||||
```task
|
||||
id: LLM-WP-0008-T01
|
||||
status: todo
|
||||
status: done
|
||||
priority: high
|
||||
state_hub_task_id: "7df3a274-4ed9-429b-aabc-15fc52c91bfc"
|
||||
```
|
||||
|
|
@ -208,7 +208,7 @@ Tests: default resolution, unknown provider, unsupported provider.
|
|||
|
||||
```task
|
||||
id: LLM-WP-0008-T02
|
||||
status: todo
|
||||
status: done
|
||||
priority: high
|
||||
state_hub_task_id: "ff564d7c-5131-4e3e-b0cd-51a41e7a1261"
|
||||
```
|
||||
|
|
@ -220,7 +220,7 @@ failure of one endpoint). Live smoke optional / manual.
|
|||
|
||||
```task
|
||||
id: LLM-WP-0008-T03
|
||||
status: todo
|
||||
status: done
|
||||
priority: high
|
||||
state_hub_task_id: "61879d8f-2271-4fa1-9a7b-dbdf7a0d408d"
|
||||
```
|
||||
|
|
@ -232,7 +232,7 @@ unsupported backends. Tests via mocked client registration.
|
|||
|
||||
```task
|
||||
id: LLM-WP-0008-T04
|
||||
status: todo
|
||||
status: done
|
||||
priority: medium
|
||||
state_hub_task_id: "9da2c09a-fe32-4602-bcad-5f0f46d4da0f"
|
||||
```
|
||||
|
|
@ -243,7 +243,7 @@ Note OpenRouter dual signals (account credits vs key limit).
|
|||
|
||||
```task
|
||||
id: LLM-WP-0008-T05
|
||||
status: todo
|
||||
status: done
|
||||
priority: low
|
||||
state_hub_task_id: "ebf67737-3f3d-458b-9dec-9224f08c8016"
|
||||
```
|
||||
|
|
@ -255,18 +255,18 @@ within rounding of OpenRouter dashboard figures; document any known drift
|
|||
|
||||
## Acceptance
|
||||
|
||||
- [ ] `llm-connect balance` reports OpenRouter remaining budget when default
|
||||
- [x] `llm-connect balance` reports OpenRouter remaining budget when default
|
||||
provider is `openrouter`, without changing any defaults
|
||||
- [ ] `llm-connect balance --provider openrouter` same result; still no default
|
||||
- [x] `llm-connect balance --provider openrouter` same result; still no default
|
||||
mutation
|
||||
- [ ] `llm-connect balance --provider <unsupported>` fails clearly (not with
|
||||
- [x] `llm-connect balance --provider <unsupported>` fails clearly (not with
|
||||
OpenRouter data)
|
||||
- [ ] Account credits remaining and key limit remaining are distinguishable in
|
||||
- [x] Account credits remaining and key limit remaining are distinguishable in
|
||||
output when both are available
|
||||
- [ ] EUR amounts shown when FX available
|
||||
- [ ] Adding a future provider is “register a balance client”, not hard-coding
|
||||
- [x] EUR amounts shown when FX available
|
||||
- [x] Adding a future provider is “register a balance client”, not hard-coding
|
||||
OpenRouter into the CLI command body
|
||||
- [ ] Offline unit tests pass without network
|
||||
- [x] Offline unit tests pass without network
|
||||
|
||||
## Risks / notes
|
||||
|
||||
|
|
@ -285,3 +285,14 @@ within rounding of OpenRouter dashboard figures; document any known drift
|
|||
## Implementation order
|
||||
|
||||
T01 → T02 → T03 → T04 → T05.
|
||||
|
||||
|
||||
## Implementation notes (2026-08-03)
|
||||
|
||||
- Added `llm_connect.balance` with pluggable registry; OpenRouter client uses
|
||||
`/api/v1/credits` + `/api/v1/auth/key` via new `get_json` HTTP helper.
|
||||
- CLI: `llm-connect balance [--provider] [--json] [--eur-per-usd]`.
|
||||
- Live smoke: account credits remaining ~12.72 USD and key limit remaining
|
||||
~9.98 USD; unsupported `gemini` exits 2; defaults unchanged
|
||||
(`openrouter` / `moonshotai/kimi-k3`).
|
||||
- Unit suite: 237 passed.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue