glm-5.2 API

streaming

GLM-5.2 is Zhipu AI's flagship open-weights model for long-horizon coding and agentic work. Call it on CaMeL Hub via the OpenAI-compatible API — base_url https://api.camel-hub.com/v1, model "glm-5.2" — at $8 per 1M input tokens and $28 per 1M output tokens, with no subscription required.

Pricing

per 1M input tokensper 1M output tokens
CaMeL Hub$8.00$28.00
Provider list price$1.4$4.4

Prices are the public default-group rate in USD per 1M tokens; input and output are billed separately. · Provider list price · verified 2026-07-11

Specifications

Provider
Zhipu AI
Context window
1000000 tokens
Max output
128000 tokens
Capabilities
streaming
Endpoints
openai, anthropic
GLM-5.2 is the flagship foundation model from Zhipu AI (published internationally under the Z.ai brand), built specifically for long-horizon software-engineering tasks. Z.ai documents a 1M-token context window with up to 128K output tokens, and positions GLM-5.2 as the strongest open-source model on agentic coding benchmarks — scoring 81.0 on Terminal-Bench 2.1 and trailing the top proprietary model by roughly one point on FrontierSWE, according to the provider's own published results. What sets GLM-5.2 apart from earlier GLM generations is stability over long tasks rather than raw single-turn cleverness. Z.ai highlights project-level codebase understanding, multi-file refactoring, reliable adherence to engineering conventions, and higher end-to-end success rates in development scenarios. The genuinely usable 1M-token context means an entire mid-sized repository, a week of build logs, or a full documentation set fits into a single request instead of being chopped into lossy retrieval fragments. The model also ships with multiple thinking modes, so it can spend more deliberation on hard problems and answer quickly on easy ones. On CaMeL Hub, glm-5.2 is exposed through both the OpenAI-compatible /v1/chat/completions endpoint and the Anthropic-compatible /v1/messages endpoint — existing OpenAI SDK or Claude SDK code works after changing only the base URL and API key. Responses stream token by token, which matters for a model that can emit up to 128K tokens in one completion. Billing is strictly pay-as-you-go with separately metered input ($8 per 1M tokens) and output ($28 per 1M tokens); you can top up with Alipay, WeChat Pay, or international cards and switch between GLM-5.2 and any other hosted model by changing one string.

What it is good for

Quickstart

OpenAI-compatible: set base_url to https://api.camel-hub.com/v1 and use your CaMeL Hub API key. No SDK changes needed.

cURL

curl https://api.camel-hub.com/v1/chat/completions \
  -H "Authorization: Bearer $CAMEL_HUB_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.2",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Python

from openai import OpenAI

client = OpenAI(
    api_key="$CAMEL_HUB_KEY",
    base_url="https://api.camel-hub.com/v1",  # <-- the only change vs. the OpenAI default
)

resp = client.chat.completions.create(
    model="glm-5.2",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)

Node.js

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.CAMEL_HUB_KEY,
  baseURL: "https://api.camel-hub.com/v1", // <-- the only change vs. the OpenAI default
});

const resp = await client.chat.completions.create({
  model: "glm-5.2",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(resp.choices[0].message.content);

Get an API key Browse integration guides

Frequently asked questions

How is GLM-5.2 billed on CaMeL Hub?

Per token, with input and output metered separately: $8 per 1M input tokens and $28 per 1M output tokens on the public default group. There is no per-request fee and no monthly minimum — you pay only for the tokens each call actually consumes, and streamed responses are billed exactly the same as non-streamed ones.

Does GLM-5.2 support streaming, and which endpoints can I use?

Yes. Set "stream": true and tokens arrive incrementally as server-sent events. On CaMeL Hub you can reach glm-5.2 through the OpenAI-compatible /v1/chat/completions endpoint or the Anthropic-compatible /v1/messages endpoint. Image/vision input is not available for this model on CaMeL Hub.

How large is the GLM-5.2 context window?

Z.ai's documentation lists a 1M-token context window and up to 128K output tokens for GLM-5.2. Keep in mind that everything you place in the context — code, logs, prior turns — is billed at the input rate, so very large prompts are powerful but not free.

How is GLM-5.2 different from GLM-5?

GLM-5.2 is the newer flagship generation, with a much larger documented context window and stronger published results on agentic coding benchmarks. Both models are available on CaMeL Hub under the same API key, so you can A/B them on your own workload by changing a single model string.

How do I start using GLM-5.2?

Create an account at https://api.camel-hub.com/console, generate an API key, and point any OpenAI-compatible SDK at base_url https://api.camel-hub.com/v1 with model "glm-5.2". No SDK changes are needed beyond the base URL and key; a small top-up is enough to start experimenting.

More from Zhipu AI

Zhipu AI

glm-5

Compare with other models