Zhipu Native Protocol
The native endpoint is compatible with the Z.AI/Zhipu Chat Completions request and response format. Existing clients only need to change the API base URL, token, and EZModel model ID.
Endpoint and model
POST https://api.ezmodel.cloud/api/paas/v4/chat/completionsAuthorization: Bearer YOUR_API_TOKEN
Content-Type: application/jsonThe current platform model ID is glm-5-3. EZModel maps it to upstream glm-5.3, so responses contain model: "glm-5.3". Use GET /v1/models as the source of truth for models available to your account instead of sending the upstream model name directly.
glm-5-3 always reasons and does not support thinking.type=disabled. Set reasoning_effort to "low", "high", or "max".
Basic request
curl https://api.ezmodel.cloud/api/paas/v4/chat/completions \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5-3",
"messages": [{"role": "user", "content": "Hello"}],
"reasoning_effort": "low",
"max_tokens": 256,
"stream": false
}'Zhipu-specific fields returned by the upstream API are preserved, including request_id, reasoning_content, content_filter, web_search, and token usage details.
Streaming
Set "stream": true to receive SSE. The final JSON event contains usage, followed by data: [DONE].
Function Calling
Function Calling uses the standard two-request flow. Declare functions in tools and use the provider-documented "tool_choice": "auto". The first response returns finish_reason: "tool_calls", a function name and arguments, and tool_calls[].id. Execute the function in your application. The second request must append both the complete assistant tool-call message and a tool result with the same ID:
{
"model": "glm-5-3",
"messages": [
{"role": "user", "content": "Check the weather in Beijing"},
{
"role": "assistant",
"content": "",
"tool_calls": [{
"id": "call_xxx",
"type": "function",
"function": {
"name": "get_weather",
"arguments": "{\"city\":\"Beijing\"}"
}
}]
},
{
"role": "tool",
"tool_call_id": "call_xxx",
"content": "{\"temperature\":\"20°C\",\"condition\":\"sunny\"}"
}
],
"reasoning_effort": "low",
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get weather for a city",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]
}
}
}]
}The two stages are independent model requests and each is billed for its input and output tokens. EZModel does not add a Function Calling tool surcharge. Any cost charged by the external function service is separate.
Built-in Web Search
{
"model": "glm-5-3",
"messages": [{"role": "user", "content": "Search for the Z.AI documentation"}],
"reasoning_effort": "low",
"tools": [{
"type": "web_search",
"web_search": {
"enable": true,
"search_engine": "search_std",
"search_query": "Z.AI documentation",
"search_result": true,
"count": 3
}
}]
}A successful search produces a top-level web_search array. EZModel uses that field as execution evidence: a completion is charged for at most one search, regardless of the number of returned results. No search surcharge is added when a request declares the tool but the response does not contain web_search.
Web Search costs $0.01/use in USD in addition to model-token charges. See Z.AI pricing for the current rate.
SDK configuration
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_TOKEN",
base_url="https://api.ezmodel.cloud/api/paas/v4/",
)
response = client.chat.completions.create(
model="glm-5-3",
messages=[{"role": "user", "content": "Hello"}],
extra_body={"reasoning_effort": "low"},
)
print(response.choices[0].message.content)Scope and limitations
- The native endpoint currently covers synchronous and streaming Chat Completions.
- Model mapping, channel parameter overrides, and an optional system prompt may modify the request; other Zhipu extension fields are forwarded as native JSON.
- Zhipu async jobs, the standalone Web Search Broker, file APIs, knowledge-base lifecycle APIs, and video APIs are outside this endpoint.
- Forwarding fields such as
retrievalor managed MCP does not imply that the account owns the referenced resources or subscription. Do not use resource IDs created by another tenant or by the platform operator.
See the Z.AI Chat Completion API for the complete vendor field reference.
