AIWave API

GLM API Pricing Guide: Save 80% on Your Large Language Model Costs

GLM is Zhipu AI's model family, and it is one of the few Chinese line-ups where the flagship and the workhorse sit far enough apart in price that picking the wrong one quietly doubles your bill for no quality gain. This is the breakdown I wanted before I moved a production summarization pipeline onto GLM: the real per-token numbers on AIWave, where each model earns its rate, and the code to wire it up.

Every figure below is the regular-tier USD rate AIWave reads from its own live pricing endpoint, quoted per 1M tokens. Rates move — providers revise them — so treat the live page as the source of truth before you budget.

GLM API pricing on AIWave (USD per 1M tokens)

ModelInputOutputCache hit (input)ContextWhere it fits
glm-4.6$0.930$3.410$0.220128KChat, RAG, extraction
glm-4.7$0.930$3.410$0.220128KSame price as 4.6, newer weights — prefer it
glm-5$1.550$4.960$0.400128KHarder reasoning, agent loops
glm-5-turbo$1.800$5.400$0.480128KLatency-sensitive GLM-5 tier
glm-5.1$2.100$6.600$0.680128KTop of the line, only when 5 misses

Two things jump out. First, glm-4.7 costs exactly what glm-4.6 costs — $0.930 in, $3.410 out — while running newer weights, so there is no reason to pin new code to 4.6. Second, the step from glm-4.7 to glm-5.1 is 2.3x on input and 1.9x on output. That gap only pays for itself on tasks where 4.7 actually fails, and most chat and extraction traffic never does.

Where the "save 80%" number actually comes from

The headline is real, but it depends on which comparison you draw. Output tokens dominate most bills, so compare output rates rather than input:

ModelOutput $/1Mvs glm-4.7 ($3.41)
Claude 3.5 Sonnet$15.00glm-4.7 is 77% cheaper
GPT-4o$10.00glm-4.7 is 66% cheaper
Gemini 1.5 Pro$5.00glm-4.7 is 32% cheaper
glm-5.1$6.60glm-4.7 is 48% cheaper

Against Claude 3.5 Sonnet's $15/1M output, glm-4.7 at $3.41 lands the full ~77% cut. Against GPT-4o it is 66%. The "80%" claim holds when your baseline is a frontier Western model and you route the bulk of traffic to glm-4.7 instead of reaching for glm-5.1 by reflex. The Western list prices here are the vendors' public rates — check their pricing pages, they change too.

The cache-hit rate is the discount most teams leave on the table

Every GLM model on AIWave bills cached input at a fraction of the normal input rate. For glm-4.7 that is $0.220 versus $0.930 — a 76% discount on any prompt prefix the platform has already seen. The mechanism is prefix caching: a stable prefix (system prompt, tool schemas, few-shot examples, a pinned document) that arrives byte-identical on repeated calls is billed at the cache rate instead of full input.

The design consequence is concrete: put everything constant first, everything variable last. A 4,000-token system prompt reused across 100k calls costs $0.220/1M on those prefix tokens instead of $0.930 — over that volume it is real money. Interleave a timestamp or a user id into the middle of the prompt and you shatter the prefix, forfeiting the discount on everything after it.

Calling GLM from Python

GLM on AIWave speaks the OpenAI-compatible protocol, so the official openai SDK works unmodified. Point base_url at AIWave and name the model:

from openai import OpenAI

client = OpenAI(
    api_key="sk-your-aiwave-key",
    base_url="https://aiwave.live/v1",
)

resp = client.chat.completions.create(
    model="glm-4.7",
    messages=[
        {"role": "system", "content": "You are a terse code reviewer."},
        {"role": "user", "content": "Is a bare `except:` ever acceptable in Python?"},
    ],
    max_tokens=400,
)

print(resp.choices[0].message.content)
print(resp.usage)  # prompt_tokens / completion_tokens is your bill

Print resp.usage while you tune. Output on glm-4.7 costs 3.7x what input costs, so a model that rambles is more expensive than the sticker implies. Cap it with max_tokens.

Calling GLM with curl

For a smoke test or a shell script, hit the endpoint directly — same URL, same JSON shape as OpenAI:

curl https://aiwave.live/v1/chat/completions \
  -H "Authorization: Bearer sk-your-aiwave-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5",
    "messages": [
      {"role": "user", "content": "Refactor this to drop the nested loop: ..."}
    ],
    "max_tokens": 800
  }'

Swap glm-5 for glm-4.7 and you are testing the 66%-cheaper path with one word changed. That is the entire point of an OpenAI-compatible gateway: model selection is a string, not a rewrite.

Calling GLM from Node.js

Same SDK story in JavaScript. This one streams, which you want for any user-facing chat so first-token latency is not gated on the full completion:

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.AIWAVE_KEY,
  baseURL: "https://aiwave.live/v1",
});

const stream = await client.chat.completions.create({
  model: "glm-4.7",
  stream: true,
  messages: [{ role: "user", content: "Explain prefix caching in two sentences." }],
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}

What a real month costs

Take a support-assistant workload: 8M input tokens and 4M output tokens a month, with 60% of input hitting the prefix cache (a fixed system prompt plus product docs). On glm-4.7:

The same traffic on GPT-4o (no cache modeled, $2.50/$10.00) runs 8M×$2.50 + 4M×$10.00 = $60.00. On Claude 3.5 Sonnet it is $84.00. glm-4.7 does the job at roughly a fifth to a quarter of the frontier cost, and the cache discount is carrying about a third of that saving. Run the identical numbers on glm-5.1 ($2.100/$6.600) and the month becomes ~$34 — still cheap, but double glm-4.7. Only accept that if a labeled eval shows 5.1 clearing failures 4.7 cannot.

Which GLM to actually pick

The mistake I see over and over is teams standardizing on the newest, biggest model for everything because it is the easiest thing to reason about. On GLM that reflex costs 2x. Cheap-first with a difficulty-based escalation to glm-5 and glm-5.1 is the pattern that keeps the bill flat while traffic grows.

Structured output and tool calling with GLM

GLM speaks the same tool-calling and JSON contract as OpenAI, which is what makes it viable for extraction and agents rather than only chat. Force valid JSON like this:

resp = client.chat.completions.create(
    model="glm-4.7",
    response_format={"type": "json_object"},
    messages=[
        {"role": "system", "content": "Extract as JSON: {title, author, year}."},
        {"role": "user", "content": citation_text},
    ],
)
import json
record = json.loads(resp.choices[0].message.content)

JSON mode guarantees parseable output, not a correct schema — validate fields yourself. Running extraction on glm-4.7 at $0.930/$3.410 is cheap enough to batch, and the cache rate applies to the fixed instruction prefix if you keep it first and byte-identical across calls.

glm-4.7 vs glm-5: a concrete decision

The jump from glm-4.7 ($0.930/$3.410) to glm-5 ($1.550/$4.960) is 1.67x input and 1.45x output. That is not a rounding error at volume, so do not pay it on faith. The test that settles it: take 50 real inputs where you suspect 4.7 is weak, run both models, and count actual failures — wrong answers, malformed output, missed steps — not stylistic preference. If glm-5 clears failures 4.7 could not, route the hard slice to it. If it does not, you just saved 45–67%. glm-5 earns its price on multi-step agent loops and dependency-heavy reasoning; it rarely earns it on chat, classification, or retrieval answers.

Getting a key and your first call

Access GLM through AIWave and there is Email or GitHub account options, no WeChat Pay, and no Zhipu account. Sign in with email or GitHub, mint a key, and the Python, curl, and Node snippets above work as-is against the $0.20 starter credit. Store the key in an environment variable rather than in source:

export AIWAVE_KEY="sk-your-aiwave-key"
# then read os.environ["AIWAVE_KEY"] (Python) or process.env.AIWAVE_KEY (Node)

That keeps keys out of your git history and makes rotation a config change instead of a redeploy.

Mistakes that inflate a GLM bill

GLM against DeepSeek and Kimi for the same job

GLM sits in the middle of the AIWave line-up: pricier than DeepSeek, comparable to Kimi on output, and a strong generalist for tool use and agents. Output rates tell the story:

ModelOutput $/1MReach for it when
deepseek-chatSee current pricingmost cost-effective capable generalist — most chat and extraction
glm-4.7$3.410Balanced reasoning, tool use, agent loops
kimi-k2.5$3.300Long context is the actual requirement
glm-5.1$6.600Hardest reasoning, final user-facing answers

If cost is the only axis, deepseek-chat wins by 9x on output. GLM's argument is reliability on structured and agentic work at a mid-tier price, with a clean upgrade path from 0.638 to 5 to 1.914 as difficulty rises — no code change, just a model string.

How the price gets this low

These are the regular-tier USD prices AIWave resells at, derived from the platform's pricing formula rather than a marked-up retail sticker. Because access is aggregated across many developers, the per-token cost passed through is close to wholesale, which is how glm-4.7 lands at $3.410/1M output against a frontier Western model's $10–15. There is no quality trade implied by the low number — it is the same Zhipu weights, billed through a leaner channel with USD and card payments payment instead of WeChat and Alipay.

When latency is the constraint: glm-5-turbo

glm-5-turbo ($1.800/$5.400) exists for one reason — it is the fast lane of the GLM-5 tier. You pay a premium over glm-5 ($1.550/$4.960), about 16% on input and 9% on output, and in return you get lower latency at the same reasoning class. That trade only makes sense for interactive, user-facing paths where response time is the bottleneck. For batch jobs, background pipelines, or anything a queue absorbs, plain glm-5 is the cheaper and correct choice. Do not pay the turbo premium on traffic no human is waiting on.

The short version

Default to glm-4.7 — priced identically to 4.6 with newer weights, and it clears chat, RAG, extraction, and tool use. Escalate to glm-5 on measured failures, use glm-5-turbo when latency is the constraint, and reserve glm-5.1 for the hardest reasoning and the answers users read. Lean on the cache rate for stable prefixes, cap output with max_tokens, and route by difficulty rather than defaulting to the biggest model. Do that and GLM lands frontier-adjacent quality at roughly a fifth of frontier cost.

Ready to build? Get started at AIWave — no Chinese phone needed, $0.20 starter credit.

References

Terms of ServicePrivacy PolicyContact © 2026 AIWave

The full GLM family on AIWave, priced in USD from $0.93/M tokens (GLM-4.7). Start with $0.20 starter credits.

Explore Models →

Related: GLM-5 API guide · GLM-5 model