Add Kimi models.dev pricing lookup - #2374
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b08f5536f9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs changes before merge. Reviewed August 12, 2026, 5:14 AM ET / 09:14 UTC. ClawSweeper reviewWhat this changesAdds models.dev-backed Kimi and Moonshot pricing to local Pi session cost reports and enables both providers in the cost CLI. Merge readinessKeep open: current main lacks this Kimi/Moonshot pricing support, but the current head still regresses Claude filtering and ignores Moonshot’s configured region. Likely related people: Peter Steinberger (high-confidence filter owner) and iam-brain (medium-confidence models.dev refresh owner). Priority: P2 Review scores
Verification
How this fits togetherCodexBar’s cost command combines local provider session logs with cached models.dev prices to calculate daily token and dollar totals. This PR extends the Pi-session path for Kimi and Moonshot before results reach CLI output. flowchart LR
A[Pi session logs] --> B[Provider and model parsing]
B --> C[Provider pricing lookup]
C --> D[Daily cost scanner]
D --> E[Cost command output]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Rebase onto current main, preserve the existing Claude/Vertex filters, and select Moonshot’s models.dev catalog from the resolved region with focused regressions for both regions. Do we have a high-confidence way to reproduce the issue? Yes—source inspection shows ordinary Claude scans fall back to Is this the best way to solve the issue? No—the feature should be rebased through the current pricing implementation while retaining existing filters and provider-region behavior. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a90dfed5c264. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (27 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
6012689 to
e8e0aa5
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
e8e0aa5 to
5fabdb1
Compare
|
@steipete Rebased onto latest main and addressed ClawSweeper's feedback: docs/cli.md now documents Kimi and Moonshot cost support. Ready for review — happy to stack the China API and Google/xAI PRs on top once you pick the landing order. |
1047188 to
dc128b0
Compare
Regenerate the final parser hash now that all Kimi pricing changes are applied on top of latest main.
ClawSweeper flagged that docs/cli.md still listed only Claude, Codex, and Cursor. Update the cost command description and add examples for the new local-cost providers.
dc128b0 to
dbe62e2
Compare
|
@steipete — this PR has been rebased onto latest main and is ready for review. Thanks! |
The architecture gatekeeper test started failing after the Kimi/Moonshot models.dev pricing work introduced new provider-specific branches in shared cost code. Rather than wrestling with brittle fingerprinted allowlist entries for shifted/added clusters, add explicit '// Provider-specific by design:' markers at each provider-owned dispatch point and update the gatekeeper test's hardcoded expectations (supportsTokenSnapshot set and shifted suppressed references). Remove the now-obsolete CostUsageFetcher and PiSessionCostScanner allowlist entries whose anchors no longer match the post-rebase source. Closes provider-architecture gatekeeper failures on the Kimi/Moonshot rebase.
Summary
models.devlookup seam for CodexBar providers.kimito thekimi-for-codingcatalog andmoonshotto the paid Moonshot/Kimi API catalogs.k3[1m]alias to thek3catalog row, wire Kimi/Moonshot pricing into Pi session runtime cost, and expose both providers throughcodexbar cost.Proof
git grep -n -E "kimi-k3|kimi-k2\.7-code|kimi-for-coding-highspeed" origin/main -- Sources Tests docshttps://models.dev/api.jsonshowed:kimi-for-coding:k3/ Kimi K3 / input 0 / output 0 / cache_read 0 / cache_write 0 / context 1048576kimi-for-coding:kimi-for-coding/ Kimi K2.7 Code / input 0 / output 0 / context 262144kimi-for-coding:kimi-for-coding-highspeed/ Kimi For Coding HighSpeed / input 0 / output 0 / context 262144moonshotai:kimi-k2.7-code/ Kimi K2.7 Code / input 0.95 / output 4 / cache_read 0.19 / context 262144moonshotai:kimi-k2.7-code-highspeed/ Kimi K2.7 Code HighSpeed / input 1.9 / output 8 / cache_read 0.38 / context 262144moonshotai:kimi-k3/ Kimi K3 / input 3 / output 15 / cache_read 0.3 / context 1048576https://platform.kimi.ai/docs/pricing/chat,https://platform.kimi.ai/docs/models).CostUsagePricing.modelsDevPricing(provider: .kimi, model: "k3[1m]")resolves withnormalizedModelID == "k3".models.devfixture data, then verifiesPiSessionCostScanner.loadDailyReportcomputes costs for Pi JSONL rows:kimi/k3[1m]: 160 tokens, cost0.000252, proving the alias reaches thek3catalog rowmoonshotai/kimi-k3: 160 tokens, cost0.001053.pi/agent/sessions/2026-07-28T10-00-00-000Z_kimi-proof.jsonlcontaining only two assistant rows. No real account files, Keychain, or browser cookies were read. Command shape:HOME=[temp] CFFIXED_USER_HOME=[temp] XDG_CONFIG_HOME=[temp]/.config XDG_CACHE_HOME=[temp]/.cache .build/debug/CodexBarCLI cost --provider kimi --format json --pretty --refreshOutput excerpt:
{ "provider" : "kimi", "source" : "local", "sessionTokens" : 160000, "sessionCostUSD" : 0, "daily" : [{ "date" : "2026-07-28", "inputTokens" : 100000, "cacheReadTokens" : 10000, "outputTokens" : 50000, "totalTokens" : 160000, "totalCost" : 0, "modelBreakdowns" : [{ "modelName" : "k3[1m]", "totalTokens" : 160000, "cost" : 0 }] }] }models.devcurrently publishes zero prices forkimi-for-coding/k3, so the proof expectation is row inclusion plus zero-priced catalog resolution forkimi.HOME=[temp] CFFIXED_USER_HOME=[temp] XDG_CONFIG_HOME=[temp]/.config XDG_CACHE_HOME=[temp]/.cache .build/debug/CodexBarCLI cost --provider moonshot --format json --pretty --refreshOutput excerpt:
{ "provider" : "moonshot", "source" : "local", "sessionTokens" : 160000, "sessionCostUSD" : 1.053, "daily" : [{ "date" : "2026-07-28", "inputTokens" : 100000, "cacheReadTokens" : 10000, "outputTokens" : 50000, "totalTokens" : 160000, "totalCost" : 1.053, "modelBreakdowns" : [{ "modelName" : "kimi-k3", "totalTokens" : 160000, "cost" : 1.053 }] }] }Verification
CLANG_MODULE_CACHE_PATH=/private/tmp/codexbar-clang-cache swift test --disable-sandbox --scratch-path /Users/mosaab/Documents/Projects/CodexBar/.build --filter PiSessionCostScannerTests: 19 tests passed.CLANG_MODULE_CACHE_PATH=/private/tmp/codexbar-clang-cache swift test --disable-sandbox --scratch-path /Users/mosaab/Documents/Projects/CodexBar/.build --filter 'provider lookup resolves current Kimi and Moonshot models': 1 test passed.git diff --check: clean.make checkcompleted generated parser hash, package/docs/locales checks, SwiftFormat lint mode, and SwiftLint strict with 0 violations, then exited on the sandbox-only macOS plist cache write permission error after lint shutdown.No live provider probes, browser-cookie imports, or Keychain reads were run.