
Security News
vlt 1.5.0 Adds Agent Skills Management
vlt 1.5.0 links skills from JavaScript dependencies to coding agents, with lockfile versioning and Socket data to filter out known malicious packages.
pi-kimi-coder
Advanced tools
Pi extension for Kimi K2 Coding plan — OAuth-based provider with kimi-for-coding model
A pi extension that adds the Kimi K2 Coding Plan as a provider. Use Moonshot AI's kimi-for-coding (K2.6) model directly inside pi with full tool use, extended thinking, and image support.
What is the K2 Coding Plan? Moonshot AI offers a subscription plan that gives unlimited (fair-use) access to their flagship coding model through
api.kimi.com/coding/v1. This is different from the pay-per-token Open Platform atapi.moonshot.ai.
/login kimi-coder, no API keys to copyzai thinking formatkimi-for-coding (stable alias), kimi-k2.6 (direct), and kimi-k2-thinking (deep reasoning)uv tool install kimi-cli or pip install kimi-clipi install npm:pi-kimi-coder
pi -e npm:pi-kimi-coder
pi install git:github.com/picassio/pi-kimi-coder
pi install -l npm:pi-kimi-coder
The extension supports three authentication methods, in order of convenience.
If you have kimi-cli installed and logged in, no extra setup is needed. The extension reads your credentials directly from ~/.kimi/credentials/kimi-code.json.
# If you haven't logged in yet:
kimi-cli login
# Then just start pi — credentials are picked up automatically
pi --provider kimi-coder --model kimi-for-coding
You'll see a notification: "Kimi Coder: using kimi-cli credentials".
Use pi's built-in OAuth device flow. No kimi-cli required.
pi
/login kimi-coder
This will:
If you have an API access token (e.g. from the Moonshot Open Platform), set it directly:
export KIMI_CODER_API_KEY="your-token-here"
pi --provider kimi-coder --model kimi-for-coding
Or add it to ~/.pi/agent/settings.json:
{
"apiKeys": {
"KIMI_CODER_API_KEY": "your-token-here"
}
}
Note: Tokens from the Coding Plan are short-lived OAuth tokens. For persistent access without kimi-cli, use Option B.
pi --provider kimi-coder --model kimi-for-coding
/model kimi-coder/kimi-for-coding
Add to ~/.pi/agent/settings.json:
{
"defaultProvider": "kimi-coder",
"defaultModel": "kimi-for-coding"
}
pi --provider kimi-coder --model kimi-for-coding -p "explain this error" < error.log
# Inside pi
/thinking high
# Or via CLI
pi --provider kimi-coder --model kimi-for-coding --thinking high -p "refactor this function"
| Model ID | Display Name | Context | Reasoning | Image | Description |
|---|---|---|---|---|---|
kimi-for-coding | Kimi for Coding (K2.6) | 262K | ✅ | ✅ | Stable alias, coding-optimized, default for Coding Plan |
kimi-k2.6 | Kimi K2.6 | 262K | ✅ | ✅ | Direct K2.6 access, Moonshot's latest flagship |
kimi-k2-thinking | Kimi K2 Thinking | 262K | ✅ | ✅ | Deep reasoning mode for complex multi-step problems |
All models:
zai thinking format (extended reasoning via reasoning_content in streamed responses)┌──────────────────────────────────────────────┐
│ pi │
│ │
│ ┌────────────────────────────────────────┐ │
│ │ pi-kimi-coder extension │ │
│ │ │ │
│ │ • Registers "kimi-coder" provider │ │
│ │ • Auto-imports kimi-cli tokens │ │
│ │ • Handles OAuth device flow │ │
│ │ • Refreshes tokens in background │ │
│ └──────────────┬─────────────────────────┘ │
│ │ │
│ ┌──────────────▼─────────────────────────┐ │
│ │ openai-completions API adapter │ │
│ │ (built into pi) │ │
│ └──────────────┬─────────────────────────┘ │
│ │ │
└─────────────────┼─────────────────────────────┘
│ HTTPS + SSE streaming
│ Authorization: Bearer <token>
│ User-Agent: KimiCLI/1.5
▼
┌──────────────────────────────────────────────┐
│ https://api.kimi.com/coding/v1 │
│ (Kimi K2 Coding Plan API) │
└──────────────────────────────────────────────┘
Extension loads
│
├─ Read ~/.kimi/credentials/kimi-code.json
│ └─ Found? → Set KIMI_CODER_API_KEY env var
│
├─ Seed ~/.pi/agent/auth.json (for OAuth refresh)
│
├─ Register "kimi-coder" provider with pi
│
└─ Session starts
│
├─ Token < 5 min remaining?
│ └─ Yes → Refresh via https://auth.kimi.com
│ Save to ~/.kimi/credentials/
│ Update env var
│
└─ Start 10-minute refresh interval
│
└─ Every 10 min: check token, refresh if < 5 min left
Credentials are stored in two locations and kept in sync:
| Location | Format | Used by |
|---|---|---|
~/.kimi/credentials/kimi-code.json | { access_token, refresh_token, expires_at, ... } | kimi-cli, pi-kimi-coder |
~/.pi/agent/auth.json | { type: "oauth", access, refresh, expires } | pi OAuth system |
~/.kimi/credentials/ → writes to ~/.pi/agent/auth.json~/.pi/agent/settings.jsonThe extension is listed under packages after installation:
{
"packages": [
"npm:pi-kimi-coder"
]
}
If you're using a self-hosted or proxied Kimi API, set the base URL via environment variable:
export KIMI_CODE_BASE_URL="https://your-proxy.example.com/v1"
The extension uses https://api.kimi.com/coding/v1 by default.
pi-moonshot is a separate extension for the Moonshot Open Platform (pay-per-token). Here's how they differ:
| pi-kimi-coder | pi-moonshot | |
|---|---|---|
| API endpoint | api.kimi.com/coding/v1 | api.moonshot.ai/v1 |
| Authentication | OAuth device flow | API key (MOONSHOT_API_KEY) |
| Billing | Subscription (K2 Coding Plan) | Pay-per-token |
| Primary model | kimi-for-coding | kimi-k2.6 |
| kimi-cli interop | ✅ Shared credentials | ❌ |
| Token refresh | ✅ Automatic | N/A (static key) |
| User-Agent header | ✅ Required by API | Not needed |
| All Moonshot models | ❌ Only coding models | ✅ Legacy + new models |
Which one should I use?
pi-kimi-coder (this extension)pi-moonshotYou can install both simultaneously — they register different provider names (kimi-coder vs moonshot).
Your OAuth token has expired. Fix:
# If you have kimi-cli:
kimi-cli login
# Or via pi:
/login kimi-coder
The API checks the User-Agent header. This extension sets it to KimiCLI/1.5 automatically. If you're seeing this error, ensure you're using the extension (not raw API calls).
No credentials were found anywhere. Solutions:
kimi-cli login/login kimi-coderexport KIMI_CODER_API_KEY="..."The extension automatically refreshes tokens every 10 minutes. If you see auth errors after a very long session:
/login kimi-coder
Delete stale credentials and re-login:
rm ~/.kimi/credentials/kimi-code.json
kimi-cli login
# pi will pick up the new credentials automatically on next start
/model selectorEnsure the extension is installed:
pi list
If pi-kimi-coder is not listed:
pi install npm:pi-kimi-coder
pi-kimi-coder/
├── extensions/
│ └── index.ts # Extension entry point
├── package.json # Pi package manifest
├── README.md
└── LICENSE
openai-completions adapter"zai" — the API streams reasoning in reasoning_content delta fields (same format as DeepSeek/Qwen thinking)https://auth.kimi.com17e5f671-d194-4dfb-9706-5516cb48c098 (Kimi Code's official client ID, shared with kimi-cli)User-Agent matches a known coding agent pattern# Run pi with the extension from source (no install needed)
pi -e ./pi-kimi-coder
# Test in print mode
pi -e ./pi-kimi-coder --provider kimi-coder --model kimi-for-coding -p "hello"
Edit extensions/index.ts directly — pi loads TypeScript via jiti, no build step needed. If installed, use /reload in pi to pick up changes.
MIT
FAQs
Pi extension for Kimi K2 Coding plan — OAuth-based provider with kimi-for-coding model
The npm package pi-kimi-coder receives a total of 33 weekly downloads. As such, pi-kimi-coder popularity was classified as not popular.
We found that pi-kimi-coder demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
vlt 1.5.0 links skills from JavaScript dependencies to coding agents, with lockfile versioning and Socket data to filter out known malicious packages.

Security News
Rust 1.100 will add opt-in dependency cooldowns to Cargo, giving security scanners and maintainers time to catch malicious crate releases.

Security News
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.