glm-5.2 API
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 tokens | per 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
What it is good for
- Multi-file refactoring across a large codebase: load the relevant packages into the 1M-token context and have the model apply a rename or API migration consistently in one pass.
- Long-horizon agentic coding sessions in tools like Cline or Cursor, where the model must keep a plan coherent across dozens of edit-test iterations.
- Whole-repository code review and bug triage: paste the diff plus surrounding modules and get findings grounded in the actual call sites rather than snippets.
- Reproducing a research paper or turning a detailed spec into a working implementation, a scenario Z.ai explicitly optimizes GLM-5.2 for.
- Analyzing very long unstructured inputs — contract stacks, server logs, exported chat histories — that exceed the context limits of most other models.
- Bilingual Chinese-English technical work: GLM models are trained heavily on both languages, making GLM-5.2 a strong pick for translating or documenting code for mixed-language teams.
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.