← Catalog

kimicodeprovider

pi-coding-agent extension for Kimi/Moonshot API with configurable base URL

Extension

Install

Install with PiG

pig install npm:kimicodeprovider

Install with Pi

pi install npm:kimicodeprovider
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./extensions/index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.1.0 (README.md). PiG does not review it.

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:kimicodeprovider

For project-local installation:

pi install npm:kimicodeprovider -l

Configuration

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:

pi

Then 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-coding

Available Models

After installation, these models will be available in pi:

ModelBest ForContextMax TokensReasoningVision
kimi-for-codingCoding tasks262K32KYesNo
kimi-k2.5Multimodal + reasoning262K32KYesYes
kimi-latestLatest general model131K131KNoYes
kimi-k2-turbo-previewFast responses262K32KNoNo
kimi-k2-thinkingDeep reasoning262K32KYesNo
moonshot-v1-8kLegacy V1 series8K8KNoNo
moonshot-v1-32kLegacy V1 series32K32KNoNo
moonshot-v1-128kLegacy V1 series128K128KNoNo

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 appends v1

Custom User-Agent

export KIMI_USER_AGENT="YourApp/1.0"

Default: KimiCLI/1.3

Environment Variables

VariableRequiredDefaultDescription
MOONSHOT_API_KEYYes-Your Moonshot API key
KIMI_BASE_URLNohttps://api.kimi.com/coding/v1Custom API base URL
KIMI_USER_AGENTNoKimiCLI/1.3Request User-Agent header

Troubleshooting

Kimi models not showing in selector:

  • Run /reload in pi to refresh extensions
  • Verify the extension is installed: pi list
  • Check that MOONSHOT_API_KEY is 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:kimicodeprovider

About 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