Repository navigation
Description
Client or integration
Other — OpenCodex CLI quota commands and dashboard Usage view, with Codex CLI using Kimi through the OpenCodex proxy.
Provider or upstream service
Kimi Coding Plan (kimi-code, API-key authentication), regional Coding API at https://api.kimi.ai/coding/v1.
OpenCodex version
2.99.0 (Linux AppImage proxy and CLI).
Endpoint or capability
Kimi Coding Plan subscription quota reporting, including the regional https://api.kimi.ai/coding/v1/usages endpoint and the ocx account list ... --quota --refresh / ocx provider quota --refresh outputs.
Current behaviour
Model inference via kimi-code/k3.1-pro succeeds using https://api.kimi.ai/coding/v1. The OpenCodex Responses route succeeds as well.
However, refreshing quota shows unsupported for the active kimi-code API-key account, while ocx provider quota --refresh lists OpenAI quota windows but no Kimi quota windows.
The existing Kimi quota-probe path appears to support the api.kimi.com Coding Plan origin but not the regional api.kimi.ai origin. Please verify that origin restriction in the current implementation.
Expected behaviour
For a Kimi Coding Plan account configured against api.kimi.ai, attempt the corresponding regional quota endpoint and, when supported upstream, report available subscription usage percentages and reset windows through the existing CLI and dashboard usage surfaces.
If the regional quota API is unavailable, preserve an explicit unsupported or appropriate error state rather than displaying an inferred 0% value. Do not change the existing inference route or model selection.
Minimal redacted request or reproduction
# Configure the existing kimi-code API-key provider with:
# base URL: https://api.kimi.ai/coding/v1
# model: k3.1-pro
ocx provider test kimi-code --model k3.1-pro
ocx access test kimi-code/k3.1-pro --protocol responses
ocx account list kimi-code --quota --refresh
ocx provider quota --refreshThe first two commands succeed. The quota refresh commands do not expose Kimi subscription windows.
Actual response or error
kimi-code account quota status: unsupported
ocx provider quota --refresh: reports openai windows; no kimi-code windows
A separate direct probe of the regional /usages URL using Python urllib returned Cloudflare 1010 (HTTP 403) before a quota response was available. That client-level result does not establish whether the endpoint is accessible through OpenCodex's normal quota client.
Upstream documentation
- Kimi Coding Plan / Codex integration: https://www.kimi.com/code/docs/third-party-tools/codex.html
- OpenCodex provider documentation: https://opencodex.me/guides/providers/
A public response schema for the regional /usages endpoint has not been independently established in this report. The request is to check and support that integration where the upstream permits it.
Suggested mapping or implementation notes
- Recognize the two Kimi Coding Plan origins separately for quota probing:
api.kimi.comandapi.kimi.ai. - Query the quota endpoint corresponding to the configured regional origin without modifying inference routing.
- Reuse the existing Kimi quota parser when the response format matches; handle unsupported, blocked and malformed responses distinctly.
- Test both origins and verify that an unavailable regional quota response does not imply zero usage.
Additional context and attachments
Quota observability only. Kimi inference and the current Codex conversation already work through OpenCodex 2.99.0; this request does not concern model inference or session migration.
Checks
- I searched existing provider and compatibility issues.
- The request and response were redacted.
- The expected behaviour is based on an upstream specification or a concrete client requirement.
Activity
github-actions commentedon Nov 8, 2026
Issue reopened
The report now contains the information required by the automated check. Thanks for updating it.
[-][Enhancement]: Support Kimi Coding Plan API-key quota reporting for api.kimi.ai regional endpoint[/-][+][Provider compatibility]: Kimi Coding Plan quota probe reports unsupported for api.kimi.ai[/+]Ingwannu commentedon Nov 8, 2026
On
dev(f8dfc2f) the Kimi quota probe is pinned to one host, deliberately:src/providers/quota/vendor-probes-key.ts:26-27defines the usage URL ashttps://api.kimi.com/coding/v1/usages.:1118-1119and:1438(andsrc/providers/quota/account-cache.ts:567) accept only that base URL.:1271-1274returns null for any other host. The comment there says credentials must never go to a user-edited or lookalike host.So
unsupportedforapi.kimi.aiis the designed outcome today, not a probe bug. The repo has no reference toapi.kimi.aias a Coding Plan host. Adding it would send the user's API key to a second host, which is a credential-destination change and needs review before it is merged.To evaluate that change we need:
api.kimi.ai.GET https://api.kimi.ai/coding/v1/usages, with no values and no key. If the response is a Cloudflare block, please include the response headers that show it.The monthly-quota change in #8077 is already on
devand does not change the host.ThingsCouldGetDicey commentedon Nov 8, 2026
Thanks for checking the implementation on
devand explaining the host restriction.Agreed. This should be treated as a request to review support for a second, explicitly approved Kimi Coding Plan origin, not as a claim that the existing probe is malfunctioning. The inference endpoint should remain unchanged.
Here is the evidence for each of the two requested items, with the distinction between documented support, public field reports, and local observations made explicit.
1. Official host documentation and evidence for the regional usage path
Kimi Code's official service-endpoint documentation lists
https://api.kimi.ai/coding/v1as the Overseas OpenAI-compatible Kimi Code API base URL, alongsidehttps://api.kimi.com/coding/v1for China:Important distinction: these pages document the overseas Coding Plan host, but do not independently specify
/usagesas a public API contract.For evidence of
GET https://api.kimi.ai/coding/v1/usagesitself, Kimi's upstream repository contains these public reports:GET /coding/v1/usagesreports contradictory quota:usages.limit_7d.used_ratio = 0while the weekly quota is exhausted and the API returns 403 MoonshotAI/kimi-code#3951 — shows the overseasbase_url, aGET {base_url}/usagesrequest, HTTP 200, and a sample JSON response.Those successful public reports use the Kimi CLI's OAuth access token, not a Kimi Coding Plan Console API key. They support the regional path's existence; they do not establish that the API-key quota probe will authenticate successfully there.
2. HTTP status and JSON key names
In the locally tested
kimi-codeAPI-key configuration, inference onhttps://api.kimi.ai/coding/v1succeeds.However, a separate
GET https://api.kimi.ai/coding/v1/usagesmade with Python's defaulturllibclient returned HTTP 403 / Cloudflare Error 1010 (client-signature rejection), with no quota JSON. The HTTP response headers from that attempt were not captured, so I cannot supply the requested Cloudflare headers or represent this as a successful API-key quota read.For the JSON shape only, the successful public OAuth-based response in MoonshotAI/kimi-code#3951 includes these key names (all values intentionally replaced by placeholders):
{ "usage": { "limit": null, "used": null, "resetTime": null }, "limits": [ { "window": { "duration": null, "timeUnit": null }, "detail": { "limit": null, "remaining": null, "resetTime": null } } ], "usages": { "limit_5h": { "used_ratio": null, "reset_time": null }, "limit_7d": { "used_ratio": null, "reset_time": null } } }The
nullentries here are placeholders, not observed API values. Some upstream reports suggest differing or expanded fields and potentially unreliable zero ratios, so a parser should not interpret an unverified zero as trustworthy quota data.I agree with the concern about changing permitted destinations: any support for
api.kimi.aishould be an explicit, reviewed allowlist decision, not probing arbitrary configured hosts. The remaining gap is a successful overseas/usagesresponse using API-key authentication. I don't have that evidence yet, and don't want to imply otherwise.I also noted that #8077 addresses monthly quota handling separately and does not change host eligibility.
lidge-jun commentedon Nov 8, 2026
Thanks, that is exactly the evidence we needed to scope this. Keeping it open as needs-info on one point: allowing
api.kimi.aiadds a second destination that receives the user's Kimi API key. We'll only add it to the quota allowlist once there is a successfulGET https://api.kimi.ai/coding/v1/usageswith a Coding Plan API key, not the CLI OAuth token. Please include its HTTP status and JSON key names, with values and the key removed. The public OAuth reports show the path exists but not that API-key auth works there. The Cloudflare 1010 you saw comes from the Python client's signature, so a plaincurlwithAuthorization: Bearer <key>is the useful test. Until thenunsupportedremains the correct state, with no inferred 0%.ThingsCouldGetDicey commentedon Nov 8, 2026
Thanks — I agree with the requirement to verify Coding Plan API-key authentication, rather than relying on OAuth responses.
I found two independent, publicly documented API-key reproductions against that exact overseas endpoint in the CodexBar project. These are substantially stronger evidence than the OAuth-only reports I linked previously:
CodexBar #3754 — Kimi international Allegro explicitly states "API-key authentication succeeds", identifies the Kimi Code API key and
https://api.kimi.ai/coding/v1/usages, provides a sanitized JSON response, and gives the reproduction command:The report compares parsed API usage with the subscription dashboard; it concerns how contradictory quota fields are interpreted, not an authentication failure.
CodexBar #4306 — international Kimi Code API-key response identifies region: international and Kimi Code API-key source, and quotes the JSON returned from
GET https://api.kimi.ai/coding/v1/usages. Its reported issue is again the interpretation of conflicting quota fields, not access to the endpoint.CodexBar's current Kimi provider documentation also describes selecting International (kimi.ai) and using a region-issued Kimi Code API key for the Code API, with the regional base
https://api.kimi.ai/coding/v1.Observed response key names (from those public API-key reports; no values)
HTTP status qualification: Both reports show successful API-key-authenticated JSON retrieval, but neither separately captures the numeric HTTP status line. I cannot honestly relabel that as a locally observed
HTTP 200. The earlier locally observedHTTP 403 / Cloudflare 1010from Pythonurllibremains a separate, inconclusive client-signature result.This now establishes an API-key-authenticated success path on the overseas
/usagesendpoint as reported by two independent users, with the response field names you requested. If an explicitly captured HTTP status line is still mandatory before approving the second allowlisted host, that exact evidence remains outstanding.I agree that the host addition should remain an explicit, reviewed
api.kimi.aiallowlist entry and must not allow arbitrary destinations. Also worth preserving: these successful responses can contain contradictory legacy-count and ratio fields, as shown in both issues, so an upstream zero ratio should not automatically override valid counts.lidge-jun commentedon Nov 9, 2026
Thanks, the two CodexBar reports (API-key-authenticated JSON from https://api.kimi.ai/coding/v1/usages with the same field shape) are enough to scope this. #8399 lets an API-key provider configured on https://api.kimi.ai/coding/v1 read /usages from that same origin, so the key goes nowhere it is not already sent for inference. Account login stays on api.kimi.com. Valid counters still win over contradictory zero ratios. If you can try the branch with your Coding Plan key once it lands, a confirmation would be welcome.
ThingsCouldGetDicey commentedon Nov 9, 2026
Thanks for picking this up and putting together #8399. The same-origin approach addresses the important concern: an API-key account already configured for
https://api.kimi.ai/coding/v1can query that origin's/usagesendpoint without changing inference routing or expanding to arbitrary hosts.I also appreciate preserving the separate
api.kimi.comaccount-login behaviour and the precedence of valid counters over contradictory zero ratios.I see #8399 currently targets
devand is not merged yet. Once the change is available in a normal release, I can check the quota refresh using my existing Coding Plan configuration and post the outcome here—whether the regional probe succeeds or still reports an error, plus the HTTP status and response field names if available, without posting response values.Thanks again for the quick turnaround.
fix(quota): read Kimi Coding Plan usage from the regional kimi.ai ori…
fix(quota): read Kimi Coding Plan usage from the regional kimi.ai ori…