Kimi K3
Connect to Kimi K3 through the OpenAI Chat Completions compatible API, including CC Switch routing steps for Claude Code and Codex CLI.
Kimi K3 uses HopBase's OpenAI Chat Completions compatible protocol. Use https://api.hop-base.com/v1 and set the model to kimi-k3.
Kimi K3 is Moonshot AI's latest flagship model: a 1M context window (1,048,576 tokens) with up to 32,768 output tokens per response. It reads text and images (images as base64 only).
Group selection and billing
- When creating or editing an API key under API Keys in the console, add the Kimi K3 Cloud group to the key. That key can then call
kimi-k3. - Your effective rate is shown in the signed-in model catalog.
- Keys without this group get a clear 404 when calling
kimi-k3; add the group to the key in the console.
Client fields
| Field | Value |
|---|---|
| API address / Base URL | https://api.hop-base.com/v1 |
| API Key | sk-your-key |
| Model | kimi-k3 |
| API format | OpenAI Chat Completions (in CC Switch and other routing-capable clients, choose OpenAI Chat Completions (Requires routing)) |
| Context window | 1,048,576 tokens |
| Max output per response | 32,768 tokens |
Client support
Kimi K3 serves POST /v1/chat/completions only. Both /v1/responses and /v1/messages return 404 for this model, so clients that only speak the OpenAI Responses protocol or the Anthropic Messages protocol need a protocol translation layer.
| Client | Native protocol | How to connect |
|---|---|---|
| OpenAI SDK, curl, LobeChat, Dify, Cherry Studio, and similar | Chat Completions | Enter the Base URL, key, and model directly; see the examples below |
| Claude Code | Anthropic Messages | Through CC Switch local routing; see the steps below |
| Codex CLI | OpenAI Responses | Through CC Switch local routing; see the steps below |
Codex CLI removed wire_api = "chat" in 0.122; it now refuses to start with wire_api = "chat" is no longer supported. With wire_api = "responses" it calls /v1/responses, which returns 404 for this model. Neither path works, so Codex must go through CC Switch routing.
Request parameters
Measured parameter by parameter through the production gateway on 2026-10-10. The gateway rejects empty messages and removes the parameters marked "accepted, ignored" below; every other limit comes from the model service.
| Parameter | Required | Type & limits | Default | Description |
|---|---|---|---|---|
model | Required | kimi-k3 | — | Exact match |
messages | Required | Non-empty array; text and base64 images | — | Missing or empty is rejected by the gateway with 400; for images see the note below |
max_tokens | Optional | Integer 1–32,768 | Service default | Below 1 returns 400 Input should be greater than or equal to 1; above 32,768 returns 422 max_completion_tokens=… exceeds the limit of 32768 |
temperature | Optional | Number 0–1 | Service default | Above 1 returns 400. Use this to control randomness |
top_p | Optional | Accepted, ignored | — | Removed before the request reaches the model; use temperature instead |
n | Optional | 1 only | 1 | Above 1 returns 400 |
frequency_penalty, presence_penalty | Optional | Accepted, ignored | — | Removed before the request reaches the model |
seed, stop | Optional | As in OpenAI | — | Work as tested. logprobs is accepted, but no log probabilities are returned |
response_format | Optional | json_object / json_schema (including strict) | Plain text | |
tools, tool_choice, parallel_tool_calls | Optional | As in OpenAI; tool_choice can be auto / required / a named function | auto | $ref / $defs / anyOf schemas work |
stream | Optional | Boolean | false | |
stream_options.include_usage | Optional | Boolean | false | Must be true to get usage in the last streamed chunk |
thinking, reasoning_effort | Optional | Accepted, no effect | — | The model returns no thinking; see below |
Send images as data:image/...;base64, URLs in image_url. A public image URL (https://...) returns 400 with an error that only says to check the request parameters, so download and encode the image first.
Use Kimi K3 in Claude Code with CC Switch
Use CC Switch 3.17.0 or later (the latest release is recommended). Kimi K3 uses OpenAI Chat Completions, so CC Switch must translate requests through its local router into the Anthropic Messages protocol used by Claude Code.
Add a HopBase Kimi provider
Open CC Switch, select the Claude Code tab, select + in the upper-right corner, then choose Custom Configuration. Enter:
- Provider name:
HopBase Kimi K3 - API Key: your
sk-key - Request URL:
https://api.hop-base.com/v1(no trailing slash)
Set the format and model mapping
Expand Advanced Options, apply these settings, then save:
- Format (called API format in older versions): OpenAI Chat Completions (Requires routing)
- Auth Field: keep the default ANTHROPIC_AUTH_TOKEN
- Default fallback model:
kimi-k3 - Model Mapping: map the Sonnet, Opus, Fable, and Haiku roles all to
kimi-k3, so the main conversation and background subtasks both stay on K3
After saving, the provider card shows Needs Routing.
Enable local routing
Open Settings → Routing → Local Routing. Turn on the Routing Master Switch, then enable Claude Code under Routing Enabled. Confirm the first-run message and leave CC Switch running in the background.
Enable and verify the provider
Return to the Claude Code provider list and select Enable on the HopBase Kimi K3 card. After enabling routing takeover for the first time, close and reopen the terminal, run claude, and send a short prompt.
Return to Settings → Routing. The setup works when Current Provider shows HopBase Kimi K3 and the request count increases. Once routing is active, later provider switches are hot-swapped without another terminal restart.
Use Kimi K3 in Codex CLI with CC Switch
This also requires CC Switch 3.17.0 or later. CC Switch keeps Codex talking Responses to the local router (default 127.0.0.1:15721); the router rewrites each request into Chat Completions for HopBase and converts the response back into Responses form.
Add a Codex provider
Select the Codex tab, select + in the upper-right corner, then choose Custom Configuration. Enter:
- Provider name:
HopBase Kimi K3 - API Key: your
sk-key - Request URL:
https://api.hop-base.com/v1(the service root, without/chat/completions)
Set the format and model
Expand Advanced Options, apply these settings, then save:
- Format: Chat Completions (routing required)
- Model Name:
kimi-k3 - Default Model:
kimi-k3 - Model Mapping: add a row for
kimi-k3so the Codex/modelmenu lists it - Leave Supports Thinking Mode and Supports Reasoning Effort off: Kimi K3 currently returns no thinking content (see below)
After saving, the card shows Needs Routing. CC Switch points ~/.codex/config.toml at http://127.0.0.1:15721/v1 and keeps wire_api = "responses"; the real key stays inside CC Switch and is injected by the router.
Enable routing and take over Codex
Open Settings → Routing → Local Routing. Turn on the Routing Master Switch, then enable Codex under Routing Enabled.
Enable and verify the provider
Return to the Codex provider list and select Enable on the HopBase Kimi K3 card. Close and reopen the terminal, then run codex. Use /model to confirm the current model is kimi-k3, send a short prompt, and check that the request count grows under Settings → Routing.
Thinking output, prefix caching, and tool calls
Measured by HopBase through the production gateway in October 2026:
- Kimi K3 currently returns no thinking trace. Responses carry no
reasoning_contentfield andusage.completion_tokens_details.reasoning_tokensis always 0, so every output token is answer text. Sendingthinkingorreasoning_effortdoes not fail, but has no effect. Sizemax_tokensfor the answer alone (up to 32,768); nothing needs to be reserved for thinking. - Long context works and retrieves accurately. A single input of about 470,000 tokens returned normally, and a fact buried in it was retrieved exactly.
- Prefix caching hits the whole prefix. Repeating the same prefix makes
usage.prompt_tokens_details.cached_tokensequal to the matched prefix length (a 2,093-token system prompt hits all 2,093 on the second call), billed at the cached rate. Keep the system prompt, tool definitions, and other fixed content at the front of the message list. - Tool calling works.
tools,tool_choice(includingrequired),parallel_tool_calls, JSON Schemas using$refand$defs, and multi-turntoolmessages all behave normally in both streaming and non-streaming mode. - Latency reference. In a 10-minute sustained load test the median time to first token was about 1.7 seconds, and a 9,000-token non-streaming answer returned in about 78 seconds. Keep client retries and a read timeout of at least 300 seconds.
OpenAI SDK / Python
from openai import OpenAI
client = OpenAI(
base_url="https://api.hop-base.com/v1",
api_key="sk-your-key",
)
resp = client.chat.completions.create(
model="kimi-k3",
max_tokens=4096,
messages=[{"role": "user", "content": "Explain where Kimi K3 works best"}],
)
print(resp.choices[0].message.content)
print(resp.usage)curl
curl https://api.hop-base.com/v1/chat/completions \
-H "Authorization: Bearer sk-your-key" \
-H "Content-Type: application/json" \
-d '{
"model": "kimi-k3",
"max_tokens": 4096,
"messages": [{"role": "user", "content": "Hello, introduce yourself"}]
}'FAQ
/v1/responsesor/v1/messagesreturns 404. This model only has/v1/chat/completions. Route Codex CLI and Claude Code through CC Switch as described above; do not put the HopBase address directly into~/.codex/config.tomlorANTHROPIC_BASE_URL.- Codex fails to start with
wire_api = "chat"is no longer supported. Newer Codex no longer supports direct Chat Completions. Remove the hand-written provider config and let CC Switch take over. - Calling
kimi-k3returns 404 model not found. The key does not include the Kimi K3 Cloud group; add the group to the key or create a new key. - The Codex
/modelmenu does not listkimi-k3. Restart Codex after saving the model mapping so the menu refreshes. - A 400 that only says to check the request parameters. Look first at a
temperatureabove 1, annabove 1, or an image sent as a public URL instead of base64. - A 429 saying the concurrency limit is reached. That is your account concurrency limit, 5 by default. Ask us to raise it before running concurrency benchmarks or multi-agent workloads.
Next steps
- OpenAI SDK — the general Chat Completions pattern
- CC Switch — installing and troubleshooting the local router
- Error codes and retries
- Concurrency, timeouts, and billing