kimicodeprovider
v0.1.0
Published
pi-coding-agent extension for Kimi/Moonshot API with configurable base URL
Maintainers
Readme
KimiCodeProvider
A pi-coding-agent extension that adds support for Kimi Code API (Moonshot's coding-optimized API endpoint).
This extension registers a moonshot provider with all available Kimi models, allowing you to use Kimi's coding API with configurable base URL and User-Agent.
Installation
pi install npm:kimicodeproviderFor project-local installation:
pi install npm:kimicodeprovider -lConfiguration
1. API Key (Required)
Set your Moonshot API key as an environment variable:
export MOONSHOT_API_KEY="your-api-key-here"Add this to your shell profile (~/.bashrc, ~/.zshrc, etc.) to make it persistent.
2. Start Using Kimi Models
Once installed and the API key is set, restart pi and the Kimi models will appear in the model selector:
piThen press Ctrl+L to open the model selector and choose any Kimi model.
Or specify directly via command line:
pi --provider moonshot --model kimi-for-codingAvailable Models
After installation, these models will be available in pi:
| Model | Best For | Context | Max Tokens | Reasoning | Vision |
|-------|----------|---------|------------|-----------|--------|
| kimi-for-coding | Coding tasks | 262K | 32K | Yes | No |
| kimi-k2.5 | Multimodal + reasoning | 262K | 32K | Yes | Yes |
| kimi-latest | Latest general model | 131K | 131K | No | Yes |
| kimi-k2-turbo-preview | Fast responses | 262K | 32K | No | No |
| kimi-k2-thinking | Deep reasoning | 262K | 32K | Yes | No |
| moonshot-v1-8k | Legacy V1 series | 8K | 8K | No | No |
| moonshot-v1-32k | Legacy V1 series | 32K | 32K | No | No |
| moonshot-v1-128k | Legacy V1 series | 128K | 128K | No | No |
Advanced Configuration
Custom Base URL
By default, this extension uses the Kimi Code API endpoint: https://api.kimi.com/coding/v1
To use a custom endpoint (e.g., proxy or enterprise deployment):
export KIMI_BASE_URL="https://your-custom-endpoint.com/coding"The extension automatically handles URL formatting:
- If URL ends with
/coding, it appends/v1 - If URL ends with
/coding/, it appendsv1
Custom User-Agent
export KIMI_USER_AGENT="YourApp/1.0"Default: KimiCLI/1.3
Environment Variables
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| MOONSHOT_API_KEY | Yes | - | Your Moonshot API key |
| KIMI_BASE_URL | No | https://api.kimi.com/coding/v1 | Custom API base URL |
| KIMI_USER_AGENT | No | KimiCLI/1.3 | Request User-Agent header |
Troubleshooting
Kimi models not showing in selector:
- Run
/reloadin pi to refresh extensions - Verify the extension is installed:
pi list - Check that
MOONSHOT_API_KEYis set:echo $MOONSHOT_API_KEY
API errors:
- Verify your API key is valid at Moonshot Platform
- Check if your base URL is accessible
- For custom endpoints, ensure they support the OpenAI-compatible API format
Uninstall
pi remove npm:kimicodeproviderAbout Kimi Code API
This extension connects to Moonshot's Kimi Code API (api.kimi.com/coding/v1), which is optimized for coding tasks and provides access to the latest Kimi models including the kimi-for-coding model specifically fine-tuned for software development.
Learn more: Moonshot Platform
License
MIT
