Text Z.ai

GLM API

Use the GLM API via RunAPI with a model skill, unified auth, and pay-as-you-go pricing.

runapi.ai
# Base URL
https://runapi.ai

# Endpoints
POST /v1/chat/completions
POST /v1/responses
POST /v1/messages
POST /v1beta/models/{model}:generateContent
POST /v1beta/models/{model}:streamGenerateContent
curl https://runapi.ai/v1/chat/completions \
  -H "Authorization: Bearer $RUNAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "glm-5.3",
  "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.3",
    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.3",
  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." }]
});
https://runapi.ai 5 endpoints
OVERVIEW

About GLM

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.

Provider
Z.ai
Modality
Text

GLM API endpoints

EndpointProtocol
POST /v1/chat/completionsOpenAI compatible
POST /v1/responsesOpenAI Responses
POST /v1/messagesAnthropic compatible
POST /v1beta/models/{model}:generateContentGemini generateContent
POST /v1beta/models/{model}:streamGenerateContentGemini streamGenerateContent

Available Versions

Variant Billing Pricing
glm-4.5 1K tokens Input $0.41 / 1M tokens | Output $1.61 / 1M tokens View →
glm-4.5-air 1K tokens Input $0.10 / 1M tokens | Output $0.55 / 1M tokens View →
glm-4.6 1K tokens Input $0.60 / 1M tokens | Output $1.22 / 1M tokens View →
glm-4.7 1K tokens Input $0.60 / 1M tokens | Output $1.19 / 1M tokens View →
glm-5 1K tokens Input $1.00 / 1M tokens | Output $1.60 / 1M tokens View →
glm-5-turbo 1K tokens Input $1.20 / 1M tokens | Output $2.00 / 1M tokens View →
glm-5.1 1K tokens Input $1.40 / 1M tokens | Output $2.20 / 1M tokens View →
glm-5.2 1K tokens Input $0.70 / 1M tokens | Output $2.20 / 1M tokens View →
glm-5.3 1K tokens Input $1.40 / 1M tokens | Output $4.40 / 1M tokens View →
PRICING

GLM Pricing

Endpoint Resolution Duration Price
chat_completion — — Input $0.41 / 1M tokens | Output $1.61 / 1M tokens

Prices shown for glm-4.5. Other variants retain their own endpoint pricing.

Agent integration

Run GLM From an Agent

HOW IT WORKS

Get Started with GLM

  1. Create an API key

    Sign up and generate an API key from the dashboard.

  2. Pick a version

    Choose the version that best matches your quality and cost requirements.

  3. Send a request

    Submit your prompt and parameters to the model's documented endpoint.

  4. Get your result

    Poll the task or set a webhook, then download the completed output.

CONTEXT

About GLM on RunAPI

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.

Provider
Z.ai
See all →
Modality
Text
Browse models →

Why Use GLM Through RunAPI

One auth, every provider

A single RunAPI API key unlocks the whole model catalog across all providers. No separate accounts to create, no API keys to rotate per integration, and no credential management overhead. Add a new model to your app by changing one parameter.

Unified pricing & billing

Per-call pricing in USD, billed monthly into a single invoice. No subscription tiers, no minimum spend, and failed generations are never charged. The pricing page and check_pricing API show exact costs before you commit to a model.

Schema-first SDK

Typed schemas, parameter constraints, and setup notes are packaged in the model skill so your implementation starts from the right contract. The skill loads into Claude Code, Codex, Gemini CLI, Cursor, and VS Code — your agent knows the correct request shape before you write a line of code.

GLM Questions

What are the GLM models good at?

Coding and agentic tool use. GLM-5.1 leads open-weight models on SWE-bench Pro (58.4%) and scores 95.3% on AIME 2026. The full line is strong at multi-step tool calling, code generation across large codebases, and mathematical reasoning.

What is the difference between glm-4.5 and glm-4.5-air?

glm-4.5 is the 355B flagship (32B active parameters) with 128K context; glm-4.5-air is a lighter 106B MoE (12B active) for faster, lower-cost everyday work.

How does GLM-5 compare to GLM-4.7?

GLM-5 scales to 744B total / 40B active with 256 experts, versus GLM-4.7's 358B / 32B. SWE-bench Verified jumps from 73.8% to 77.8%. Both share 200K context.

Which SDKs can call GLM through RunAPI?

Point the OpenAI SDK (Chat Completions or Responses) or the Anthropic Messages SDK at RunAPI and pass the GLM model id; the proxy adapts the protocol for you.

How is GLM billed?

Per token, pay-as-you-go, at RunAPI's published input and output rates for each GLM model — no subscription.

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.

SIMILAR MODELS

Similar Text Models

Start generating with GLM