NewKimi K3.1 Pro is now availableTry it now
GuidePublished 7 min read

GLM-5 Pricing: GLM-5.3, Flash & GLM-5.2 API Rates

Live GLM-5.3, GLM-5.3 Flash, and GLM-5.2 API pricing per 1M tokens on Inference.net, with prompt_cache_key rules, 40-turn session math, and SDK setup.

Inference.net

Live GLM-5 and GLM-5.3 API pricing on Inference.net

On Inference.net, GLM API pricing starts at $0.084 per 1M fresh input tokens, $0.079 per 1M cached reads, and $3.00 per 1M output tokens on glm-5.3 (1,048,576 context window, 943,718 max output tokens). For high-volume, output-heavy, or multimodal workloads, glm-5.3-flash costs $0.10 fresh input, $0.03 cached reads (70.0% discount), and $0.35 output per 1M tokens with text, image, and video inputs. Both glm-5.3 and glm-5.3-flash expose OpenAI /v1/chat/completions, /v1/responses, and native Anthropic /v1/messages with one API key.

All model IDs, context limits, and per-1M-token rates below were verified directly from GET https://api.inference.net/v1/models on 2026-12-06 (the API returns per-token prices; multiply by 1,000,000 for per-1M rates):

Model IDContext / max outputFresh input ($/1M)Cached read ($/1M)Output ($/1M)Tools & modalitiesHosting & ZDR scopeModel page
glm-5.31,048,576 / 943,718$0.084$0.079$3.00Tools, textInference.net-hosted (US, ZDR)GLM-5.3
glm-5.3-flash1,048,576 / 262,144$0.10$0.03$0.35Tools, text + image + videoInference.net-hosted (US, ZDR)GLM-5.3 Flash
glm-5.21,048,576 / 943,718$1.30$0.20$4.40Tools, textExternal route (upstream terms)GLM-5.2
glm-5.2-fast1,000,000 / 128,000$2.60$0.40$8.80Tools, textExternal route (upstream terms)GLM-5.2 Fast
glm-5204,800 / 131,072$0.95$0.20$2.55Text (supports_tools: false)External route (upstream terms)GLM-5

Note: glm-5.3 and glm-5.3-flash are always-thinking models supporting low, high, and max reasoning efforts (reasoning_effort: "none" is not supported). See Reasoning docs for per-model effort matrices.

Which GLM model should you pick?

  • Deep coding, architecture, and long-output synthesis: glm-5.3 ($0.084 / $0.079 cached / $3.00 output). Lowest fresh input rate in the GLM family, 943,718 max output ceiling, Inference.net-hosted US infrastructure, and default Zero Data Retention.
  • Cost-sensitive coding loops, multimodal agents, and extraction: glm-5.3-flash ($0.10 / $0.03 cached / $0.35 output). Output tokens cost 8.6x less than glm-5.3, cached input reads drop by 70.0%, and it adds image and video input modalities alongside 1M context and hosted US ZDR.
  • Migrating off legacy GLM-5.2 or GLM-5: glm-5.2 ($1.30 / $4.40), glm-5.2-fast ($2.60 / $8.80), and glm-5 ($0.95 / $2.55, no tool calling, 204K context) are externally routed and cost significantly more than glm-5.3 and glm-5.3-flash. Move production workloads to glm-5.3 or glm-5.3-flash unless pinned to an older checkpoint.

Compare models side by side on the GLM API hub, GLM-5.3 vs GLM-5.3 Flash, or DeepSeek V4.1 Flash vs GLM-5.3 Flash.

GLM prompt caching: why prompt_cache_key is required

Unlike DeepSeek V4.1 Flash or Kimi K3 (which rely on implicit prefix caching without a cache key), GLM routes on Inference.net require an explicit prompt_cache_key for reliable cache affinity:

  1. On glm-5.3, glm-5.3-flash, glm-5.2, and glm-5.2-fast: Keep the leading prompt prefix byte-identical across calls (same system prompt, same tool order, same static context) AND pass a stable prompt_cache_key string in the request body. prompt_cache_key is a routing-affinity hint; it does not create or identify cached content on its own.
  2. On glm-5: Pass BOTH a stable session_id string for routing stickiness and a stable prompt_cache_key string for cache affinity alongside byte-identical leading messages.
  3. Never reuse GLM's prompt_cache_key on DeepSeek V4.1 Flash: DeepSeek V4.1 Flash and V4 Pro routes use implicit caching without prompt_cache_key and may reject requests that send it. If you route across both families in one app, attach prompt_cache_key only to GLM (and OpenAI) requests.
  4. Verify cached reads on every call: Inspect usage.prompt_tokens_details.cached_tokens in the JSON response (pass stream_options: { "include_usage": true } when streaming).
json
{
  "model": "glm-5.3-flash",
  "prompt_cache_key": "repo-backend-v1",
  "messages": [
    { "role": "system", "content": "Stable system instructions and repository context..." },
    { "role": "user", "content": "Write unit tests for the token bucket middleware." }
  ]
}

40-turn coding-agent cost math

This breakdown uses the exact Coding Agent preset: 40 turns per session, 14,000 average input tokens per turn (560K total input = 84K fresh + 476K cached reads at an 85% cache hit rate), and 900 average output tokens per turn (36K total output). Monthly spend scales to 750,000 requests/month (18,750 sessions).

Model IDFresh input (84K)Cached read (476K)Output (36K)40-turn session (85% cache)Session without cacheMonthly (750K reqs)
glm-5.3-flash$0.0084$0.0143$0.0126$0.0353$0.0686$661.50
glm-5.3$0.0071$0.0376$0.1080$0.1527$0.1550$2,862.38
glm-5$0.0798$0.0952$0.0918$0.2668$0.6238$5,002.50
glm-5.2$0.1092$0.0952$0.1584$0.3628$0.8864$6,802.50
glm-5.2-fast$0.2184$0.1904$0.3168$0.7256$1.7728$13,605.00

What the math shows:

  • glm-5.3-flash cuts 40-turn session cost by 48.6% with prompt_cache_key: Going from 0% to 85% cache hits drops the session from $0.0686 to $0.0353 ($661.50/month at 750K requests).
  • glm-5.3 is 2.4x cheaper than glm-5.2 per coding session: $0.1527 vs $0.3628, with 70.7% of the glm-5.3 session bill coming from output tokens ($0.1080). Keep reasoning_effort: "low" on routine turns if you want to cap output token volume.
  • Single-turn 500K-token analysis (0% cache, 4K output): glm-5.3 costs $0.0540 ($0.0420 input + $0.0120 output) and glm-5.3-flash costs $0.0514 ($0.0500 input + $0.0014 output), compared to $0.6676 on glm-5.2.

Model your own prompt sizes and cache hit ratios in the LLM Pricing Calculator or Prompt Cache Calculator.

Quickstart: OpenAI SDK (with prompt_cache_key) and Anthropic /v1/messages

Create a free account at /register and generate a key in API keys. Export INFERENCE_API_KEY in your shell:

bash
export INFERENCE_API_KEY="inf_sk_..."

OpenAI Python SDK with prompt_cache_key

Pass prompt_cache_key through extra_body in the official OpenAI Python SDK so consecutive calls in the same conversation or shared-system pipeline keep routing affinity:

python
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.inference.net/v1",  # or https://us.api.inference.net/v1
    api_key=os.environ["INFERENCE_API_KEY"],
)

stream = client.chat.completions.create(
    model="glm-5.3",
    stream=True,
    stream_options={"include_usage": True},
    reasoning_effort="low",
    extra_body={"prompt_cache_key": "repo-api-service-v1"},
    messages=[
        {"role": "system", "content": "You are a concise backend engineer. Output valid TypeScript."},
        {"role": "user", "content": "Implement an idempotency-key middleware for HTTP POST handlers."},
    ],
)

for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)
    if chunk.usage:
        cached = getattr(chunk.usage.prompt_tokens_details, "cached_tokens", 0) or 0
        print(f"\n[usage] prompt={chunk.usage.prompt_tokens} cached={cached} output={chunk.usage.completion_tokens}")

Native Anthropic SDK (/v1/messages)

Both glm-5.3 and glm-5.3-flash work natively over POST https://api.inference.net/v1/messages. Set base_url="https://api.inference.net" without /v1 because the Anthropic SDK appends /v1/messages automatically (see Anthropic SDK docs and Claude Code setup).

python
import os
from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.inference.net",
    auth_token=os.environ["INFERENCE_API_KEY"],
)

message = client.messages.create(
    model="glm-5.3-flash",
    max_tokens=2048,
    messages=[
        {"role": "user", "content": "Summarize three failure modes of distributed cron locks."}
    ],
)

for block in message.content:
    if block.type == "text":
        print(block.text)

Privacy, Zero Data Retention, and US routing

Inference.net enables Zero Data Retention by default for new accounts under SOC 2 Type II controls on eligible Inference.net-hosted routes (glm-5.3 and glm-5.3-flash), and both models support the US-only host https://us.api.inference.net/v1. Externally routed legacy models (glm-5.2, glm-5.2-fast, glm-5) are excluded from Inference.net's ZDR policy and follow their upstream provider's data-handling and retention terms.

Frequently asked questions

What is the difference between glm-5.3 and glm-5.3-flash?

Both are Inference.net-hosted US models with a 1,048,576-token context window, tool calling, default ZDR, and low/high/max reasoning efforts. glm-5.3 ($0.084 input / $0.079 cached / $3.00 output per 1M) is text-only with a 943,718-token max output ceiling for deeper coding and long-form synthesis. glm-5.3-flash ($0.10 input / $0.03 cached / $0.35 output per 1M) adds image and video input modalities, cuts output token cost by 8.6x, and gives a 70.0% cached-read discount.

How do I enable prompt caching on GLM-5.3 and GLM-5.3 Flash?

Keep your leading system instructions, tool definitions, and static context byte-identical across turns and pass a stable prompt_cache_key string in every request body. Check usage.prompt_tokens_details.cached_tokens to verify cache hits. For legacy glm-5, pass both session_id and prompt_cache_key.

Can I turn off thinking with reasoning_effort: "none" on GLM-5.3?

No. glm-5.3 and glm-5.3-flash are always-thinking models supporting low, high, and max reasoning efforts. Pass reasoning_effort: "low" to minimize reasoning token overhead and latency, or switch to deepseek-v4.1-flash-1017 or moonshotai/kimi-k3.1-pro if you need reasoning_effort: "none".

Can I use GLM-5.3 in Claude Code, OpenCode, or LiteLLM Proxy?

Yes. Use glm-5.3 or glm-5.3-flash natively in Claude Code, OpenCode, Cursor, and LiteLLM Proxy with openai/glm-5.3 or openai/glm-5.3-flash.

Related reading & models

Back to all guides