Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kimi-codex-proxy

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.

What it does

  • Accepts POST /v1/responses in 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 Authorization header.

Requirements

  • Node.js 18+
  • A Kimi Code API key

Installation

git clone https://github.com/YOUR_USERNAME/kimi-codex-proxy.git
cd kimi-codex-proxy
npm install

Configuration

Copy the example environment file and add your key:

cp .env.example .env

Edit .env:

PROXY_PORT=8787
UPSTREAM_URL=https://agent-gw.kimi.com/coding/v1/chat/completions
UPSTREAM_KEY=your-kimi-api-key

You can also start the proxy without UPSTREAM_KEY and have the client send the key in the Authorization header.

Usage

Start the proxy

npm start

Or directly:

node index.js

The proxy listens on http://127.0.0.1:8787 by default.

Point a Responses API client at it

# Example with OpenAI Codex CLI
openai codex --base-url http://127.0.0.1:8787/v1 --model kimi-for-coding

Or 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"
  }'

Health check

curl http://127.0.0.1:8787/health

Supported features

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)

Environment variables

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

Development

# Syntax check
npm test

# Start with live reload (optional)
npx nodemon index.js

License

MIT

About

转换 kimi 的 api 格式,让他可以在 codex 中使用

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages