From bd0c9024a298d24f1d9920545e148b168f4fdeaa Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 21 Apr 2026 03:10:51 +0100 Subject: [PATCH] docs: document Kimi cost live smoke --- docs/gateway/configuration-reference.md | 2 +- docs/help/testing.md | 5 +++++ docs/providers/moonshot.md | 25 +++++++++++++++++++++++++ docs/reference/token-use.md | 4 ++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/docs/gateway/configuration-reference.md b/docs/gateway/configuration-reference.md index 6729e00d9b4..38eb989846e 100644 --- a/docs/gateway/configuration-reference.md +++ b/docs/gateway/configuration-reference.md @@ -2690,7 +2690,7 @@ Set `ZAI_API_KEY`. `z.ai/*` and `z-ai/*` are accepted aliases. Shortcut: `opencl name: "Kimi K2.6", reasoning: false, input: ["text", "image"], - cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, + cost: { input: 0.95, output: 4, cacheRead: 0.16, cacheWrite: 0 }, contextWindow: 262144, maxTokens: 262144, }, diff --git a/docs/help/testing.md b/docs/help/testing.md index 9edff0f4165..36770a5d0dc 100644 --- a/docs/help/testing.md +++ b/docs/help/testing.md @@ -39,6 +39,11 @@ When debugging real providers/models (requires real creds): - Live suite (models + gateway tool/image probes): `pnpm test:live` - Target one live file quietly: `pnpm test:live -- src/agents/models.profiles.live.test.ts` +- Moonshot/Kimi cost smoke: with `MOONSHOT_API_KEY` set, run + `openclaw models list --provider moonshot --json`, then run an isolated + `openclaw agent --local --session-id live-kimi-cost --message 'Reply exactly: KIMI_LIVE_OK' --thinking off --json` + against `moonshot/kimi-k2.6`. Verify the JSON reports Moonshot/K2.6 and the + assistant transcript stores normalized `usage.cost`. Tip: when you only need one failing case, prefer narrowing live tests via the allowlist env vars described below. diff --git a/docs/providers/moonshot.md b/docs/providers/moonshot.md index b46e1e4550d..7b1871f8045 100644 --- a/docs/providers/moonshot.md +++ b/docs/providers/moonshot.md @@ -79,6 +79,25 @@ Choose your provider and follow the setup steps. openclaw models list --provider moonshot ``` + + Use an isolated state dir when you want to verify model access and cost + tracking without touching your normal sessions: + + ```bash + OPENCLAW_CONFIG_PATH=/tmp/openclaw-kimi/openclaw.json \ + OPENCLAW_STATE_DIR=/tmp/openclaw-kimi \ + openclaw agent --local \ + --session-id live-kimi-cost \ + --message 'Reply exactly: KIMI_LIVE_OK' \ + --thinking off \ + --json + ``` + + The JSON response should report `provider: "moonshot"` and + `model: "kimi-k2.6"`. The assistant transcript entry stores normalized + token usage plus estimated cost under `usage.cost` when Moonshot returns + usage metadata. + ### Config example @@ -335,6 +354,12 @@ Config lives under `plugins.entries.moonshot.config.webSearch`: shared `openai-completions` transport. OpenClaw keys that off endpoint capabilities, so compatible custom provider ids targeting the same native Moonshot hosts inherit the same streaming-usage behavior. + + With the bundled K2.6 pricing, streamed usage that includes input, output, + and cache-read tokens is also converted into local estimated USD cost for + `/status`, `/usage full`, `/usage cost`, and transcript-backed session + accounting. + diff --git a/docs/reference/token-use.md b/docs/reference/token-use.md index 939d1fcbcf3..5ae89ae3105 100644 --- a/docs/reference/token-use.md +++ b/docs/reference/token-use.md @@ -96,6 +96,10 @@ transcript totals can win when stored totals are missing or smaller. Usage auth for provider quota windows comes from provider-specific hooks when available; otherwise OpenClaw falls back to matching OAuth/API-key credentials from auth profiles, env, or config. +Assistant transcript entries persist the same normalized usage shape, including +`usage.cost` when the active model has pricing configured and the provider +returns usage metadata. This gives `/usage cost` and transcript-backed session +status a stable source even after the live runtime state is gone. ## Cost estimation (when shown)