MoonshotAI / MoonshotAI/kimi-code

Request: supported Kimi Code device OAuth registration for Codewhale

Open
#1,795 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.5k
Forks
1.2k
Avg merge
11h 53m
Merged PRs (30d)
350

Description

What feature would you like to see?

We maintain Codewhale, an open-source coding agent for macOS, Linux, and Windows. We would like to support an honest Kimi Code device-login option alongside our existing Kimi Code API-key path.

Before implementing this or opening a code PR, could the Kimi team clarify whether the managed Kimi Code OAuth/device flow is supported for third-party coding agents?

At MoonshotAI/kimi-code@373abb02, the first-party client uses:

  • POST https://auth.kimi.com/api/oauth/device_authorization
  • POST https://auth.kimi.com/api/oauth/token
  • the registered client ID defined in packages/oauth/src/constants.ts
  • X-Msh-Platform: kimi_code_cli and device identity headers defined in packages/oauth/src/identity.ts
  • the managed API at https://api.kimi.com/coding/v1

We found the client implementation but no public third-party OAuth client or platform registration table in this repository. The current Kimi Code documentation directs third-party coding agents to use a console-created API key and says integrations must retain their real identity/User-Agent:

For that reason, Codewhale will not identify itself as kimi_cli or kimi_code_cli, copy the first-party User-Agent, or otherwise impersonate an approved Kimi client to bypass the coding-agent check.

If third-party device OAuth is supported, could Moonshot provide or approve the following registration contract?

  1. A distinct public/native device-flow client ID for Codewhale, or explicit confirmation that the existing public client ID is intentionally reusable by third-party agents.
  2. The approved X-Msh-Platform value for Codewhale.
  3. The required User-Agent/product identity. We propose Codewhale/<version>.
  4. The required X-Msh-* device fields and stable device-ID rules.
  5. The supported token scopes, refresh behavior, and approved managed endpoints, including models, messages/chat, and usage.
  6. Any branding, telemetry, privacy, rate-limit, abuse-prevention, security-review, or release requirements.
  7. Any test environment, test account, or sanitized evidence the Kimi team would like us to provide before release.

Our planned implementation uses RFC 8628 device authorization, so it does not require a redirect URI or embed a client secret in the distributed CLI. It will include protected local credential storage, refresh and logout support, user-visible cancellation and expiry handling, and redaction of tokens from logs, crash reports, transcripts, and exports.

We can provide a test build and sanitized request/response traces using Codewhale's real product identity.

If managed OAuth is intentionally first-party-only, confirmation that API-key authentication is the supported contract for third-party coding agents would also resolve this request. In that case, we will keep Kimi OAuth disabled and direct users to the Kimi Code Console API-key flow.

Additional information

We are asking before writing upstream code because registration and platform authorization appear to be enforced by Kimi's hosted services. We would be happy to submit a focused code or documentation PR if maintainers identify a public change that should accompany registration.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

This request depends on maintainer clarification rather than a repository change. Review packages/oauth/src/constants.ts and packages/oauth/src/identity.ts at the referenced commit, then compare the Kimi Code documentation for third-party tools; done means receiving an approved registration contract or confirmation that API-key authentication is the supported path.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, authentication
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.