Install
openclaw skills install @runapi-ai/runapi-glmCall the GLM API (glm-5.2, glm-5.1, glm-5-turbo, glm-5, glm-4.7, glm-4.6, glm-4.5, glm-4.5-air) through RunAPI using the official OpenAI SDK or compatible clients. Use when the user asks for GLM 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-glmUse 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="glm-5.2",
messages=[{"role": "user", "content": "Summarize this design review."}],
)
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: "glm-5.2",
messages: [{ role: "user", content: "Summarize this design review." }],
});
curl -X POST "https://runapi.ai/v1/chat/completions" \
-H "Authorization: Bearer YOUR_RUNAPI_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5.2",
"messages": [{"role": "user", "content": "Hello, GLM!"}]
}'
stream = client.chat.completions.create(
model="glm-5-turbo",
messages=[{"role": "user", "content": "Write a short implementation plan."}],
stream=True,
)
for chunk in stream:
delta = chunk.choices[0].delta.content
if delta:
print(delta, end="", flush=True)
Streaming returns partial output as it is generated. Use it for long responses.
GLM models are also available through RunAPI's Anthropic-compatible Messages
and Gemini-compatible contents interfaces. Use these protocol paths when an
existing agent runtime requires their request shapes:
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": "glm-4.6",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Draft a concise answer."}]
}'
curl -X POST \
"https://runapi.ai/v1beta/models/glm-4.6: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 |
|---|---|
glm-5.2 | Current flagship text workloads |
glm-5.1 | Latest GLM chat workloads |
glm-5-turbo | Faster GLM chat |
glm-5 | General GLM 5 requests |
glm-4.7 | GLM 4.7 compatibility |
glm-4.6 | Stable GLM 4.6 requests |
glm-4.5 | GLM 4.5 compatibility |
glm-4.5-air | Lightweight GLM 4.5 requests |
| Capability | Current behavior |
|---|---|
| Text history, sync, streaming | Supported across Chat, Responses, Messages, and Gemini-compatible requests |
| Default thinking | Disabled for consistent cross-protocol output |
| Reasoning controls/content, function tools/history, structured output | Reject with unsupported_model_capability; do not retry without the field silently |
| Hosted tools, explicit cache controls, stateful continuation, protocol-specific controls | Reject; RunAPI does not currently expose the required protocol surface |
| Cache/reasoning Usage | Preserve returned fields and never infer omitted details; Messages has no caller-visible reasoning-token breakdown |
| Context window | Keep estimated input at or below 1000000 tokens; full-window execution remains readiness-gated |
| Maximum output | Keep the protocol-specific value at or below 131072; larger values return model_limit_exceeded before request execution |
| Multimodal input | Reject with unsupported_model_capability |
Do not present the model's 1M context envelope as a RunAPI execution guarantee. Full-window execution remains subject to published model readiness.
OPENAI_API_KEY, RUNAPI_TOKEN, or a secret manager; never
inline them in commits or shell history.https://runapi.ai/v1.glm-5.2 requests text-only. Use only text history until the capability
table marks an advanced feature ready.