feat(auth): add Kimi Code OAuth login - #708
Closed
euxaristia wants to merge 21 commits into
Closed
euxaristia wants to merge 21 commits into
euxaristia wants to merge 21 commits into
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a first-class Kimi Code OAuth login to Zero, listed directly below ChatGPT in the OAuth options.
Kimi is modeled on the generic device-code preset path (like xAI), not the bespoke ChatGPT/Codex path — because Kimi's returned access token works directly as a
Beareron its managed coding endpoint, so no claim extraction is needed.Changes
internal/providercatalog/catalog.go— newkimicatalog entry, OpenAI-compatible athttps://api.kimi.com/coding/v1, flaggedOAuth+OAuthDeviceFlow,RequiresAuthwith no API-key env var. Placed immediately after the ChatGPT entry so it appears below ChatGPT in the OAuth provider list.internal/oauth/presets.go—kimidevice-code preset (auth.kimi.com endpoints, publickimi-codeclient_id); overridable viaZERO_OAUTH_KIMI_*.internal/cli/auth.go— addszero auth kimisugar routing to the generic device-code login; listskimibelowchatgptin the help text.internal/tui/provider_wizard.go— mentions Kimi in the OAuth method subtitle and includes it in the OAuth provider list.docs/oauth-subscriptions.md— documents the Kimi Code OAuth path.presets_test.go,catalog_test.go,oauth_test.goupdated.Safety / ToS note
The preset ships the public
kimi-codeclient_id and Moonshot'sauth.kimi.comendpoints copied from the open-sourcekimi-codeCLI. It does nothing a user couldn't already do manually (standard RFC 8628 device-code flow, no client spoofing). Off by default; enable withZERO_OAUTH_ALLOW_PRESETS=1or explicit env overrides.Verification
go fmt,go vet, golangci-lint (unused,ineffassign,staticcheck), andgovulncheckpass (no issues in modified files).go test ./internal/oauth/... ./internal/providercatalog/... ./internal/cli/...pass.🤖 Generated with Zero
Summary by CodeRabbit
zero auth kimisupport.ZERO_OAUTH_ALLOW_PRESETS=1andZERO_OAUTH_KIMI_CODE_*overrides.