Implement LLM-WP-0007: Kimi K3 default and EUR spend reporting
Add moonshotai/kimi-k3 as OpenRouter basemodel default after live smoke, USD→EUR cost conversion, append-only usage ledger, and CLI run/cost/spend week commands with token and euro reporting.
This commit is contained in:
parent
f3121c3f1f
commit
09aa1f3604
21 changed files with 1396 additions and 103 deletions
33
contracts/functional/usage-ledger.md
Normal file
33
contracts/functional/usage-ledger.md
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# Usage Ledger and Spend Windows
|
||||
|
||||
`llm_connect.usage` stores append-only spend events for operator cost reporting.
|
||||
It is separate from `QualityLedger` (adaptive routing quality signals).
|
||||
|
||||
## UsageEvent
|
||||
|
||||
Each event records provider, model, token counts, estimated `cost_usd` /
|
||||
`cost_eur`, cost/FX sources, call `source` (`cli` | `server` | `library`),
|
||||
and `recorded_at` (UTC).
|
||||
|
||||
## Paths
|
||||
|
||||
1. Explicit `--ledger` / constructor path
|
||||
2. Env `LLM_CONNECT_USAGE_LEDGER`
|
||||
3. `$XDG_DATA_HOME/llm-connect/usage.jsonl`
|
||||
4. `~/.local/share/llm-connect/usage.jsonl`
|
||||
|
||||
Library and server auto-recording only runs when `LLM_CONNECT_USAGE_LEDGER` is
|
||||
set (opt-in). CLI `run` records by default to the resolved path unless
|
||||
`--no-ledger`.
|
||||
|
||||
## Week windows
|
||||
|
||||
`week_window("current"|"last", tz=...)` returns Monday-based half-open ranges
|
||||
in local time (default `Europe/Berlin`, override with `LLM_CONNECT_TZ` or
|
||||
`--tz`):
|
||||
|
||||
- **current**: Monday 00:00 → now
|
||||
- **last**: previous Monday 00:00 → this Monday 00:00 (full Mon–Sun week)
|
||||
|
||||
`UsageLedger.sum_range(start, end)` aggregates tokens and costs for
|
||||
`[start, end)`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue