glm-5 API
GLM-5 is Zhipu AI's flagship GLM-series language model. Call it on CaMeL Hub through the OpenAI-compatible API — set base_url to https://api.camel-hub.com/v1 and model to "glm-5" — at $4.00 per 1M input and $18.00 per 1M output tokens for prompts up to 32K tokens. Longer prompts switch to a higher long-context tier, so the same endpoint scales from short chat turns to 200K-token document jobs without any code changes.
Pricing
| per 1M input tokens | per 1M output tokens | |
|---|---|---|
| CaMeL Hub (≤ 32000 tokens) | $4.00 | $18.00 |
| CaMeL Hub (long context) | $6.00 | $22.000000000002 |
| Provider list price | $1.00 | $3.2 |
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
- 200000 tokens
- Max output
- 128000 tokens
- Capabilities
- streaming, function-calling
- Endpoints
- openai
What it is good for
- Agentic coding assistants that read large codebases — the 200K context window fits entire repositories or multi-file refactoring tasks in one request
- Tool-calling agents and workflow automation, using OpenAI-style function calling to hit external APIs, databases, and internal services
- Bilingual Chinese–English work: translation, localization QA, and generating marketing or support copy that must read natively in both languages
- Long-document analysis of contracts, research papers, or log bundles — mind the 32K prompt-token threshold where the higher pricing tier starts
- Streaming chat backends and customer-facing copilots, where token-by-token output keeps perceived latency low
- Structured data extraction at scale: forcing JSON output via function calling to turn messy text into typed records
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",
"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",
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",
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 billed on CaMeL Hub?
Input and output tokens are metered and priced separately. For requests whose prompt is up to 32K tokens, input costs $4.00 per 1M tokens and output costs $18.00 per 1M tokens. When the prompt exceeds 32K tokens, the request is billed at the long-context tier: $6.00 per 1M input and $22.00 per 1M output tokens. Billing is pay-as-you-go with no minimum commitment.
Does GLM-5 support streaming and function calling?
Yes to both. Set stream: true in a standard chat.completions request to receive tokens incrementally, and pass a tools array to use OpenAI-style function calling — GLM-5 returns tool_calls that work with mainstream agent frameworks unchanged.
What is GLM-5's context window?
Z.ai's documentation lists a 200K-token context length and up to 128K output tokens for GLM-5. Note that on CaMeL Hub, prompts beyond 32K tokens are billed at the higher long-context tier ($6.00 in / $22.00 out per 1M tokens), so very long inputs work fine but cost more per token.
How do I start using GLM-5?
Create an account at https://api.camel-hub.com/console, top up (Alipay, WeChat Pay, and international cards are supported), and create an API key. Then point any OpenAI-compatible SDK at base_url https://api.camel-hub.com/v1 with model "glm-5" — no other code changes are needed.
Should I use GLM-5 or GLM-5.2?
GLM-5.2 is the newer generation of the same family and is also available on CaMeL Hub through the identical endpoint — switching is a one-word model-name change. Compare current per-token rates on the models page and test both against your workload; GLM-5 is often the pragmatic choice when its rate fits your budget and its capability is sufficient for the task.