GLM 5.1
glm-5.1Flagship GLM model for hybrid reasoning, coding, and agentic engineering with a 200K-token context. It supports tool calling and cached-input billing. Call it through the chat completions endpoint with a messages array. A good fit for enterprise assistants, code review, and structured reasoning workloads.
Auto route pricing
Route source: Z.AI
This route has conditional pricing. Review its tiers and requirements before calling.
- Published rate
- Conditional pricing
- Billing unit
- / 1M tokens
- Context / Max output
- 200K / —
- Live routes
- 3
On this page
Overview
Flagship GLM model for hybrid reasoning, coding, and agentic engineering with a 200K-token context. It supports tool calling and cached-input billing. Call it through the chat completions endpoint with a messages array. A good fit for enterprise assistants, code review, and structured reasoning workloads.
Playground
Other parameters (13)
Result preview
Z.AI · 4372ms
Response example. Run to see the actual response.
{
"id": "chatcmpl-0758b9ab-bac7-99f3-a76c-a458c9979723",
"model": "glm-5.1",
"usage": {
"total_tokens": 230,
"prompt_tokens": 6,
"completion_tokens": 224,
"prompt_tokens_details": {
"cached_tokens": 0
},
"completion_tokens_details": {
"reasoning_tokens": 187
}
},
"object": "chat.completion",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! I'm GLM, trained by Z.ai. How can I assist you today? Whether you have questions or just want to chat, I'm happy to help.",
"reasoning_content": "Let me consider how to respond to this greeting effectively.\n\nThe user has started with a simple \"hello\" - this is likely the beginning of a conversation. I should respond in a way that's both welcoming and open-ended.\n\nFirst, I should acknowledge their greeting warmly. Then I should introduce myself briefly to establish context. Since this is an initial interaction, I should also express my willingness to help while inviting them to share what's on their mind.\n\nI need to make sure my response is friendly and professional, while also being concise enough not to overwhelm. The goal is to create an inviting atmosphere for further conversation.\n\nLet me craft a response that's welcoming, informative, and encourages further dialogue. I should include:\n- A warm greeting back\n- A brief introduction of who I am\n- An expression of readiness to help\n- An invitation for them to continue the conversation\n\nThis should create a good foundation for a productive interaction."
},
"logprobs": null,
"finish_reason": "stop"
}
],
"created": 1784220767,
"openmodels_cost": 418,
"system_fingerprint": null
}Agent handoff preview
Providers
| Provider | Pricing | Latency | Uptime | Supply | Route |
|---|---|---|---|---|---|
Live | Input $0.118 / 1M tokens Output $0.413 Cache read $0.030 Cache write — | — | — | Community | |
Live | Input $1.136 / 1M tokens Output $3.570 Cache read $0.192 Cache write — | 6014ms | — | Verified | |
Live | Input $0.745 / 1M tokens Output $2.979 Cache read $0.161 Cache write — | 4372ms | — | Verified |
| Tier | Input | Output | Cache read |
|---|---|---|---|
| ≤32K · 0–32000 token | $0.745 | $2.979 | $0.161 |
| >32K · 32000–∞ token | $0.993 | $3.476 | $0.248 |
Source: the selected provider route in OpenAny's public model catalog. A price update timestamp is not supplied.
API
- Base URL
https://api.openany.si/v1- POST
/v1/chat/completions- Authentication
Authorization: Bearer $OPENANY_API_KEY
Request parameters
| Parameter | Type / range | Default value | Required | Description |
|---|---|---|---|---|
messages | array | — | Yes | messages |
model | string | — | Yes | model |
do_sample | boolean | true | No | do_sample |
max_tokens | integer · 1 ~ 131072 | — | No | max_tokens |
request_id | string | — | No | request_id |
response_format | object | — | No | response_format |
route | object | — | No | route |
route_mode | string | — | No | route_mode |
stop | array | — | No | stop |
stream | boolean | false | No | stream |
temperature | number · 0 ~ 1 | 1 | No | temperature |
thinking | object | — | No | thinking |
tool_choice | string | — | No | tool_choice |
tool_stream | boolean | false | No | tool_stream |
tools | array | — | No | tools |
top_p | number · 0.01 ~ 1 | 0.95 | No | top_p |
user_id | string | — | No | user_id |
Request example
curl 'https://api.openany.si/v1/chat/completions' \
-H "Authorization: Bearer $OPENANY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"content": "Hello!",
"role": "user"
}
],
"model": "glm-5.1",
"route_mode": "balanced",
"do_sample": true,
"stream": false,
"temperature": 1,
"tool_stream": false,
"top_p": 0.95
}'Response example
Configured response example · not a live result
{
"id": "chatcmpl-0758b9ab-bac7-99f3-a76c-a458c9979723",
"model": "glm-5.1",
"usage": {
"total_tokens": 230,
"prompt_tokens": 6,
"completion_tokens": 224,
"prompt_tokens_details": {
"cached_tokens": 0
},
"completion_tokens_details": {
"reasoning_tokens": 187
}
},
"object": "chat.completion",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! I'm GLM, trained by Z.ai. How can I assist you today? Whether you have questions or just want to chat, I'm happy to help.",
"reasoning_content": "Let me consider how to respond to this greeting effectively.\n\nThe user has started with a simple \"hello\" - this is likely the beginning of a conversation. I should respond in a way that's both welcoming and open-ended.\n\nFirst, I should acknowledge their greeting warmly. Then I should introduce myself briefly to establish context. Since this is an initial interaction, I should also express my willingness to help while inviting them to share what's on their mind.\n\nI need to make sure my response is friendly and professional, while also being concise enough not to overwhelm. The goal is to create an inviting atmosphere for further conversation.\n\nLet me craft a response that's welcoming, informative, and encourages further dialogue. I should include:\n- A warm greeting back\n- A brief introduction of who I am\n- An expression of readiness to help\n- An invitation for them to continue the conversation\n\nThis should create a good foundation for a productive interaction."
},
"logprobs": null,
"finish_reason": "stop"
}
],
"created": 1784220767,
"openmodels_cost": 418,
"system_fingerprint": null
}Error handling
400Check the model ID and request fields.429Retry with exponential backoff.5xxRetry only temporary provider failures.JSON Schema
{
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"messages",
"model"
],
"properties": {
"stop": {
"type": "array",
"items": {
"type": "string"
},
"maxItems": 1
},
"model": {
"type": "string"
},
"route": {
"type": "object"
},
"tools": {
"type": "array",
"items": {
"type": "object",
"required": [
"type",
"function"
],
"properties": {
"type": {
"enum": [
"function"
],
"type": "string",
"default": "function"
},
"function": {
"type": "object",
"required": [
"name",
"description",
"parameters"
],
"properties": {
"name": {
"type": "string",
"pattern": "^[a-zA-Z0-9_-]+$",
"maxLength": 64,
"minLength": 1
},
"parameters": {
"type": "object",
"additionalProperties": true
}
}
}
},
"additionalProperties": false
},
"maxItems": 128
},
"top_p": {
"type": "number",
"format": "float",
"default": 0.95,
"maximum": 1,
"minimum": 0.01
},
"stream": {
"type": "boolean",
"default": false
},
"user_id": {
"type": "string",
"maxLength": 128,
"minLength": 6
},
"messages": {
"type": "array",
"items": {
"oneOf": [
{
"type": "object",
"required": [
"role",
"content"
],
"properties": {
"role": {
"enum": [
"user"
],
"type": "string",
"default": "user"
},
"content": {
"oneOf": [
{
"type": "string"
}
]
}
}
},
{
"type": "object",
"required": [
"role",
"content"
],
"properties": {
"role": {
"enum": [
"system"
],
"type": "string",
"default": "system"
},
"content": {
"oneOf": [
{
"type": "string"
}
]
}
}
},
{
"type": "object",
"required": [
"role"
],
"properties": {
"role": {
"enum": [
"assistant"
],
"type": "string",
"default": "assistant"
},
"content": {
"oneOf": [
{
"type": "string"
}
]
},
"tool_calls": {
"type": "array",
"items": {
"type": "object",
"required": [
"id",
"type"
],
"properties": {
"id": {
"type": "string"
},
"type": {
"enum": [
"function",
"web_search",
"retrieval"
],
"type": "string"
},
"function": {
"type": "object",
"required": [
"name",
"arguments"
],
"properties": {
"name": {
"type": "string"
},
"arguments": {
"type": "string"
}
}
}
}
}
}
}
},
{
"type": "object",
"required": [
"role",
"content",
"tool_call_id"
],
"properties": {
"role": {
"enum": [
"tool"
],
"type": "string",
"default": "tool"
},
"content": {
"oneOf": [
{
"type": "string"
}
]
},
"tool_call_id": {
"type": "string"
}
}
}
]
},
"minItems": 1
},
"thinking": {
"type": "object",
"properties": {
"type": {
"enum": [
"enabled",
"disabled"
],
"type": "string",
"default": "enabled"
},
"clear_thinking": {
"type": "boolean",
"default": true
}
}
},
"do_sample": {
"type": "boolean",
"default": true
},
"max_tokens": {
"type": "integer",
"maximum": 131072,
"minimum": 1
},
"request_id": {
"type": "string",
"maxLength": 64,
"minLength": 6
},
"route_mode": {
"type": "string"
},
"temperature": {
"type": "number",
"format": "float",
"default": 1,
"maximum": 1,
"minimum": 0
},
"tool_choice": {
"oneOf": [
{
"enum": [
"auto"
],
"type": "string"
}
]
},
"tool_stream": {
"type": "boolean",
"default": false
},
"response_format": {
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"enum": [
"text",
"json_object"
],
"type": "string",
"default": "text"
}
}
}
}
}Examples
Request example
POST /v1/chat/completionscurl 'https://api.openany.si/v1/chat/completions' \
-H "Authorization: Bearer $OPENANY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"content": "Hello!",
"role": "user"
}
],
"model": "glm-5.1",
"route_mode": "balanced",
"do_sample": true,
"stream": false,
"temperature": 1,
"tool_stream": false,
"top_p": 0.95
}'