glm-5 API

streamingfunction-calling

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 tokensper 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
GLM-5 is the flagship generation of Zhipu AI's GLM series — the release that established the line as a serious option for agentic and coding workloads rather than a Chinese-market curiosity. Like the rest of the family it is genuinely bilingual, handling Chinese and English with equal fluency, and Z.ai documents a 200K context length with up to 128K output tokens: enough headroom to review a whole repository, digest a stack of contracts, or carry a very long agent conversation in a single request. On CaMeL Hub, GLM-5 is served through the same OpenAI-compatible endpoint as every other model in the catalog: keep your existing openai SDK code and change only the base_url and the model name. Billing is per token with input and output metered separately, and uses segmented long-context pricing — requests whose prompt stays within 32K tokens are billed at $4.00 per 1M input and $18.00 per 1M output tokens, while prompts beyond 32K move to $6.00 and $22.00 respectively. If you routinely feed long documents, chunking or pre-summarizing documents before the request keeps more of your traffic in the base tier. In practice GLM-5 sits in the middle of the catalog: noticeably stronger than lightweight "flash"-class models on multi-step reasoning, code generation, and tool use, without the per-token cost of the top-tier flagships. Streaming and function calling are both supported through the standard OpenAI request format, so it drops cleanly into agent frameworks that expect stream: true and tool_calls. If you want the newest GLM generation, GLM-5.2 is also available on CaMeL Hub — GLM-5 remains the sensible pick wherever its price-to-capability balance fits the job.

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",
    "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.

More from Zhipu AI

Zhipu AI

glm-5.2