Skip to content

[Provider compatibility]: Kimi Coding Plan quota probe reports unsupported for api.kimi.ai #8332

Closed

Description

@ThingsCouldGetDicey

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 --refresh

The 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

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.com and api.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

  1. added
    account-pool
    on Nov 8, 2026
  2. github-actions commented on Nov 8, 2026

    @github-actions
    Contributor

    Issue reopened

    The report now contains the information required by the automated check. Thanks for updating it.

  3. changed the title [-][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[/+] on Nov 8, 2026
  4. added
    provider-compatibility
    provider
    on Nov 8, 2026
  5. Ingwannu commented on Nov 8, 2026

    @Ingwannu
    Owner

    On dev (f8dfc2f) the Kimi quota probe is pinned to one host, deliberately:

    • src/providers/quota/vendor-probes-key.ts:26-27 defines the usage URL as https://api.kimi.com/coding/v1/usages.
    • :1118-1119 and :1438 (and src/providers/quota/account-cache.ts:567) accept only that base URL.
    • :1271-1274 returns null for any other host. The comment there says credentials must never go to a user-edited or lookalike host.

    So unsupported for api.kimi.ai is the designed outcome today, not a probe bug. The repo has no reference to api.kimi.ai as 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:

    1. A link to Kimi documentation stating that the Coding Plan usage endpoint is served on api.kimi.ai.
    2. From a valid key, the HTTP status and the JSON key names returned by 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 dev and does not change the host.

  6. added
    needs-info
    on Nov 8, 2026
  7. ThingsCouldGetDicey commented on Nov 8, 2026

    @ThingsCouldGetDicey
    Author

    Thanks for checking the implementation on dev and explaining the host restriction.

    So unsupported for api.kimi.ai is the designed outcome today, not a probe bug.

    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.

    To evaluate that change we need:

    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/v1 as the Overseas OpenAI-compatible Kimi Code API base URL, alongside https://api.kimi.com/coding/v1 for China:

    Important distinction: these pages document the overseas Coding Plan host, but do not independently specify /usages as a public API contract.

    For evidence of GET https://api.kimi.ai/coding/v1/usages itself, Kimi's upstream repository contains these public reports:

    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-code API-key configuration, inference on https://api.kimi.ai/coding/v1 succeeds.

    However, a separate GET https://api.kimi.ai/coding/v1/usages made with Python's default urllib client 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 null entries 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.ai should be an explicit, reviewed allowlist decision, not probing arbitrary configured hosts. The remaining gap is a successful overseas /usages response 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.

  8. lidge-jun commented on Nov 8, 2026

    @lidge-jun
    Owner

    Thanks, that is exactly the evidence we needed to scope this. Keeping it open as needs-info on one point: allowing api.kimi.ai adds a second destination that receives the user's Kimi API key. We'll only add it to the quota allowlist once there is a successful GET https://api.kimi.ai/coding/v1/usages with 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 plain curl with Authorization: Bearer <key> is the useful test. Until then unsupported remains the correct state, with no inferred 0%.

  9. ThingsCouldGetDicey commented on Nov 8, 2026

    @ThingsCouldGetDicey
    Author

    Thanks — I agree with the requirement to verify Coding Plan API-key authentication, rather than relying on OAuth responses.

    We'll only add it to the quota allowlist once there is a successful GET https://api.kimi.ai/coding/v1/usages with a Coding Plan API key, not the CLI OAuth token.

    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:

    1. 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:

      KIMI_CODE_BASE_URL=https://api.kimi.ai/coding/v1 codexbar usage --provider kimi --source api --json

      The report compares parsed API usage with the subscription dashboard; it concerns how contradictory quota fields are interpreted, not an authentication failure.

    2. 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)

    usage.limit
    usage.used
    usage.remaining
    usage.resetTime
    limits[].window.duration
    limits[].window.timeUnit
    limits[].detail.limit
    limits[].detail.used
    limits[].detail.remaining
    limits[].detail.resetTime
    usages.limit_5h.used_ratio
    usages.limit_5h.reset_time
    usages.limit_7d.used_ratio
    usages.limit_7d.reset_time
    usages.limit_month_total.used_ratio
    usages.limit_month_total.reset_time
    usages.limit_month_code.used_ratio
    usages.limit_month_code.reset_time
    

    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 observed HTTP 403 / Cloudflare 1010 from Python urllib remains a separate, inconclusive client-signature result.

    This now establishes an API-key-authenticated success path on the overseas /usages endpoint 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.ai allowlist 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.

  10. lidge-jun commented on Nov 9, 2026

    @lidge-jun
    Owner

    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.

  11. ThingsCouldGetDicey commented on Nov 9, 2026

    @ThingsCouldGetDicey
    Author

    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/v1 can query that origin's /usages endpoint without changing inference routing or expanding to arbitrary hosts.

    I also appreciate preserving the separate api.kimi.com account-login behaviour and the precedence of valid counters over contradictory zero ratios.

    I see #8399 currently targets dev and 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.

  12. added a commit that references this issue on Nov 9, 2026
    b263b08
  13. added a commit that references this issue on Nov 9, 2026
    6ce65a5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    account-poolneeds-infoproviderprovider-compatibility

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions