A minimal, zero-dependency proxy that exposes an OpenAI Responses API-compatible endpoint on localhost and forwards requests to the Kimi Code Chat Completions API.
This is handy when you have a client that only speaks the OpenAI Responses API (for example, the OpenAI Codex CLI) but you want to run against Kimi Code models.
- Accepts
POST /v1/responsesin OpenAI Responses API format. - Translates the request into a Kimi Code Chat Completions request.
- Streams the Chat Completions SSE response back as Responses API SSE events.
- Falls back to a full JSON response when streaming is not available.
- Supports passing the API key via environment variable or client
Authorizationheader.
- Node.js 18+
- A Kimi Code API key
git clone https://github.com/YOUR_USERNAME/kimi-codex-proxy.git
cd kimi-codex-proxy
npm installCopy the example environment file and add your key:
cp .env.example .envEdit .env:
PROXY_PORT=8787
UPSTREAM_URL=https://agent-gw.kimi.com/coding/v1/chat/completions
UPSTREAM_KEY=your-kimi-api-keyYou can also start the proxy without UPSTREAM_KEY and have the client send the key in the Authorization header.
npm startOr directly:
node index.jsThe proxy listens on http://127.0.0.1:8787 by default.
# Example with OpenAI Codex CLI
openai codex --base-url http://127.0.0.1:8787/v1 --model kimi-for-codingOr with curl:
curl -N http://127.0.0.1:8787/v1/responses \
-H "Authorization: Bearer $UPSTREAM_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kimi-for-coding",
"input": "Write a hello-world in Python"
}'curl http://127.0.0.1:8787/health| Feature | Status |
|---|---|
| Text prompts | ✅ |
| Multi-turn messages | ✅ |
| Streaming responses | ✅ |
| Developer/system messages | ✅ (mapped to system) |
| Temperature / max tokens | ✅ |
| Client-provided API key | ✅ |
| Tools / function calling | ❌ (not implemented) |
| Vision / image input | ❌ (not implemented) |
| Name | Default | Description |
|---|---|---|
PROXY_PORT |
8787 |
Local port to listen on |
UPSTREAM_URL |
https://agent-gw.kimi.com/coding/v1/chat/completions |
Kimi Code Chat Completions endpoint |
UPSTREAM_KEY |
(none) | Default upstream API key |
# Syntax check
npm test
# Start with live reload (optional)
npx nodemon index.jsMIT