DEV Community

Cover image for GLM Free API: Zhipu’s Flash Models at Zero Cost
toolfreebie
toolfreebie

Posted on Originally published at toolfreebie.com

GLM Free API: Zhipu’s Flash Models at Zero Cost

GLM Free API: Zhipu's Flash Models at Zero Cost

Quick answer: The GLM API from Zhipu AI, served internationally via Z.ai, keeps three models permanently free ($0 in / $0 out, no credit card) — including GLM-4.7-Flash with a ~200K-token context tuned for coding and agents. It exposes both OpenAI-compatible and Anthropic-compatible endpoints, so you can point Claude Code, Cline, or Aider at it with a two-variable swap. The only real limit is throughput: one concurrent request, ~1/second.

If you build with LLMs you’ve probably collected free keys — Gemini, Groq, DeepSeek, OpenRouter. The one most developers outside China miss is GLM from Zhipu AI (a Tsinghua spin-out, current flagship GLM-5.2). What makes it worth wiring in: genuinely free models (not expiring trial credits), a free ~200K coding context, and an Anthropic-compatible endpoint nobody else on this list matches. Every number below comes from Z.ai’s own pricing docs — confirm there before you build.

Is the GLM API free? The honest breakdown

Yes, and it survives scrutiny: Z.ai keeps a set of models at $0 input / $0 output for every registered user — a standing free tier, not trial credits. The trade-off is throughput, not access. The three permanently free models:

Model Type Context Price Best for
GLM-4.7-Flash Text / coding ~200K tokens $0 / $0 Coding, agents, long documents
GLM-4.5-Flash Text (general) 128K tokens $0 / $0 Chat, classification, extraction
GLM-4.6V-Flash Vision Multimodal $0 / $0 Image understanding, OCR, VQA

The headline is GLM-4.7-Flash (released Jan 19, 2026): a ~200,000-token window on a free model is rare — enough to stuff an entire codebase or long PDF into one call — and it’s tuned for coding and agentic loops, not throwaway chat (max 16,384 output tokens). GLM-4.5-Flash is the lighter, low-latency default for high-volume simple jobs (classification, extraction, JSON). GLM-4.6V-Flash fills the rarer slot of a genuinely free vision model sharing the same key. The one caveat: the free tier is throttled to 1 concurrent request, ~1/second — fine for a single-user tool or sequential batch job, not for a public app with many simultaneous users.

Free vs paid: what scaling up costs

GLM’s paid pricing is among the most aggressive in the industry, and the ladder is smooth. Per-million-token rates from the pricing docs:

Model Input / 1M Output / 1M Notes
GLM-4.7-Flash $0 $0 Free tier, 1 concurrency
GLM-4.5-Flash $0 $0 Free tier, general-purpose
GLM-4.7-FlashX $0.07 $0.40 Same Flash quality, ~3 concurrency
GLM-4.5-Air $0.20 $1.10 Mid-tier balance
GLM-5 $1.00 $3.20 Previous flagship
GLM-5.2 $1.40 $4.40 Current flagship

The clever part is GLM-4.7-FlashX: the same Flash model with the concurrency cap lifted for $0.07/1M input — you graduate a free prototype to production by changing one model string, no rewrite. And at $1.40 / $4.40, flagship GLM-5.2 runs roughly a fifth to a tenth the price of comparable Western frontier models, which is why it shows up in cost-conscious agent stacks. For the wider landscape, the 10 best free AI APIs comparison puts GLM next to Gemini, Groq, and the rest.

Get a key and make your first call

Sign up at z.ai (email or Google/GitHub — no card for free models), generate a key in the API Keys dashboard, and export it. Z.ai exposes an OpenAI-compatible endpoint at https://api.z.ai/api/paas/v4, so the official openai library works unchanged — swap base URL and model name:

from openai import OpenAI

client = OpenAI(
    api_key="your-z-ai-api-key",
    base_url="https://api.z.ai/api/paas/v4",
)
resp = client.chat.completions.create(
    model="glm-4.7-flash",          # the free coding model
    messages=[{"role": "user", "content": "Reverse a linked list in Python."}],
)
print(resp.choices[0].message.content)
Enter fullscreen mode Exit fullscreen mode
curl https://api.z.ai/api/paas/v4/chat/completions \
  -H "Authorization: Bearer $ZAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "glm-4.7-flash", "messages": [{"role": "user", "content": "Say hello."}]}'
Enter fullscreen mode Exit fullscreen mode

Because it’s OpenAI-shaped, streaming, tool calling, JSON mode, and system prompts work with the parameters you already know — point CrewAI, LangGraph, or any “OpenAI” provider at that base URL. To route multiple providers, drop it behind LiteLLM.

The killer feature: GLM as a free Claude Code backend

Z.ai also ships a genuine Anthropic-compatible endpoint at https://api.z.ai/api/anthropic — a true drop-in for Anthropic’s API. That means you can point Claude Code at GLM with zero code changes, using the same env vars the tool already reads:

export ANTHROPIC_BASE_URL="https://api.z.ai/api/anthropic"
export ANTHROPIC_AUTH_TOKEN="your-z-ai-api-key"
claude   # now talks to GLM instead of Anthropic
Enter fullscreen mode Exit fullscreen mode

The reason this gets attention in 2026 is arithmetic: GLM is strong at agentic coding, and running an agent that burns millions of tokens against a $0.07-per-million (or free, at Flash throughput) backend costs a fraction of a frontier-model bill. The same trick works for any tool reading the standard Anthropic env vars. Two honest notes: on the free Flash tier, single-concurrency means the agent runs one request at a time (fine solo, slow if you expected parallelism); and self-hosted runners can register Z.ai as a provider directly (see the OpenClaw provider docs). For more BYOK agents, see the 5 free AI coding assistants roundup.

The GLM Coding Plan: subscription vs pay-per-token

Z.ai also sells a flat monthly GLM Coding Plan for developers who live inside coding agents — a large usage quota instead of metered tokens, billed quarterly, with access to flagship GLM-5.2. Mid-2026 tiers: Lite ~$10/mo, Pro ~$30/mo, Max ~$80/mo (Q2 promos brought these to ~$27/$81/$216 per quarter). It uses a dedicated endpoint (https://api.z.ai/api/coding/paas/v4) — a detail that trips people up. The decision is simple: prototyping or a personal tool → free Flash models; pushing an agent hard where per-token would sting but a flat $10-30/mo is comfortable → the Coding Plan; serving app traffic that needs concurrency → pay-per-token FlashX.

GLM vs DeepSeek vs the free APIs you already use

GLM (Z.ai) DeepSeek OpenRouter free Together AI free
Truly free models 3 (incl. 200K coding) Low-cost, small free trial Rotating free variants Handful of “-Free” models
Free context ceiling ~200K (GLM-4.7-Flash) Varies Varies Up to model max
OpenAI-compatible Yes Yes Yes Yes
Anthropic-compatible Yes (Claude Code drop-in) No No No
Free vision model Yes (GLM-4.6V-Flash) No Sometimes Yes (Llama Vision)
Coding/agent focus Strong (Flash tuned for it) Strong (R1 reasoning) Depends on model General
Free concurrency 1 req/sec Rate-limited Shared, variable Rate-limited
  • Choose GLM for a free coding/agent model with a huge context, or to run Claude Code / Cline against a cheap backend — the Anthropic endpoint is the differentiator.
  • Choose DeepSeek for top-tier open reasoning (R1) at rock-bottom pay-as-you-go prices.
  • Choose OpenRouter to sample many models — including free GLM variants — through one aggregator key.
  • Choose Together AI for free chat, vision, and image generation (FLUX) behind one key.

In practice these are complements: GLM-4.7-Flash for coding agents, DeepSeek R1 for hard reasoning, Together’s FLUX for images — all routed through LiteLLM so switching is one line.

Limits and honest caveats

  • Free tier is single-concurrency (~1 req/sec) — generous for a personal tool, inadequate for a multi-user product. Move to FlashX or paid before real traffic; it’s a one-string change.
  • Two platforms, two accounts. Z.ai (international, English, this article) and the Zhipu Open Platform (open.bigmodel.cn, China, RMB) are separate — a key from one won’t work on the other.
  • Data residency. GLM is operated by a China-based company with its own data terms. Fine for hobby and non-sensitive code; for regulated or proprietary data, read the terms and consider a self-hosted model or a provider in your jurisdiction. Treat it as a compliance decision.
  • Free tiers move — confirm model tiers and prices against the live pricing docs before architecting around a limit.

Frequently Asked Questions

Is the GLM API really free?

Yes. Z.ai keeps GLM-4.7-Flash (text/coding, ~200K), GLM-4.5-Flash (general), and GLM-4.6V-Flash (vision) permanently free at $0/$0, no card — a standing free tier, not expiring credits. The only limit is throughput: one concurrent request at ~1/second.

Can I use GLM with Claude Code?

Yes. Set ANTHROPIC_BASE_URL to https://api.z.ai/api/anthropic and ANTHROPIC_AUTH_TOKEN to your Z.ai key, then run Claude Code normally — it sends requests to GLM instead of Anthropic. This is a main reason GLM is popular as a low-cost coding-agent backend.

What’s the difference between GLM-4.7-Flash and FlashX?

Same underlying model quality. Flash is the free tier, capped at single concurrency. FlashX is the paid, higher-throughput version ($0.07/1M in, $0.40/1M out) for serving real traffic. Develop on Flash for free, switch the model string to FlashX for production.

GLM vs DeepSeek — which is better?

Different strengths. GLM offers a genuine free tier with a huge coding context and an Anthropic-compatible endpoint for agents; DeepSeek is renowned for deep R1 reasoning at very low pay-as-you-go prices with a smaller free tier. For free coding agents, GLM; for cheap heavyweight reasoning, DeepSeek. Many developers use both.

Bottom line

The GLM free API is one of the most under-used free keys a developer can add in 2026: three permanently free models — a ~200K coding model, a lightweight general model, and a vision model — with no card, no expiry, and both OpenAI- and Anthropic-compatible endpoints. Driving a coding agent solo? Point Claude Code or Cline at GLM-4.7-Flash free, or the ~$10/mo Coding Plan for all-day use. Need a free model that swallows a whole repo? The ~200K free context is rare at $0. Going to production? Switch one string to FlashX. It’s not the model for regulated data, and single-concurrency makes it shine as a personal and prototyping tool — but as a free, drop-in coding brain, it slots right into the stack you already have.

Related Reads


Originally published at toolfreebie.com.

Top comments (0)