docs: document Kimi cost live smoke

This commit is contained in:
Peter Steinberger
2026-04-21 03:10:51 +01:00
parent 18269f0b88
commit bd0c9024a2
4 changed files with 35 additions and 1 deletions

View File

@@ -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,
},

View File

@@ -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.

View File

@@ -79,6 +79,25 @@ Choose your provider and follow the setup steps.
openclaw models list --provider moonshot
```
</Step>
<Step title="Run a live smoke test">
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.
</Step>
</Steps>
### 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.
</Accordion>
<Accordion title="Endpoint and model ref reference">

View File

@@ -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)