Switch Kimi provider to Kimi Code usage API#786
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1058e7030e
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| #endif | ||
| func isAvailable(_ context: ProviderFetchContext) async -> Bool { | ||
| ProviderTokenResolver.kimiAPIKey(environment: context.env) != nil |
There was a problem hiding this comment.
Honor configured Kimi API key in API fetch mode
KimiAPIFetchStrategy only checks ProviderTokenResolver.kimiAPIKey(environment: context.env), but this commit’s settings UI stores the Kimi key in providerConfig.apiKey. Because ProviderConfigEnvironment.applyAPIKeyOverride still has no .kimi case, that saved key never reaches context.env; users who pick API Key (or Auto without CLI OAuth creds) get missingToken unless they also set an env var. This makes the new in-app API key field ineffective for actual fetches.
Useful? React with 👍 / 👎.
| let raw = self.cleaned(environment["KIMI_CODE_OAUTH_HOST"]) | ||
| ?? self.cleaned(environment["KIMI_OAUTH_HOST"]) | ||
| ?? "https://auth.kimi.com" | ||
| return URL(string: raw)! |
There was a problem hiding this comment.
Validate OAuth host override before force-unwrapping URL
oauthHost force-unwraps URL(string: raw)! for KIMI_CODE_OAUTH_HOST/KIMI_OAUTH_HOST. If that override is malformed or provided as a bare host (for example auth.kimi.com), the app will crash during token refresh in normal auto-fetch flow. This should fail gracefully (fallback/default or surfaced error) rather than terminating the process.
Useful? React with 👍 / 👎.
Summary
~/.kimi/credentials/kimi-code.jsonand refresh them when neededKIMI_CODE_API_KEY, orKIMI_API_KEYWhat changed
webtoauto|oauth|apiGET https://api.kimi.com/coding/v1/usagesand map the summary plus rolling limits into CodexBar lanesReview
swift buildswift testExact prompts used
https://github.com/steipete/codexbar I have this installed on my computer, and I want to make some changes to it so that I can monitor Kimi code. Can you look at this project, how it is structured, how it currently facilitates the monitoring of providers like Codex, and come up with a plan so that we can implement the correct monitoring for Kimi? https://platform.kimi.ai/docs/overviewhttps://www.kimi.com/code/docs/en/Yeah, go ahead, give that a shot. You should be modifying my own local codex installation. Whenever I can give you the API key, I can. I have KimE CLI installed, so you can utilize that if needed.