pi-provider-kimi-code
v0.1.8
Published
pi custom provider extension for Kimi Code models with OAuth device-code login
Maintainers
Readme
pi-provider-kimi-code
A pi-coding-agent custom provider extension that adds Kimi Code models with OAuth device-code login.
Install
pi install npm:pi-provider-kimi-codeOr load without installing:
pi -e /path/to/pi-provider-kimi-codeAuthentication
OAuth (recommended)
Inside pi, run:
/login kimi-codingThis starts the device-code flow — a browser window opens, you authorize, and credentials are stored automatically.
API Key
Set the KIMI_API_KEY environment variable:
KIMI_API_KEY=sk-... piModels
| ID | Name | Reasoning | Input | Context | Max Output |
|---------------------------|--------------------------------|-----------|-------------|----------|------------|
| kimi-code | Kimi Code (powered by kimi-k2.5) | yes | text, image | 262 144 | 32 768 |
| kimi-k2.5 | Kimi K2.5 | yes | text, image | 262 144 | 32 768 |
| kimi-k2-thinking-turbo | Kimi K2 Thinking Turbo | yes | text | 262 144 | 32 768 |
Select a model inside pi:
/model kimi-coding/kimi-codeEnvironment Overrides
KIMI_CODE_BASE_URL— override the default API base URL (https://api.kimi.com/coding)KIMI_CODE_OAUTH_HOST— override the OAuth hostKIMI_OAUTH_HOST— fallback OAuth host override for compatibility
How It Works
- Registers provider
kimi-codingwith base URLhttps://api.kimi.com/coding - Uses
api: "anthropic-messages"— Kimi's API is wire-compatible with the Anthropic Messages format - Adds a small
streamSimplewrapper to suppress Kimi's leaked(Empty response: ...)placeholder blocks - Sends the same
KimiCLI/1.28.0+X-Msh-*headers as currentkimi-cli - Persists a stable device ID at
~/.pi/providers/kimi-coding/device_id - OAuth uses RFC 8628 device authorization grant against
https://auth.kimi.com - Zero dependencies — types from
@mariozechner/pi-aiand@mariozechner/pi-coding-agentare provided by the pi runtime - Zero build step — pi loads TypeScript directly via jiti
Credits
This extension is based on the OAuth implementation from kimi-cli by Moonshot AI.
License
MIT
