GLM API
Z.ai GLM API access via RunAPI — MIT-licensed MoE models with up to 200K context, leading open-weight coding benchmarks.
# Base URL
https://runapi.ai
# Endpoints
POST /v1/chat/completions
curl https://runapi.ai/v1/chat/completions \
-H "Authorization: Bearer $RUNAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5.1",
"messages": [
{
"role": "user",
"content": "Read this multi-file repository, find the failing integration test, and propose a patch with an explanation of the root cause."
}
]
}'
from openai import OpenAI
client = OpenAI(
base_url="https://runapi.ai/v1",
api_key="your-runapi-key"
)
response = client.chat.completions.create(
model="glm-5.1",
messages=[{"role": "user", "content": "Read this multi-file repository, find the failing integration test, and propose a patch with an explanation of the root cause."}]
)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://runapi.ai/v1",
apiKey: "your-runapi-key"
});
const response = await client.chat.completions.create({
model: "glm-5.1",
messages: [{ role: "user", content: "Read this multi-file repository, find the failing integration test, and propose a patch with an explanation of the root cause." }]
});
GLM is Z.ai's family of MIT-licensed Mixture-of-Experts language models. GLM-4.5 (355B total / 32B active, 128K context) introduced the open-weight MoE line with a flagship and a lighter Air tier. GLM-4.6 and 4.7 extend to 200K context with stronger code generation — 4.7 reaches 73.8% on SWE-bench. The GLM-5 series (744B / 40B active, 200K context) pushes further to 77.8% SWE-bench Verified, and GLM-5.1 holds the top open-weight score on SWE-bench Pro at 58.4%. All are available through RunAPI with one key and per-token billing.
- Multiple variants for different speed / quality tiers
- Model skill includes docs, schemas, and setup notes
- Works with app-focused coding workflows
- Failed generations are not charged
Compare all API variants
GLM API endpoints
Use the OpenAI or Anthropic SDK with your RunAPI key. No extra SDK required.
| Endpoint | Protocol |
|---|---|
| /v1/chat/completions | OpenAI compatible |
From model skill to first result in four steps
Choose a model
Pick the model and variant that match your output type, quality bar, and latency target.
Configure
Set your RunAPI key and install the model skill in your coding workspace.
Call
Use the skill instructions to add the model feature inside your application.
Receive
Poll by task ID, stream when supported, or handle the webhook callback.
What is the GLM API?
GLM models from Z.ai are MIT-licensed MoE LLMs spanning 128K–200K context. GLM-5.1 leads open-weight models on SWE-bench Pro. Through RunAPI they share a single API key with pay-as-you-go token billing, callable from the OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages surfaces.
Why route the GLM API through RunAPI
One auth, every provider
A single RunAPI key unlocks the whole catalog. No separate accounts, no key rotation per integration.
Unified pricing & billing
Per-call pricing in USD, billed monthly. Failed generations are not charged.
Schema-first SDK
Typed schemas and setup notes are packaged in the model skill so implementation starts from the right contract.
Common questions
Which variant should I start with?
Pick the cheapest variant that meets your quality bar. Most teams start on the fast variant and graduate to pro for production.
Is there a free tier?
New accounts get free first calls on every model. After that, pay per call.
Do you stream results?
Where streaming is available, RunAPI streams end-to-end.
How are failures billed?
Failed generations are not charged.
Are outputs cached?
Generated outputs are stored and retrievable by task ID. Inputs are not cached.
Can I use commercially?
Yes — commercial use is included for every variant unless a model license explicitly restricts it, which is called out on the variant page.
What about rate limits?
Per-key rate limits scale with usage tier. See pricing page for current limits.
Where can I report issues?
Open an issue on the public GitHub repo or email support.