Install
openclaw skills install @runapi-ai/runapi-kimiCall the Kimi API (kimi-k3, kimi-k2.7-code, kimi-k2.6, kimi-k2.5) through RunAPI using the official OpenAI SDK or compatible clients. Use when the user asks for Kimi chat, streaming completions, Anthropic or Gemini protocol compatibility, or when they want to point an existing OpenAI SDK setup at RunAPI as the base URL.
openclaw skills install @runapi-ai/runapi-kimiUse the official OpenAI SDK or any OpenAI-compatible HTTP client and switch
the base URL to https://runapi.ai/v1. The primary endpoint is Chat
Completions (POST /v1/chat/completions).
OPENAI_API_KEY=YOUR_RUNAPI_TOKEN
OPENAI_BASE_URL=https://runapi.ai/v1
Get a RunAPI API Key at https://runapi.ai/api_keys.
from openai import OpenAI
client = OpenAI(
api_key="YOUR_RUNAPI_TOKEN",
base_url="https://runapi.ai/v1",
)
response = client.chat.completions.create(
model="kimi-k3",
messages=[{"role": "user", "content": "Explain this code review finding."}],
)
print(response.choices[0].message.content)
print(response.usage)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "YOUR_RUNAPI_TOKEN",
baseURL: "https://runapi.ai/v1",
});
const response = await client.chat.completions.create({
model: "kimi-k3",
messages: [{ role: "user", content: "Explain this code review finding." }],
});
stream = client.chat.completions.create(
model="kimi-k2.5",
messages=[{"role": "user", "content": "Write a compact changelog."}],
stream=True,
)
for chunk in stream:
delta = chunk.choices[0].delta.content
if delta:
print(delta, end="", flush=True)
Streaming runs through a regional edge proxy so the request does not hold a Rails/Puma thread. Long generations should always stream.
Kimi models are also available through RunAPI's Anthropic-compatible and Gemini
contents client surfaces. RunAPI bridges those request and response shapes to
the OpenAI-compatible chat request format, so use these protocol paths only when an
existing tool expects those formats:
curl -X POST "https://runapi.ai/v1/messages" \
-H "x-api-key: YOUR_RUNAPI_TOKEN" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "kimi-k3",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Draft a concise answer."}]
}'
curl -X POST \
"https://runapi.ai/v1beta/models/kimi-k3:streamGenerateContent" \
-H "x-goog-api-key: YOUR_RUNAPI_TOKEN" \
-H "Content-Type: application/json" \
-d '{"contents":[{"role":"user","parts":[{"text":"Hello!"}]}]}'
For new app code, prefer the OpenAI-compatible setup.
curl https://runapi.ai/v1/models \
-H "Authorization: Bearer YOUR_RUNAPI_TOKEN"
| Model ID | Use when |
|---|---|
kimi-k3 | Current flagship for text requests with always-on reasoning |
kimi-k2.7-code | Dedicated coding model with always-on thinking |
kimi-k2.6 | Latest Kimi K2 chat workloads |
kimi-k2.5 | Kimi K2.5 compatibility |
Across Chat Completions, Responses, Messages, and Gemini native, RunAPI supports
basic text, final answers, canonical reasoning/cache Usage, and automatic cache
handling for kimi-k3 and kimi-k2.7-code. Raw reasoning_content is not
returned.
Do not send explicit reasoning controls, tools or tool history, multimodal
content, structured-output fields, cache IDs/TTL controls, opaque continuation
state, or signed thought blocks. These shapes fail before a task is created.
kimi-k3 reasoning effort and both models' tools/multimodal features are
native-only; kimi-k2.7-code reasoning effort, explicit cache expiry,
opaque continuation, and protocol-signed thoughts are cull.
Omit sampling controls, or use temperature=1.0, top_p=0.95, n=1,
presence_penalty=0, and frequency_penalty=0. Keep requested output at or
below 131072 tokens for kimi-k3 and 32768 tokens for kimi-k2.7-code. For
Chat Completions, send either max_tokens or max_completion_tokens, never
both.
OPENAI_API_KEY, RUNAPI_TOKEN, or a secret manager; never
inline them in commits or shell history.https://runapi.ai/v1.kimi-k3 and kimi-k2.7-code, send basic text only and consume the final
answer plus Usage; do not depend on raw reasoning or stateful continuation.