← Blog

GLM-5.2 — free API, no credit card, OpenAI-compatible

Call Z.ai's GLM-5.2 through an OpenAI-compatible endpoint at $0 input / $0 output. One ifu_ key, no card to start, works with the openai SDK, curl, LangChain, or Claude Code.

InferAll Team

3 min read
GLMGLM-5.2free APIopen modelsOpenAI-compatibleZ.aiLLM APIno credit card

GLM-5.2 is one of the strongest open-weight general models available right now, and you can call it through InferAll on an OpenAI-compatible endpoint at $0 input / $0 output, within the free-plan daily request limits. No credit card to start.

Every snippet below was run against the live gateway before publishing.


The 20-second version

curl https://api.inferall.ai/v1/chat/completions \
  -H "Authorization: Bearer $INFERALL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "z-ai/glm-5.2",
    "messages": [{"role": "user", "content": "Explain MoE routing in two sentences."}]
  }'

Get an ifu_... key at inferall.ai/keys. New accounts get a free no-card trial on the open models, so you can check the output quality before deciding anything.

With the OpenAI SDK — change one line

You do not need a new client library. Point the official openai SDK at InferAll and pass the model id:

from openai import OpenAI

client = OpenAI(
    base_url="https://api.inferall.ai/v1",
    api_key="ifu_your_key_here",
)

resp = client.chat.completions.create(
    model="z-ai/glm-5.2",
    messages=[{"role": "user", "content": "Refactor this function for readability."}],
)
print(resp.choices[0].message.content)

TypeScript is the same shape:

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.inferall.ai/v1",
  apiKey: process.env.INFERALL_API_KEY,
});

const r = await client.chat.completions.create({
  model: "z-ai/glm-5.2",
  messages: [{ role: "user", content: "Write a SQL query for monthly active users." }],
});

Already have OpenAI SDK code in a repo? One command rewrites the client for you:

npx @inferall/cli init

It detects your project, writes INFERALL_API_KEY into .env (and gitignores it), and repoints your existing OpenAI(...) constructors. npx @inferall/cli chat "hello" gives you a response immediately so you can confirm it works.

Why route GLM-5.2 through a gateway at all

The practical reason is that you rarely want only one model. With one ifu_ key you can send the cheap, high-volume turns to GLM-5.2 and other open models at $0, and route the few calls that genuinely need a frontier model to OpenAI, Anthropic, or Google — at the provider's published per-token price, with zero markup. Same key, same endpoint, one bill.

# same client, different model — that's the whole switch
cheap = client.chat.completions.create(model="z-ai/glm-5.2", messages=msgs)
hard  = client.chat.completions.create(model="anthropic/claude-sonnet-4-6", messages=msgs)

Other free models worth trying alongside it

All $0 input/output on the same key:

Model id Good for
z-ai/glm-5.2 General reasoning, coding, long-form
nvidia/nemotron-3-super-120b-a12b Opus-class reasoning at $0
meta/llama-3.1-70b-instruct Reliable general-purpose workhorse
mistralai/mixtral-8x7b-instruct-v0.1 Fast MoE, cheap latency

npx @inferall/cli models --free prints the whole current list with live prices — 80+ models at $0 as of today.


The honest part: the open models are $0 in and $0 out, capped by free-plan daily request limits. Premium providers bill at their published rate with no markup added. Start at inferall.ai/keys — no card needed to try it.