GLM 5.1

glm-5.1

Use the GLM 5.1 API for coding and reasoning. Send conversation messages and include tool definitions on supported routes. The listed routes publish a context limit of 200,000 tokens. Use it to work through multi-step coding tasks or review longer technical material. Compare the available provider routes, request examples, and usage prices on OpenAny.

Published price
From $0.745 / 1M tokens
Billing unit
/ 1M tokens
Context / Max output
200K / 128K
Listed routes
2
Base URL
https://api.openany.si/v1
POST
/v1/chat/completions
Authentication
Authorization: Bearer $OPENANY_API_KEY

Provider

Published price $0.745 / 1M tokens

Request parameters

ParameterType / rangeDefault valueRequiredDescription
messagesarray—Yesmessages
modelstring—Yesmodel
do_samplebooleantrueNodo_sample
max_tokensinteger · 1 ~ 131072—Nomax_tokens
request_idstring—Norequest_id
response_formatobject—Noresponse_format
routeobject—Noroute
route_modestring—Noroute_mode
stoparray—Nostop
streambooleanfalseNostream
temperaturenumber · 0 ~ 11Notemperature
thinkingobject—Nothinking
tool_choicestring—Notool_choice
tool_streambooleanfalseNotool_stream
toolsarray—Notools
top_pnumber · 0.01 ~ 10.95Notop_p
user_idstring—Nouser_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

JSON
{
  "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"
        }
      }
    }
  }
}

Model API questions

How do I call GLM 5.1 through OpenAny?

Use model ID glm-5.1 with an OpenAny key and the operation published in this model's API tab. The model API base is https://api.openany.si/v1. Confirm the protocol and request schema; model availability does not imply every OpenAI API operation is supported.

How is GLM 5.1 billed?

Compare the published rate and billing unit of the selected provider route. Input, output and cache token rates may differ. Image, audio and video models can use other units. Recorded usage determines the charge under that route's billing contract.

Are Community and Verified routes the same as an official publisher API?

No. Inspect the provider name and supply classification for the specific route. A marketplace listing or a supply label is not a claim of publisher endorsement, identical service or measured uptime. Different route prices may reflect different supply and conditions.

Where do these prices come from, and when were they updated?

Rates come from the provider routes in OpenAny's public model catalog, not an independent quote from the model publisher. The catalog does not supply a price update timestamp. A page or catalog snapshot date is not a price revision date. Compare supply, billing units, tiers and conditions; a lower listed rate alone does not establish equivalent service or explain the price difference.

Use GLM 5.1 with your agent

Inspect endpoint contracts and confirm availability and pricing before a paid call.