Skip to content

feat(server): show Kimi Code plan limits on Claude relay instances - #13587

Closed
saphid wants to merge 4 commits into
pingdotgg:t3code/codex-turn-mappingfrom
saphid:feat/v2-usage-kimi
Closed

saphid wants to merge 4 commits into
pingdotgg:t3code/codex-turn-mappingfrom
saphid:feat/v2-usage-kimi

Conversation

@saphid

@saphid saphid commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

What changed and why

Claude instances using Kimi Code previously showed no plan limits because the Claude CLI only reads Anthropic usage. The server now queries Kimi Code's usage endpoint with the instance's existing credential. The plan summary and rolling quota windows feed the existing Usage screen and /usage-limits output; Moonshot's open platform remains outside this integration.

This branch includes the Z.ai contribution and its parser repairs from #13586. Review the full branch as a combined stack; it must retain those repairs when the prerequisite lands.

Valid sibling quotas survive malformed rows, failed reads retain the last successful snapshot, and reset times and labels are normalized. Known units are matched exactly; monthly or invalid durations never invent pacing data.

Verification

  • 30 focused combined Z.ai/Kimi and snapshot-retention tests pass, covering malformed payloads, credential routing, timeout, cancellation, and wire-schema validity.
  • Server typecheck, scoped lint/format and explicit Effect diagnostics pass. Test serialization uses Effect schema codecs.
  • Latest-head Check, Test, Test Server 1/2/3, Rust, Release Smoke and applicable mobile checks pass. Remaining pending check: Macroscope - Effect Service Conventions.
  • Fresh independent GPT-6.1 Sol high review through T3 Code found no actionable findings in the complete repaired contribution and independently reran all 30 tests. A further independent review of the test codec correction found no actionable findings.

Remaining proof

No authenticated Kimi response or integrated client before/after evidence has been captured. Payload assumptions are corroborated by Kimi CLI source and mock HTTP tests. This PR is not yet verified ready to merge; live-account/client proof remains pending.

Original implementation attribution: Claude Opus 5.5 in Claude Code. Audit repairs: GPT-6 Astra in Codex/T3 Code; independent repair review: GPT-6.1 Sol in Codex/T3 Code.

saphid and others added 2 commits September 25, 2026 16:39
A Claude instance pointed at Z.ai through ANTHROPIC_BASE_URL showed no
usage limits: the CLI's get_usage only knows Anthropic accounts. Read the
plan's five-hour and weekly windows, with reset times, from Z.ai's quota
endpoint using the token the CLI already sends.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A Claude instance pointed at Kimi Code through ANTHROPIC_BASE_URL showed
no usage limits. Read the plan's rolling and weekly windows, with reset
times, from the same usages endpoint Kimi Code CLI's /usage reads, using
the key the CLI already sends.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Sep 25, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR adds substantial server-side logic and changes authenticated Claude refreshes to make outbound quota requests to Z.ai and Kimi using configured provider credentials. The new user-visible capability and security-sensitive credential/network handling require human review.

Notes:

  • No code objects were reviewed. Approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

@saphid

saphid commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

Re: Macroscope approvability verdict — this PR intentionally adds a new provider integration (Kimi Code usage metering on Claude relay instances), so human maintainer review is expected. No code change needed in response to this verdict.

Copy link
Copy Markdown
Member

Note

This comment is posted by Julius' dot

The full branch adds Kimi quota metering alongside the Z.ai integration from #13586. These are new authenticated provider integrations, and the PR and linked prerequisite contain no maintainer approval of this combined direction and scope. Under prior approval, please agree that scope with maintainers and link the approval before requesting reconsideration. The missing visibility into relay plan limits remains a useful problem report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants