Implement LLM-WP-0007: Kimi K3 default and EUR spend reporting
Some checks failed
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Has been cancelled

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:
tegwick 2026-08-03 22:00:34 +02:00
parent f3121c3f1f
commit 09aa1f3604
21 changed files with 1396 additions and 103 deletions

View file

@ -4,7 +4,7 @@ type: workplan
title: "Kimi K3 default via OpenRouter + EUR spend reporting"
domain: agents
repo: llm-connect
status: ready
status: finished
owner: codex
topic_slug: kimi-k3-default-spend-reporting
planning_priority: high
@ -20,7 +20,7 @@ state_hub_workstream_id: "a93d226a-f5c4-4656-b584-a783840b10fe"
# LLM-WP-0007 — Kimi K3 default via OpenRouter + EUR spend reporting
**status:** ready
**status:** finished
**owner:** codex
## Purpose
@ -173,7 +173,7 @@ print clear `unknown` when not.
```task
id: LLM-WP-0007-T01
status: todo
status: done
priority: high
state_hub_task_id: "af12101d-bcd5-4d6f-9507-c81de79a0685"
```
@ -186,7 +186,7 @@ or README providers table. Gate for T02.
```task
id: LLM-WP-0007-T02
status: todo
status: done
priority: high
state_hub_task_id: "ca836db8-9041-42e5-87ce-7c3ace1298a3"
```
@ -199,7 +199,7 @@ leave default unchanged and record the blocker in the task notes.
```task
id: LLM-WP-0007-T03
status: todo
status: done
priority: high
state_hub_task_id: "f379d09b-ea03-44f5-82fa-171da4681cef"
```
@ -211,7 +211,7 @@ model still yields `cost_usd=None` / `cost_eur=None`.
```task
id: LLM-WP-0007-T04
status: todo
status: done
priority: high
state_hub_task_id: "cadf1b0c-fdea-4446-8d01-964b2706540d"
```
@ -224,7 +224,7 @@ effort flock), and range aggregation.
```task
id: LLM-WP-0007-T05
status: todo
status: done
priority: high
state_hub_task_id: "8956fd74-cad4-435c-ae66-6b19088691e4"
```
@ -236,7 +236,7 @@ estimation from response usage + rate table + FX. Tests with mock adapter.
```task
id: LLM-WP-0007-T06
status: todo
status: done
priority: high
state_hub_task_id: "ac5e4322-cd00-4034-b162-a0e1c481180e"
```
@ -248,7 +248,7 @@ fixed timezone.
```task
id: LLM-WP-0007-T07
status: todo
status: done
priority: medium
state_hub_task_id: "a05761b9-d91c-4b6d-9e90-296aadadaf16"
```
@ -260,7 +260,7 @@ opt-in so library consumers are not surprised by home-dir writes.
```task
id: LLM-WP-0007-T08
status: todo
status: done
priority: medium
state_hub_task_id: "94ce6aee-2835-46c0-a3e6-3d0345e7715f"
```
@ -272,14 +272,14 @@ as needed. Smoke script or Makefile target for optional live Kimi check.
## Acceptance
- [ ] `moonshotai/kimi-k3` is in the default rate registry with documented USD rates
- [ ] After successful smoke, OpenRouter/library default model is `moonshotai/kimi-k3`
- [ ] `llm-connect run "..."` prints token counts and € cost (or explicit unknown)
- [ ] Successful CLI runs append to the usage ledger
- [ ] `llm-connect spend week` and `spend week --last` show tokens + € for the
- [x] `moonshotai/kimi-k3` is in the default rate registry with documented USD rates
- [x] After successful smoke, OpenRouter/library default model is `moonshotai/kimi-k3`
- [x] `llm-connect run "..."` prints token counts and € cost (or explicit unknown)
- [x] Successful CLI runs append to the usage ledger
- [x] `llm-connect spend week` and `spend week --last` show tokens + € for the
correct Mon-based windows
- [ ] Default CI tests pass offline (mock adapter, fixed FX, no live OpenRouter)
- [ ] Missing rate or FX never reported as €0.00 without an `unknown` marker
- [x] Default CI tests pass offline (mock adapter, fixed FX, no live OpenRouter)
- [x] Missing rate or FX never reported as €0.00 without an `unknown` marker
## Risks / notes
@ -298,3 +298,12 @@ as needed. Smoke script or Makefile target for optional live Kimi check.
T01 → T02 (gated) in parallel with T03 → T04 → T05 → T06 → T07 → T08.
T03/T04 can start before T01; T02 must wait for T01 smoke outcome.
## Implementation notes (2026-08-03)
- Live OpenRouter smoke: `moonshotai/kimi-k3` returned content "ok" with usage tokens (Together provider). Note: short `max_tokens` can yield empty `content` while spending tokens on reasoning.
- Default OpenRouter / LLMConfig model flipped to `moonshotai/kimi-k3`.
- Added `fx.py`, EUR fields on `CostEstimate`, `usage.py` ledger, CLI `run` / `cost estimate` / `spend week`.
- Opt-in library/server recording via `LLM_CONNECT_USAGE_LEDGER`; CLI suppresses double-record.
- Full unit suite: 224 passed offline.