Create a chat completion model that generates AI replies for given conversation messages. It supports multimodal inputs (text, images, audio, video, file), offers configurable parameters (like temperature, max tokens, tool use), and supports both streaming and non-streaming output modes.
POST
/
paas
/
v4
/
chat
/
completions
curl --request POST \ --url https://api.z.ai/api/paas/v4/chat/completions \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "model": "glm-5.3", "messages": [ { "role": "system", "content": "You are a helpful coding assistant." }, { "role": "user", "content": "Write a Python function to calculate the factorial of a number." } ], "temperature": 1, "stream": false}'
The model code to be called. GLM-5.3, GLM-5.2, GLM-5.1 are the latest flagship model series, foundational models specifically designed for agent applications.
The current conversation message list as the model’s prompt input, provided in JSON array format, e.g.,{“role”: “user”, “content”: “Hello”}. Possible message types include system messages, user messages, assistant messages, and tool messages. Note: The input must not consist of system messages or assistant messages only.
When do_sample is true, sampling strategy is enabled; when do_sample is false, sampling strategy parameters such as temperature and top_p will not take effect. Default value is true.
This parameter should be set to false or omitted when using synchronous call. It indicates that the model returns all content at once after generating all content. Default value is false. If set to true, the model will return the generated content in chunks via standard Event Stream. When the Event Stream ends, a data: [DONE] message will be returned.
Whether to enable the chain of thought(GLM-5.3GLM-5.3-FLASH series can only be enabled, and the thinking depth is controlled by reasoning_effort; for other models, when enabled, GLM-5.2 GLM-5.1 GLM-5 GLM-4.6 and others will automatically determine whether to think, while GLM-4.7 will think compulsorily), default: enabled
Default value is True. Controls whether to clear reasoning_content from previous conversation turns. View more in Thinking Mode.
true (default): For this request, the system ignores/removes reasoning_content from prior turns, and only keeps non-reasoning context (e.g., user/assistant visible text, tool calls, and tool results). This is recommended for general chat or lightweight tasks to reduce context length and cost.
false: Retains reasoning_content from prior turns and includes it in the context sent to the model. To enable Preserved Thinking, you must forward the full, unmodified, and correctly ordered historical reasoning_content in messages. Missing, truncated, rewritten, or reordered blocks may degrade performance or prevent the feature from taking effect.
Notes: This parameter only affects cross-turn historical thinking blocks; it does not change whether the model generates/returns thinking in the current turn.
Controls the model's reasoning effort level, takes effect when thinking is enabled. Default is max, supported by GLM-5.2 and above. For the GLM-5.3GLM-5.3-FLASH model, only the low / high / max levels are supported. For the GLM-5.2 model, for compatibility with other protocols, passing none or minimal will cause the model to skip thinking; low and medium will be mapped to high; xhigh will be mapped to max.
Sampling temperature, controls the randomness of the output, must be a positive number within the range: [0.0, 1.0]. The GLM-5.3, GLM-5.2, GLM-5.1, GLM-5, GLM-4.7, GLM-4.6 series default value is 1.0
Another method of temperature sampling, value range is: [0.01, 1.0]. The GLM-5.3, GLM-5.2, GLM-5.1, GLM-5, GLM-4.7, GLM-4.6 series default value is 0.95.
Whether to enable streaming response for Function Calls. Default value is false. Only supported by the GLM-5.3, GLM-5.2, GLM-5.1, GLM-5, GLM-4.7, and GLM-4.6 series. Refer to the Stream Tool Call
A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
Parameters defined using JSON Schema. Must pass a JSON Schema object to accurately define accepted parameters. Omit if no parameters are needed when calling the function.
Stop word list. Generation stops when the model encounters any specified string. Currently, only one stop word is supported, in the format ["stop_word1"].
Specifies the response format of the model. Defaults to text. Only text models support this field. type converges to three values: text (plain text output), json_object (JSON output).
Passed by the user side, needs to be unique; used to distinguish each request, 6–64 characters. If not provided by the user side, the platform will generate one by default.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Overview - Z.AI DEVELOPER DOCUMENT","description":"Use GLM models like GLM-5.3 \u0026 GLM-5.3-FLASH for AI coding in Claude Code, Kilo Code, Cline, OpenCode, Clawdbot/OpenClaw and more. Plans from $18/month—fast, reliable code generation and tool use for daily dev work.","colors":{"primary":"#141618","light":"#9fa0a0","dark":"#141618"},"logo":{"light":"https://mintcdn.com/zhipu-32152247/B_E8wI-eiNa1QlPV/logo/dark.svg?fit=max\u0026auto=format\u0026n=B_E8wI-eiNa1QlPV\u0026q=85\u0026s=75deefa9dea5bdbc84d4da68885c267f","dark":"https://mintcdn.com/zhipu-32152247/B_E8wI-eiNa1QlPV/logo/light.svg?fit=max\u0026auto=format\u0026n=B_E8wI-eiNa1QlPV\u0026q=85\u0026s=c1ecf1af358fa8eeab8c06052337f8f6","href":"https://z.ai/model-api"},"favicon":"https://mintcdn.com/zhipu-32152247/ZWmez2h5N6TCeIMS/favicon.svg?fit=max\u0026auto=format\u0026n=ZWmez2h5N6TCeIMS\u0026q=85\u0026s=f41adc4aa1fc28f2be33d46791810b1f","api":{"openapi":["openapi.json"],"params":{"expanded":"all"},"playground":{"display":"interactive","proxy":false},"examples":{"defaults":"all","languages":["bash","python","javascript","java"],"prefill":true}},"appearance":{"default":"dark","strict":false},"navbar":{"links":[{"href":"https://z.ai/manage-apikey/apikey-list","label":"API Keys"},{"href":"https://z.ai/manage-apikey/billing","label":"Payment Method"}]},"footer":{"socials":{"x":"https://x.com/Zai_org","github":"https://github.com/zai-org","discord":"https://discord.gg/QR7SARHRxK","linkedin":"https://www.linkedin.com/company/zdotai"}},"contextual":{"options":["copy","view"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"zhipu-32152247","hasAudioNarration":false,"actualSubdomain":"zhipu-32152247","customDomains":["docs.z.ai"],"gitSource":{"type":"github","owner":"zai-doc","repo":"zai-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ad982b40692ca83e0558190","collectionId":"337c0221-7d4f-481b-b364-9baa28b1cd47","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ad982b40692ca83e0558190"},"feedback":{"thumbs":true},"entitlements":{},"buildId":"6ad982b40692ca83e0558190","clientVersion":"0.0.3969","searchFilterCounts":[{"language":"default","tag":"Guides","count":25},{"language":"default","tag":"API Reference","count":18},{"language":"default","tag":"Coding Plan","count":18},{"language":"default","tag":"Get Started","count":10},{"language":"default","tag":"Guide","count":8},{"language":"default","tag":"Capabilities","count":7},{"language":"default","tag":"SDKs Guide","count":5},{"language":"default","tag":"Agent API","count":4},{"language":"default","tag":"Tool API","count":4},{"language":"default","tag":"GLM Coding Plan","count":4}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"isAtlas":false,"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"#footer div:last-child{display:none}.md\\:h-10{height:3rem}.prose-dark :where(a):not(:where([class~=not-prose],[class~=not-prose] *)),.prose-dark :where(strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:900}"}],"page":{"pagePath":"api-reference/llm/chat-completion","slug":"/api-reference/llm/chat-completion","pageMetadata":{"title":"Chat Completion","openapi":"POST /paas/v4/chat/completions","description":"Create a chat completion model that generates AI replies for given conversation messages. It supports multimodal inputs (text, images, audio, video, file), offers configurable parameters (like temperature, max tokens, tool use), and supports both streaming and non-streaming output modes.","href":"/api-reference/llm/chat-completion"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Create a chat completion model that generates AI replies for given conversation messages. It supports multimodal inputs (text, images, audio, video, file), offers configurable parameters (like temperature, max tokens, tool use), and supports both streaming and non-streaming output modes.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){return _jsx(_Fragment,{})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Chat Completion","openapi":"POST /paas/v4/chat/completions","description":"Create a chat completion model that generates AI replies for given conversation messages. It supports multimodal inputs (text, images, audio, video, file), offers configurable parameters (like temperature, max tokens, tool use), and supports both streaming and non-streaming output modes.","href":"/api-reference/llm/chat-completion"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"description":"Create a chat completion model that generates AI replies for given conversation messages. It supports multimodal inputs (text, images, audio, video, file), offers configurable parameters (like temperature, max tokens, tool use), and supports both streaming and non-streaming output modes.","parameters":["904a8813-38b0-45b0-a587-79c87dd87146"],"requestBody":"c4e0dbc6-e7ee-45db-957a-ec847ab15b91","responses":{"200":"59ec6f3e-dd1c-470d-8fa2-4e1ecba98d00","default":"2770d7b2-4a2b-4dcd-a65f-4576730edd8d"},"method":"post","type":"path","servers":["6d656395-5221-49af-96d5-e56c4cf5568b"],"security":["3d8be473-071c-4e09-8522-b9c2a59933dc"],"path":"/paas/v4/chat/completions","baseUrlOptions":["https://api.z.ai/api"],"title":"","codeSamples":[],"requestExampleLanguages":["bash","python","javascript","java"],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated","prefillPlaygroundWithExample":true,"prefillPlaygroundExamples":[{"body.oneOf.0.model":"glm-5.3","body.oneOf.0.messages.items.0.oneOf.1.role":"system","body.oneOf.0.messages.items.0.oneOf.1.content":"You are a helpful coding assistant.","body.oneOf.0.messages.items.1.oneOf.0.role":"user","body.oneOf.0.messages.items.1.oneOf.0.content":"Write a Python function to calculate the factorial of a number.","body.oneOf.0.stream":false,"body.oneOf.0.temperature":1},{"body.oneOf.0.model":"glm-5.3","body.oneOf.0.messages.items.0.oneOf.1.role":"system","body.oneOf.0.messages.items.0.oneOf.1.content":"You are a helpful coding assistant.","body.oneOf.0.messages.items.1.oneOf.0.role":"user","body.oneOf.0.messages.items.1.oneOf.0.content":"Write a Python function to calculate the factorial of a number.","body.oneOf.0.stream":true,"body.oneOf.0.temperature":1},{"body.oneOf.0.model":"glm-5.3","body.oneOf.0.messages.items.0.oneOf.1.role":"system","body.oneOf.0.messages.items.0.oneOf.1.content":"You are a helpful coding assistant.","body.oneOf.0.messages.items.1.oneOf.0.role":"user","body.oneOf.0.messages.items.1.oneOf.0.content":"Write a Python function to calculate the factorial of a number.","body.oneOf.0.stream":true,"body.oneOf.0.thinking.type":"enabled"},{"body.oneOf.0.model":"glm-5.3","body.oneOf.0.messages.items.0.oneOf.1.role":"system","body.oneOf.0.messages.items.0.oneOf.1.content":"You are a professional programming assistant.","body.oneOf.0.messages.items.1.oneOf.0.role":"user","body.oneOf.0.messages.items.1.oneOf.0.content":"What is recursion?","body.oneOf.0.messages.items.2.oneOf.2.role":"assistant","body.oneOf.0.messages.items.2.oneOf.2.content":"Recursion is a programming technique where a function calls itself to solve a problem... What is recursion","body.oneOf.0.messages.items.3.oneOf.0.role":"user","body.oneOf.0.messages.items.3.oneOf.0.content":"Can you give me an example of Python recursion?","body.oneOf.0.stream":true},{"body.oneOf.1.model":"glm-5.3-flashx","body.oneOf.1.messages.items.0.oneOf.0.role":"user","body.oneOf.1.messages.items.0.oneOf.0.content.oneOf.0.items.0.oneOf.1.type":"image_url","body.oneOf.1.messages.items.0.oneOf.0.content.oneOf.0.items.0.oneOf.1.image_url.url":"https://cdn.bigmodel.cn/static/logo/register.png","body.oneOf.1.messages.items.0.oneOf.0.content.oneOf.0.items.1.oneOf.1.type":"image_url","body.oneOf.1.messages.items.0.oneOf.0.content.oneOf.0.items.1.oneOf.1.image_url.url":"https://cdn.bigmodel.cn/static/logo/api-key.png","body.oneOf.1.messages.items.0.oneOf.0.content.oneOf.0.items.2.oneOf.0.type":"text","body.oneOf.1.messages.items.0.oneOf.0.content.oneOf.0.items.2.oneOf.0.text":"What are the pics talk about?"},{"body.oneOf.1.model":"glm-5.3-flashx","body.oneOf.1.messages.items.0.oneOf.0.role":"user","body.oneOf.1.messages.items.0.oneOf.0.content.oneOf.0.items.0.oneOf.2.type":"video_url","body.oneOf.1.messages.items.0.oneOf.0.content.oneOf.0.items.0.oneOf.2.video_url.url":"https://cdn.bigmodel.cn/agent-demos/lark/113123.mov","body.oneOf.1.messages.items.0.oneOf.0.content.oneOf.0.items.1.oneOf.0.type":"text","body.oneOf.1.messages.items.0.oneOf.0.content.oneOf.0.items.1.oneOf.0.text":"What are the video show about?"},{"body.oneOf.1.model":"glm-5.3-flash","body.oneOf.1.messages.items.0.oneOf.0.role":"user","body.oneOf.1.messages.items.0.oneOf.0.content.oneOf.0.items.0.oneOf.3.type":"file","body.oneOf.1.messages.items.0.oneOf.0.content.oneOf.0.items.0.oneOf.3.file.file_url":"https://cdn.bigmodel.cn/static/demo/demo2.txt","body.oneOf.1.messages.items.0.oneOf.0.content.oneOf.0.items.1.oneOf.3.type":"file","body.oneOf.1.messages.items.0.oneOf.0.content.oneOf.0.items.1.oneOf.3.file.file_url":"https://cdn.bigmodel.cn/static/demo/demo1.pdf","body.oneOf.1.messages.items.0.oneOf.0.content.oneOf.0.items.2.oneOf.0.type":"text","body.oneOf.1.messages.items.0.oneOf.0.content.oneOf.0.items.2.oneOf.0.text":"What are the files show about?"},{"body.oneOf.0.model":"glm-5.3","body.oneOf.0.messages.items.0.oneOf.0.role":"user","body.oneOf.0.messages.items.0.oneOf.0.content":"Is there an example of how the weather in Beijing is today?","body.oneOf.0.temperature":0.3,"body.oneOf.0.tools.items.0.oneOf.0.type":"function","body.oneOf.0.tools.items.0.oneOf.0.function.name":"get_weather","body.oneOf.0.tools.items.0.oneOf.0.function.description":"Get weather information for the specified city.","body.oneOf.0.tools.items.0.oneOf.0.function.parameters":{"type":"object","properties":{"city":{"type":"string","description":"City Name"}},"required":["city"]},"body.oneOf.0.tool_choice":"auto"}],"disableProxy":true},"dependencies":{"parameters":{"904a8813-38b0-45b0-a587-79c87dd87146":{"name":"Accept-Language","in":"header","schema":{"type":"string","description":"Config desired response language for HTTP requests.","default":"en-US,en","example":"en-US,en","enum":["en-US,en"],"isRequired":false,"uniqueKey":"","typeLabel":"enum\u003cstring>"},"required":false}},"requestBody":{"content":{"application/json":{"schema":{"oneOf":[{"type":"object","title":"Text Model","required":["model","messages"],"properties":{"model":{"type":"string","description":"The model code to be called. GLM-5.3, GLM-5.2, GLM-5.1 are the latest flagship model series, foundational models specifically designed for agent applications.","example":"glm-5.3","default":"glm-5.3","enum":["glm-5.3","glm-5.2","glm-5.1","glm-5","glm-4.7","glm-4.6"],"isRequired":true,"uniqueKey":"oneOf.0.model","typeLabel":"enum\u003cstring>"},"messages":{"type":"array","description":"The current conversation message list as the model’s prompt input, provided in JSON array format, e.g.,`{“role”: “user”, “content”: “Hello”}`. Possible message types include system messages, user messages, assistant messages, and tool messages. Note: The input must not consist of system messages or assistant messages only.","items":{"oneOf":[{"type":"object","title":"User Message","required":["role","content"],"properties":{"role":{"type":"string","enum":["user"],"description":"Role of the message author","default":"user","isRequired":true,"uniqueKey":"oneOf.0.messages.items.[INDEX].oneOf.0.role","typeLabel":"enum\u003cstring>"},"content":{"type":"string","description":"Text message content","example":"What opportunities and challenges will the Chinese large model industry face in 2025?","isRequired":true,"uniqueKey":"oneOf.0.messages.items.[INDEX].oneOf.0.content","typeLabel":"string"}},"uniqueKey":"oneOf.0.messages.items.[INDEX].oneOf.0","typeLabel":"User Message · object"},{"type":"object","title":"System Message","required":["role","content"],"properties":{"role":{"type":"string","enum":["system"],"description":"Role of the message author","default":"system","isRequired":true,"uniqueKey":"oneOf.0.messages.items.[INDEX].oneOf.1.role","typeLabel":"enum\u003cstring>"},"content":{"type":"string","description":"Message text content","example":"You are a helpful assistant.","isRequired":true,"uniqueKey":"oneOf.0.messages.items.[INDEX].oneOf.1.content","typeLabel":"string"}},"uniqueKey":"oneOf.0.messages.items.[INDEX].oneOf.1","typeLabel":"System Message · object"},{"type":"object","title":"Assistant Message","description":"Can include tool calls","required":["role"],"properties":{"role":{"type":"string","enum":["assistant"],"description":"Role of the message author","default":"assistant","isRequired":true,"uniqueKey":"oneOf.0.messages.items.[INDEX].oneOf.2.role","typeLabel":"enum\u003cstring>"},"content":{"type":"string","description":"Text message content","example":"I'll help you with that analysis.","uniqueKey":"oneOf.0.messages.items.[INDEX].oneOf.2.content","typeLabel":"string"},"tool_calls":{"type":"array","description":"Tool call messages generated by the model. When this field is provided, content is usually empty.","items":{"type":"object","properties":{"id":{"type":"string","description":"Tool call ID","isRequired":true,"uniqueKey":"oneOf.0.messages.items.[INDEX].oneOf.2.tool_calls.items.[INDEX].id","typeLabel":"string"},"type":{"type":"string","description":"Tool type, supports web_search, retrieval, function","enum":["function","web_search","retrieval"],"isRequired":true,"uniqueKey":"oneOf.0.messages.items.[INDEX].oneOf.2.tool_calls.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"function":{"type":"object","description":"Function call information, not empty when type is function","properties":{"name":{"type":"string","description":"Function name","isRequired":true,"uniqueKey":"oneOf.0.messages.items.[INDEX].oneOf.2.tool_calls.items.[INDEX].function.name","typeLabel":"string"},"arguments":{"type":"string","description":"Function parameters, JSON format string","isRequired":true,"uniqueKey":"oneOf.0.messages.items.[INDEX].oneOf.2.tool_calls.items.[INDEX].function.arguments","typeLabel":"string"}},"required":["name","arguments"],"uniqueKey":"oneOf.0.messages.items.[INDEX].oneOf.2.tool_calls.items.[INDEX].function","typeLabel":"object"}},"required":["id","type"],"uniqueKey":"oneOf.0.messages.items.[INDEX].oneOf.2.tool_calls.items.[INDEX]","typeLabel":"object"},"uniqueKey":"oneOf.0.messages.items.[INDEX].oneOf.2.tool_calls","typeLabel":"object[]"}},"uniqueKey":"oneOf.0.messages.items.[INDEX].oneOf.2","typeLabel":"Assistant Message · object"},{"type":"object","title":"Tool Message","required":["role","content","tool_call_id"],"properties":{"role":{"type":"string","enum":["tool"],"description":"Role of the message author","default":"tool","isRequired":true,"uniqueKey":"oneOf.0.messages.items.[INDEX].oneOf.3.role","typeLabel":"enum\u003cstring>"},"content":{"type":"string","description":"Message text content","example":"Function executed successfully with result: ...","isRequired":true,"uniqueKey":"oneOf.0.messages.items.[INDEX].oneOf.3.content","typeLabel":"string"},"tool_call_id":{"type":"string","description":"Indicates the tool call ID corresponding to this message","isRequired":true,"uniqueKey":"oneOf.0.messages.items.[INDEX].oneOf.3.tool_call_id","typeLabel":"string"}},"uniqueKey":"oneOf.0.messages.items.[INDEX].oneOf.3","typeLabel":"Tool Message · object"}],"uniqueKey":"oneOf.0.messages.items.[INDEX]","typeLabel":"User Message · object | System Message · object | Assistant Message · object | Tool Message · object"},"minItems":1,"isRequired":true,"uniqueKey":"oneOf.0.messages","typeLabel":"(User Message · object | System Message · object | Assistant Message · object | Tool Message · object)[]"},"do_sample":{"type":"boolean","example":true,"default":true,"description":"When do_sample is true, sampling strategy is enabled; when do_sample is false, sampling strategy parameters such as temperature and top_p will not take effect. Default value is `true`.","uniqueKey":"oneOf.0.do_sample","typeLabel":"boolean"},"stream":{"type":"boolean","example":false,"default":false,"description":"This parameter should be set to false or omitted when using synchronous call. It indicates that the model returns all content at once after generating all content. Default value is false. If set to true, the model will return the generated content in chunks via standard Event Stream. When the Event Stream ends, a `data: [DONE]` message will be returned.","uniqueKey":"oneOf.0.stream","typeLabel":"boolean"},"thinking":{"type":"object","description":"Only supported by GLM-4.6 series and higher models. This parameter is used to control whether the model enable the chain of thought.","properties":{"type":{"type":"string","description":"Whether to enable the chain of thought(`GLM-5.3` `GLM-5.3-FLASH` series can only be enabled, and the thinking depth is controlled by `reasoning_effort`; for other models, when enabled, GLM-5.2 GLM-5.1 GLM-5 GLM-4.6 and others will automatically determine whether to think, while GLM-4.7 will think compulsorily), default: enabled","default":"enabled","enum":["enabled","disabled"],"uniqueKey":"oneOf.0.thinking.type","typeLabel":"enum\u003cstring>"},"clear_thinking":{"type":"boolean","description":"Default value is True. Controls whether to clear `reasoning_content` from previous conversation turns. View more in [Thinking Mode](/guides/capabilities/thinking-mode). \n - `true` (default): For this request, the system ignores/removes `reasoning_content` from prior turns, and only keeps non-reasoning context (e.g., user/assistant visible text, tool calls, and tool results). This is recommended for general chat or lightweight tasks to reduce context length and cost. \n - `false`: Retains `reasoning_content` from prior turns and includes it in the context sent to the model. To enable Preserved Thinking, you must forward the full, unmodified, and correctly ordered historical `reasoning_content` in `messages`. Missing, truncated, rewritten, or reordered blocks may degrade performance or prevent the feature from taking effect. \n - Notes: This parameter only affects cross-turn historical thinking blocks; it does not change whether the model generates/returns thinking in the current turn.","default":true,"example":true,"uniqueKey":"oneOf.0.thinking.clear_thinking","typeLabel":"boolean"}},"uniqueKey":"oneOf.0.thinking","typeLabel":"object"},"reasoning_effort":{"type":"string","description":"Controls the model's reasoning effort level, takes effect when `thinking` is enabled. Default is `max`, supported by `GLM-5.2` and above. For the `GLM-5.3` `GLM-5.3-FLASH` model, only the `low` / `high` / `max` levels are supported. For the `GLM-5.2` model, for compatibility with other protocols, passing `none` or `minimal` will cause the model to skip thinking; `low` and `medium` will be mapped to `high`; `xhigh` will be mapped to `max`.","example":"max","default":"max","enum":["max","xhigh","high","medium","low","minimal","none"],"uniqueKey":"oneOf.0.reasoning_effort","typeLabel":"enum\u003cstring>"},"temperature":{"type":"number","description":"Sampling temperature, controls the randomness of the output, must be a positive number within the range: `[0.0, 1.0]`. The GLM-5.3, GLM-5.2, GLM-5.1, GLM-5, GLM-4.7, GLM-4.6 series default value is `1.0`","format":"float","example":1,"default":1,"minimum":0,"maximum":1,"uniqueKey":"oneOf.0.temperature","typeLabel":"number\u003cfloat>"},"top_p":{"type":"number","description":"Another method of temperature sampling, value range is: `[0.01, 1.0]`. The GLM-5.3, GLM-5.2, GLM-5.1, GLM-5, GLM-4.7, GLM-4.6 series default value is `0.95`.","format":"float","example":0.95,"default":0.95,"minimum":0.01,"maximum":1,"uniqueKey":"oneOf.0.top_p","typeLabel":"number\u003cfloat>"},"max_tokens":{"type":"integer","description":"The maximum number of tokens for model output, the GLM-5.3, GLM-5.2, GLM-5.1, GLM-5, GLM-4.7, GLM-4.6 series supports 128K maximum output.","example":1024,"minimum":1,"maximum":131072,"uniqueKey":"oneOf.0.max_tokens","typeLabel":"integer"},"tool_stream":{"type":"boolean","example":false,"default":false,"description":"Whether to enable streaming response for Function Calls. Default value is false. Only supported by the GLM-5.3, GLM-5.2, GLM-5.1, GLM-5, GLM-4.7, and GLM-4.6 series. Refer to the [Stream Tool Call](/guides/tools/stream-tool)","uniqueKey":"oneOf.0.tool_stream","typeLabel":"boolean"},"tools":{"type":"array","description":"A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.\n","items":{"oneOf":[{"type":"object","title":"Function Call","required":["type","function"],"properties":{"type":{"type":"string","default":"function","enum":["function"],"isRequired":true,"uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.0.type","typeLabel":"enum\u003cstring>"},"function":{"type":"object","properties":{"name":{"type":"string","description":"The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.","minLength":1,"maxLength":64,"pattern":"^[a-zA-Z0-9_-]+$","isRequired":true,"uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.0.function.name","typeLabel":"string"},"description":{"type":"string","description":"A description of what the function does, used by the model to choose when and how to call the function.","isRequired":true,"uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.0.function.description","typeLabel":"string"},"parameters":{"type":"object","description":"Parameters defined using JSON Schema. Must pass a JSON Schema object to accurately define accepted parameters. Omit if no parameters are needed when calling the function.","additionalProperties":true,"isRequired":true,"uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.0.function.parameters","typeLabel":"object"}},"required":["name","description","parameters"],"isRequired":true,"uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.0.function","typeLabel":"object"}},"additionalProperties":false,"uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.0","typeLabel":"Function Call · object"},{"type":"object","title":"Retrieval","required":["type","retrieval"],"properties":{"type":{"type":"string","default":"retrieval","enum":["retrieval"],"isRequired":true,"uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.1.type","typeLabel":"enum\u003cstring>"},"retrieval":{"type":"object","properties":{"knowledge_id":{"type":"string","description":"Knowledge base ID, created or obtained from the platform","isRequired":true,"uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.1.retrieval.knowledge_id","typeLabel":"string"},"prompt_template":{"type":"string","description":"Prompt template for requesting the model, a custom request template containing placeholders `{{ knowledge }}` and `{{ question }}`. Default template: Search for the answer to the question `{{question}}` in the document `{{ knowledge }}`. If an answer is found, respond only using statements from the document; if no answer is found, use your own knowledge to answer and inform the user that the information is not from the document. Do not repeat the question, start the answer directly.","uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.1.retrieval.prompt_template","typeLabel":"string"}},"required":["knowledge_id"],"isRequired":true,"uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.1.retrieval","typeLabel":"object"}},"additionalProperties":false,"uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.1","typeLabel":"Retrieval · object"},{"type":"object","title":"Web Search","required":["type","web_search"],"properties":{"type":{"type":"string","default":"web_search","enum":["web_search"],"isRequired":true,"uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.2.type","typeLabel":"enum\u003cstring>"},"web_search":{"type":"object","properties":{"search_engine":{"type":"string","description":"Type of search engine.\nDefault is `search_pro_jina`. Supports: `search_pro_jina`.","enum":["search_pro_jina"],"isRequired":true,"uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.2.web_search.search_engine","typeLabel":"enum\u003cstring>"},"enable":{"type":"boolean","description":"Whether to enable search functionality.\nDefault is `false`. Set to true to `enable`.","uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.2.web_search.enable","typeLabel":"boolean"},"search_query":{"type":"string","description":"Force trigger a search","uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.2.web_search.search_query","typeLabel":"string"},"count":{"type":"integer","description":"Number of returned results\nRange: `1-50`, max `50` results per search\nDefault is `10`\nSupported engines: `search_pro_jina`\n","minimum":1,"maximum":50,"uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.2.web_search.count","typeLabel":"integer"},"search_domain_filter":{"type":"string","description":"Limits search results to specified whitelisted domains. Whitelist: input domains directly (e.g., www.example.com)\nSupported engines: `search_pro_jina`","uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.2.web_search.search_domain_filter","typeLabel":"string"},"search_recency_filter":{"type":"string","description":"Limits search to a specific time range.\nDefault is `noLimit`\nValues:\n`oneDay`, within a day\n`oneWeek`, within a week\n`oneMonth`, within a month\n`oneYear`, within a year\n`noLimit`, no limit (default)\nSupported engines: `search_pro_jina`","enum":["oneDay","oneWeek","oneMonth","oneYear","noLimit"],"uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.2.web_search.search_recency_filter","typeLabel":"enum\u003cstring>"},"content_size":{"type":"string","description":"Number of characters for webpage summaries.\nDefault is `medium`\n`medium`: Balanced mode for most queries. 400-600 characters\n`high`: Maximizes context for comprehensive answers, 2500 characters.","enum":["medium","high"],"uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.2.web_search.content_size","typeLabel":"enum\u003cstring>"},"result_sequence":{"type":"string","description":"Specifies whether search results are shown before or after model response. Options: `before`, `after`. Default is `after`","enum":["before","after"],"uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.2.web_search.result_sequence","typeLabel":"enum\u003cstring>"},"search_result":{"type":"boolean","description":"Whether to return search results in the response.\nDefault is `false`","uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.2.web_search.search_result","typeLabel":"boolean"},"require_search":{"type":"boolean","description":"Whether to force model response based on search result.\nDefault is `false`","uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.2.web_search.require_search","typeLabel":"boolean"},"search_prompt":{"type":"string","description":"Prompt to customize how search results are processed.\nDefault Prompt:\n`You are an intelligent Q\u0026A expert with the ability to synthesize information, recognize time, understand semantics, and clean contradictory data. The current date is {{current_date}}. Use this as the only time reference. Based on the following information, provide a comprehensive and accurate answer to the user's question.Only extract valuable content for the answer. Ensure the answer is timely and authoritative. State the answer directly without citing data sources or internal processes.`","uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.2.web_search.search_prompt","typeLabel":"string"}},"required":["search_engine"],"isRequired":true,"uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.2.web_search","typeLabel":"object"}},"additionalProperties":false,"uniqueKey":"oneOf.0.tools.items.[INDEX].oneOf.2","typeLabel":"Web Search · object"}],"uniqueKey":"oneOf.0.tools.items.[INDEX]","typeLabel":"Function Call · object | Retrieval · object | Web Search · object"},"uniqueKey":"oneOf.0.tools","typeLabel":"(Function Call · object | Retrieval · object | Web Search · object)[]"},"tool_choice":{"type":"string","description":"Controls how the model selects a tool.","enum":["auto"],"uniqueKey":"oneOf.0.tool_choice","typeLabel":"enum\u003cstring>"},"stop":{"type":"array","description":"Stop word list. Generation stops when the model encounters any specified string. Currently, only one stop word is supported, in the format [\"stop_word1\"].","items":{"type":"string","uniqueKey":"oneOf.0.stop.items.[INDEX]","typeLabel":"string"},"maxItems":4,"uniqueKey":"oneOf.0.stop","typeLabel":"string[]"},"response_format":{"type":"object","description":"Specifies the response format of the model. Defaults to text. Only text models support this field. `type` converges to three values: `text` (plain text output), `json_object` (JSON output).","properties":{"type":{"type":"string","enum":["text","json_object"],"default":"text","description":"Output format type: text for plain text, json_object for JSON-formatted output.","isRequired":true,"uniqueKey":"oneOf.0.response_format.type","typeLabel":"enum\u003cstring>"}},"required":["type"],"uniqueKey":"oneOf.0.response_format","typeLabel":"object"},"request_id":{"type":"string","description":"Passed by the user side, needs to be unique; used to distinguish each request, 6–64 characters. If not provided by the user side, the platform will generate one by default.","minLength":6,"maxLength":64,"uniqueKey":"oneOf.0.request_id","typeLabel":"string"},"user_id":{"type":"string","description":"Unique ID for the end user, 6–128 characters. Avoid using sensitive information.","minLength":6,"maxLength":128,"uniqueKey":"oneOf.0.user_id","typeLabel":"string"}},"uniqueKey":"oneOf.0","typeLabel":"Text Model · object"},{"type":"object","title":"Vision Model","required":["model","messages"],"properties":{"model":{"type":"string","description":"The model code to be called. The `GLM-5.3-Flash` series supports visual understanding, delivering excellent multimodal comprehension and tool calling capabilities.","example":"glm-5.3-flashx","default":"glm-5.3-flashx","enum":["glm-5.3-flashx","glm-5.3-flash"],"isRequired":true,"uniqueKey":"oneOf.1.model","typeLabel":"enum\u003cstring>"},"messages":{"type":"array","description":"The current conversation message list as the model’s prompt input, provided in JSON array format, e.g.,`{“role”: “user”, “content”: “Hello”}`. Possible message types include system messages, user messages. Note: The input must not consist of system or assistant messages only.","items":{"oneOf":[{"type":"object","title":"User Message","required":["role","content"],"properties":{"role":{"type":"string","enum":["user"],"description":"Role of the message author","default":"user","isRequired":true,"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.role","typeLabel":"enum\u003cstring>"},"content":{"oneOf":[{"type":"array","items":{"oneOf":[{"type":"object","title":"Text","required":["type","text"],"properties":{"type":{"type":"string","enum":["text"],"description":"Content type is text","default":"text","isRequired":true,"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content.oneOf.0.items.[INDEX].oneOf.0.type","typeLabel":"enum\u003cstring>"},"text":{"type":"string","description":"Text content","isRequired":true,"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content.oneOf.0.items.[INDEX].oneOf.0.text","typeLabel":"string"}},"additionalProperties":false,"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content.oneOf.0.items.[INDEX].oneOf.0","typeLabel":"Text · object"},{"type":"object","title":"Image","required":["type","image_url"],"properties":{"type":{"type":"string","enum":["image_url"],"description":"Content type is image URL","default":"image_url","isRequired":true,"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content.oneOf.0.items.[INDEX].oneOf.1.type","typeLabel":"enum\u003cstring>"},"image_url":{"type":"object","description":"Image information","properties":{"url":{"type":"string","description":"Image URL or Base64 encoding. Image size limit is under 5M per image, with pixels not exceeding 6000*6000. GLM-5V are limited to 150 sheets.Supports jpg, png, jpeg formats.","isRequired":true,"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content.oneOf.0.items.[INDEX].oneOf.1.image_url.url","typeLabel":"string"}},"required":["url"],"additionalProperties":false,"isRequired":true,"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content.oneOf.0.items.[INDEX].oneOf.1.image_url","typeLabel":"object"}},"additionalProperties":false,"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content.oneOf.0.items.[INDEX].oneOf.1","typeLabel":"Image · object"},{"type":"object","title":"Video","required":["type","video_url"],"properties":{"type":{"type":"string","enum":["video_url"],"description":"Content type is video URL","default":"video_url","isRequired":true,"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content.oneOf.0.items.[INDEX].oneOf.2.type","typeLabel":"enum\u003cstring>"},"video_url":{"type":"object","description":"Video information.","properties":{"url":{"type":"string","description":"Video URL address.The video size is limited to within 200 MB,and the format supports `mp4`,`mkv`,`mov`.","isRequired":true,"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content.oneOf.0.items.[INDEX].oneOf.2.video_url.url","typeLabel":"string"}},"required":["url"],"additionalProperties":false,"isRequired":true,"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content.oneOf.0.items.[INDEX].oneOf.2.video_url","typeLabel":"object"}},"additionalProperties":false,"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content.oneOf.0.items.[INDEX].oneOf.2","typeLabel":"Video · object"},{"type":"object","title":"File","required":["type","file"],"properties":{"type":{"type":"string","enum":["file"],"description":"Content type is file. New unified file type, compatible with the legacy `file_url` type but not recommended for new scenarios. Not support passing both the `file` and `image_url` or `video_url` parameters at the same time.","default":"file","isRequired":true,"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content.oneOf.0.items.[INDEX].oneOf.3.type","typeLabel":"enum\u003cstring>"},"file":{"type":"object","description":"File content, supports one of `file_id`, `file_url`, or `file_data`. Single file size limit is `50M`.","properties":{"file_id":{"type":"string","description":"The ID returned by the [File Upload API](/api-reference/agents/file-upload), only GLM-5.3-Flash series supported.","uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content.oneOf.0.items.[INDEX].oneOf.3.file.file_id","typeLabel":"string"},"file_url":{"type":"string","description":"File URL address. Only GLM-5.3-Flash series. Supports formats such as pdf, txt, word, jsonl, xlsx, pptx, with a maximum of 50.","uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content.oneOf.0.items.[INDEX].oneOf.3.file.file_url","typeLabel":"string"},"file_data":{"type":"string","description":"Base64 file content in the format `data:\u003cMIME>;base64,\u003cBASE64_DATA>`.","uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content.oneOf.0.items.[INDEX].oneOf.3.file.file_data","typeLabel":"string"},"filename":{"type":"string","description":"File name.","uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content.oneOf.0.items.[INDEX].oneOf.3.file.filename","typeLabel":"string"}},"additionalProperties":false,"isRequired":true,"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content.oneOf.0.items.[INDEX].oneOf.3.file","typeLabel":"object"}},"additionalProperties":false,"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content.oneOf.0.items.[INDEX].oneOf.3","typeLabel":"File · object"}],"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content.oneOf.0.items.[INDEX]","typeLabel":"Text · object | Image · object | Video · object | File · object"},"description":"Multimodal message content, supports text, images, video, file","isRequired":true,"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content.oneOf.0","typeLabel":"(Text · object | Image · object | Video · object | File · object)[]"},{"type":"string","description":"Text message content (can switch to multimodal message above)","example":"What opportunities and challenges will the Chinese large model industry face in 2025?","isRequired":true,"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content.oneOf.1","typeLabel":"string"}],"isRequired":true,"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0.content","typeLabel":"(Text · object | Image · object | Video · object | File · object)[] | string"}},"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.0","typeLabel":"User Message · object"},{"type":"object","title":"System Message","required":["role","content"],"properties":{"role":{"type":"string","enum":["system"],"description":"Role of the message author","default":"system","isRequired":true,"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.1.role","typeLabel":"enum\u003cstring>"},"content":{"type":"string","description":"Message text content","example":"You are a helpful assistant.","isRequired":true,"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.1.content","typeLabel":"string"}},"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.1","typeLabel":"System Message · object"},{"type":"object","title":"Assistant Message","description":"Can include tool calls","required":["role"],"properties":{"role":{"type":"string","enum":["assistant"],"description":"Role of the message author","default":"assistant","isRequired":true,"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.2.role","typeLabel":"enum\u003cstring>"},"content":{"type":"string","description":"Text message content","example":"I'll help you with that analysis.","uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.2.content","typeLabel":"string"}},"uniqueKey":"oneOf.1.messages.items.[INDEX].oneOf.2","typeLabel":"Assistant Message · object"}],"uniqueKey":"oneOf.1.messages.items.[INDEX]","typeLabel":"User Message · object | System Message · object | Assistant Message · object"},"minItems":1,"isRequired":true,"uniqueKey":"oneOf.1.messages","typeLabel":"(User Message · object | System Message · object | Assistant Message · object)[]"},"do_sample":{"type":"boolean","example":true,"default":true,"description":"When do_sample is true, sampling strategy is enabled; when do_sample is false, sampling strategy parameters such as temperature and top_p will not take effect. Default value is `true`.","uniqueKey":"oneOf.1.do_sample","typeLabel":"boolean"},"stream":{"type":"boolean","example":false,"default":false,"description":"This parameter should be set to false or omitted when using synchronous call. It indicates that the model returns all content at once after generating all content. Default value is false. If set to true, the model will return the generated content in chunks via standard Event Stream. When the Event Stream ends, a `data: [DONE]` message will be returned.","uniqueKey":"oneOf.1.stream","typeLabel":"boolean"},"thinking":{"type":"object","description":"Only supported by GLM-4.6 series and higher models. This parameter is used to control whether the model enable the chain of thought.","properties":{"type":{"type":"string","description":"Whether to enable the chain of thought(`GLM-5.3` `GLM-5.3-FLASH` series can only be enabled, and the thinking depth is controlled by `reasoning_effort`; for other models, when enabled, GLM-5.2 GLM-5.1 GLM-5 GLM-4.6 and others will automatically determine whether to think, while GLM-4.7 will think compulsorily), default: enabled","default":"enabled","enum":["enabled","disabled"],"uniqueKey":"oneOf.1.thinking.type","typeLabel":"enum\u003cstring>"},"clear_thinking":{"type":"boolean","description":"Default value is True. Controls whether to clear `reasoning_content` from previous conversation turns. View more in [Thinking Mode](/guides/capabilities/thinking-mode). \n - `true` (default): For this request, the system ignores/removes `reasoning_content` from prior turns, and only keeps non-reasoning context (e.g., user/assistant visible text, tool calls, and tool results). This is recommended for general chat or lightweight tasks to reduce context length and cost. \n - `false`: Retains `reasoning_content` from prior turns and includes it in the context sent to the model. To enable Preserved Thinking, you must forward the full, unmodified, and correctly ordered historical `reasoning_content` in `messages`. Missing, truncated, rewritten, or reordered blocks may degrade performance or prevent the feature from taking effect. \n - Notes: This parameter only affects cross-turn historical thinking blocks; it does not change whether the model generates/returns thinking in the current turn.","default":true,"example":true,"uniqueKey":"oneOf.1.thinking.clear_thinking","typeLabel":"boolean"}},"uniqueKey":"oneOf.1.thinking","typeLabel":"object"},"reasoning_effort":{"type":"string","description":"Controls the model's reasoning effort level, takes effect when `thinking` is enabled. Default is `max`.","example":"max","default":"max","enum":["max","high","low"],"uniqueKey":"oneOf.1.reasoning_effort","typeLabel":"enum\u003cstring>"},"temperature":{"type":"number","description":"Sampling temperature, controls the randomness of the output, must be a positive number within the range: `[0.0, 1.0]`. For `GLM-5.3-Flash` series the default value is `1.0`.","format":"float","example":1,"default":1,"minimum":0,"maximum":1,"uniqueKey":"oneOf.1.temperature","typeLabel":"number\u003cfloat>"},"top_p":{"type":"number","description":"Another method of temperature sampling, value range is: `[0.01, 1.0]`. For `GLM-5.3-Flash` series the default value is `0.95`.","format":"float","example":0.95,"default":0.95,"minimum":0.01,"maximum":1,"uniqueKey":"oneOf.1.top_p","typeLabel":"number\u003cfloat>"},"max_tokens":{"type":"integer","description":"The maximum number of tokens for model output. `GLM-5.3-Flash` series supports a maximum output length of 128K.","example":1024,"minimum":1,"maximum":131072,"uniqueKey":"oneOf.1.max_tokens","typeLabel":"integer"},"tools":{"type":"array","description":"A list of tools the model may call. Only supported by `GLM-5.3-Flash` series.Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.\n","items":{"type":"object","title":"Function Call","required":["type","function"],"properties":{"type":{"type":"string","default":"function","enum":["function"],"isRequired":true,"uniqueKey":"oneOf.1.tools.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"function":{"type":"object","properties":{"name":{"type":"string","description":"The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.","minLength":1,"maxLength":64,"pattern":"^[a-zA-Z0-9_-]+$","isRequired":true,"uniqueKey":"oneOf.1.tools.items.[INDEX].function.name","typeLabel":"string"},"description":{"type":"string","description":"A description of what the function does, used by the model to choose when and how to call the function.","isRequired":true,"uniqueKey":"oneOf.1.tools.items.[INDEX].function.description","typeLabel":"string"},"parameters":{"type":"object","description":"Parameters defined using JSON Schema. Must pass a JSON Schema object to accurately define accepted parameters. Omit if no parameters are needed when calling the function.","additionalProperties":true,"isRequired":true,"uniqueKey":"oneOf.1.tools.items.[INDEX].function.parameters","typeLabel":"object"}},"required":["name","description","parameters"],"isRequired":true,"uniqueKey":"oneOf.1.tools.items.[INDEX].function","typeLabel":"object"}},"additionalProperties":false,"uniqueKey":"oneOf.1.tools.items.[INDEX]","typeLabel":"Function Call · object"},"uniqueKey":"oneOf.1.tools","typeLabel":"Function Call · object[]"},"tool_choice":{"type":"string","description":"Controls how the model selects a tool.","enum":["auto"],"uniqueKey":"oneOf.1.tool_choice","typeLabel":"enum\u003cstring>"},"stop":{"type":"array","description":"Stop word list. Generation stops when the model encounters any specified string. Currently, only one stop word is supported, in the format [\"stop_word1\"].","items":{"type":"string","uniqueKey":"oneOf.1.stop.items.[INDEX]","typeLabel":"string"},"maxItems":4,"uniqueKey":"oneOf.1.stop","typeLabel":"string[]"},"request_id":{"type":"string","description":"Passed by the user side, needs to be unique; used to distinguish each request, 6–64 characters. If not provided by the user side, the platform will generate one by default.","minLength":6,"maxLength":64,"uniqueKey":"oneOf.1.request_id","typeLabel":"string"},"user_id":{"type":"string","description":"Unique ID for the end user, 6–128 characters. Avoid using sensitive information.","minLength":6,"maxLength":128,"uniqueKey":"oneOf.1.user_id","typeLabel":"string"}},"uniqueKey":"oneOf.1","typeLabel":"Vision Model · object"}],"uniqueKey":"","typeLabel":"Text Model · object | Vision Model · object"},"examples":{"Basic Example":{"title":"Basic Example","value":{"model":"glm-5.3","messages":[{"role":"system","content":"You are a helpful coding assistant."},{"role":"user","content":"Write a Python function to calculate the factorial of a number."}],"temperature":1,"stream":false}},"Stream Example":{"title":"Stream Example","value":{"model":"glm-5.3","messages":[{"role":"system","content":"You are a helpful coding assistant."},{"role":"user","content":"Write a Python function to calculate the factorial of a number."}],"temperature":1,"stream":true}},"Thinking Example":{"title":"Thinking Example","value":{"model":"glm-5.3","messages":[{"role":"system","content":"You are a helpful coding assistant."},{"role":"user","content":"Write a Python function to calculate the factorial of a number."}],"thinking":{"type":"enabled"},"stream":true}},"Multi Conversation":{"title":"Multi Conversation","value":{"model":"glm-5.3","messages":[{"role":"system","content":"You are a professional programming assistant."},{"role":"user","content":"What is recursion?"},{"role":"assistant","content":"Recursion is a programming technique where a function calls itself to solve a problem... What is recursion"},{"role":"user","content":"Can you give me an example of Python recursion?"}],"stream":true}},"Image Visual Example":{"title":"Image Visual Example","value":{"model":"glm-5.3-flashx","messages":[{"role":"user","content":[{"type":"image_url","image_url":{"url":"https://cdn.bigmodel.cn/static/logo/register.png"}},{"type":"image_url","image_url":{"url":"https://cdn.bigmodel.cn/static/logo/api-key.png"}},{"type":"text","text":"What are the pics talk about?"}]}]}},"Video Visual Example":{"title":"Video Visual Example","value":{"model":"glm-5.3-flashx","messages":[{"role":"user","content":[{"type":"video_url","video_url":{"url":"https://cdn.bigmodel.cn/agent-demos/lark/113123.mov"}},{"type":"text","text":"What are the video show about?"}]}]}},"File Visual Example":{"title":"File Visual Example","value":{"model":"glm-5.3-flash","messages":[{"role":"user","content":[{"type":"file","file":{"file_url":"https://cdn.bigmodel.cn/static/demo/demo2.txt"}},{"type":"file","file":{"file_url":"https://cdn.bigmodel.cn/static/demo/demo1.pdf"}},{"type":"text","text":"What are the files show about?"}]}]}},"Function Call Example":{"title":"Function Call Example","value":{"model":"glm-5.3","messages":[{"role":"user","content":"Is there an example of how the weather in Beijing is today?"}],"tools":[{"type":"function","function":{"name":"get_weather","description":"Get weather information for the specified city.","parameters":{"type":"object","properties":{"city":{"type":"string","description":"City Name"}},"required":["city"]}}}],"tool_choice":"auto","temperature":0.3}}},"exampleType":"examples"}},"required":true,"exampleType":"examples"},"responses":{"59ec6f3e-dd1c-470d-8fa2-4e1ecba98d00":{"description":"Processing successful","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"Task ID","uniqueKey":"id","typeLabel":"string"},"request_id":{"description":"Request ID","type":"string","uniqueKey":"request_id","typeLabel":"string"},"created":{"description":"Request creation time, Unix timestamp in seconds","type":"integer","uniqueKey":"created","typeLabel":"integer"},"model":{"description":"Model name","type":"string","uniqueKey":"model","typeLabel":"string"},"choices":{"type":"array","description":"List of model responses","items":{"type":"object","properties":{"index":{"type":"integer","description":"Result index.","uniqueKey":"choices.items.[INDEX].index","typeLabel":"integer"},"message":{"type":"object","properties":{"role":{"type":"string","description":"Current conversation role, default is ‘assistant’ (model)","example":"assistant","uniqueKey":"choices.items.[INDEX].message.role","typeLabel":"string"},"content":{"type":"string","description":"Current conversation content. Hits function is null, otherwise returns model inference result.","uniqueKey":"choices.items.[INDEX].message.content","typeLabel":"string"},"tool_calls":{"type":"array","description":"Function names and parameters generated by the model that should be called.","items":{"type":"object","properties":{"function":{"type":"object","description":"Contains the function name and JSON format parameters generated by the model.","properties":{"name":{"type":"string","description":"Model-generated function name.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX].function.name","typeLabel":"string"},"arguments":{"type":"object","description":"JSON format of the function call parameters generated by the model. Validate the parameters before calling the function.","isRequired":true,"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX].function.arguments","typeLabel":"object"}},"required":["name","arguments"],"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX].function","typeLabel":"object"},"id":{"type":"string","description":"Unique identifier for the hit function.","uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX].id","typeLabel":"string"},"type":{"type":"string","description":"Tool type called by the model, currently only supports ‘function’.","uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX].type","typeLabel":"string"}},"uniqueKey":"choices.items.[INDEX].message.tool_calls.items.[INDEX]","typeLabel":"object"},"uniqueKey":"choices.items.[INDEX].message.tool_calls","typeLabel":"object[]"}},"uniqueKey":"choices.items.[INDEX].message","typeLabel":"object"},"finish_reason":{"type":"string","description":"Reason for model inference termination. Can be `stop`, `tool_calls`, `length`, `sensitive`, `model_context_window_exceeded` or `network_error`.","uniqueKey":"choices.items.[INDEX].finish_reason","typeLabel":"string"}},"uniqueKey":"choices.items.[INDEX]","typeLabel":"object"},"uniqueKey":"choices","typeLabel":"object[]"},"usage":{"type":"object","description":"Token usage statistics returned when the model call ends.","properties":{"prompt_tokens":{"type":"number","description":"Number of tokens in user input","uniqueKey":"usage.prompt_tokens","typeLabel":"number"},"completion_tokens":{"type":"number","description":"Number of output tokens","uniqueKey":"usage.completion_tokens","typeLabel":"number"},"prompt_tokens_details":{"type":"object","properties":{"cached_tokens":{"type":"number","description":"Number of tokens served from cache","uniqueKey":"usage.prompt_tokens_details.cached_tokens","typeLabel":"number"}},"uniqueKey":"usage.prompt_tokens_details","typeLabel":"object"},"total_tokens":{"type":"integer","description":"Total number of tokens","uniqueKey":"usage.total_tokens","typeLabel":"integer"}},"uniqueKey":"usage","typeLabel":"object"},"web_search":{"description":"Search results.","type":"array","items":{"type":"object","properties":{"title":{"type":"string","description":"Title.","uniqueKey":"web_search.items.[INDEX].title","typeLabel":"string"},"content":{"type":"string","description":"Content summary.","uniqueKey":"web_search.items.[INDEX].content","typeLabel":"string"},"link":{"type":"string","description":"Result URL.","uniqueKey":"web_search.items.[INDEX].link","typeLabel":"string"},"media":{"type":"string","description":"Website name.","uniqueKey":"web_search.items.[INDEX].media","typeLabel":"string"},"icon":{"type":"string","description":"Website icon.","uniqueKey":"web_search.items.[INDEX].icon","typeLabel":"string"},"refer":{"type":"string","description":"Index number.","uniqueKey":"web_search.items.[INDEX].refer","typeLabel":"string"},"publish_date":{"type":"string","description":"Website publication date.","uniqueKey":"web_search.items.[INDEX].publish_date","typeLabel":"string"}},"uniqueKey":"web_search.items.[INDEX]","typeLabel":"object"},"uniqueKey":"web_search","typeLabel":"object[]"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"id":"\u003cstring>","request_id":"\u003cstring>","created":123,"model":"\u003cstring>","choices":[{"index":123,"message":{"role":"assistant","content":"\u003cstring>","tool_calls":[{"function":{"name":"\u003cstring>","arguments":{}},"id":"\u003cstring>","type":"\u003cstring>"}]},"finish_reason":"\u003cstring>"}],"usage":{"prompt_tokens":123,"completion_tokens":123,"prompt_tokens_details":{"cached_tokens":123},"total_tokens":123},"web_search":[{"title":"\u003cstring>","content":"\u003cstring>","link":"\u003cstring>","media":"\u003cstring>","icon":"\u003cstring>","refer":"\u003cstring>","publish_date":"\u003cstring>"}]}}},"exampleType":"generated"}},"exampleType":"generated"},"2770d7b2-4a2b-4dcd-a65f-4576730edd8d":{"description":"The request has failed.","content":{"application/json":{"schema":{"required":["code","message"],"type":"object","description":"The request has failed.","properties":{"code":{"type":"integer","format":"int32","description":"Error code.","isRequired":true,"uniqueKey":"code","typeLabel":"integer\u003cint32>"},"message":{"type":"string","description":"Error message.","isRequired":true,"uniqueKey":"message","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"code":123,"message":"\u003cstring>"}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"3d8be473-071c-4e09-8522-b9c2a59933dc":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Use the following format for authentication: Bearer [\u003cyour api key>](https://z.ai/manage-apikey/apikey-list)","scopes":[],"schemeName":"bearerAuth"}}},"servers":{"6d656395-5221-49af-96d5-e56c4cf5568b":{"url":"https://api.z.ai/api","description":"Production server"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","description":"Use the following format for authentication: Bearer [\u003cyour api key>](https://z.ai/manage-apikey/apikey-list)","scopes":[],"schemeName":"bearerAuth"},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"Use the following format for authentication: Bearer [\u003cyour api key>](https://z.ai/manage-apikey/apikey-list)","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"bearerAuth","name":"Authorization"}],"title":"bearerAuth"}]},"originalFileLocation":"openapi.json"},"subdomain":"zhipu-32152247","siteName":"Overview - Z.AI DEVELOPER DOCUMENT","title":"Chat Completion - Overview - Z.AI DEVELOPER DOCUMENT","navMaps":{"firstHrefInVersion":{"English":{"href":"/api-reference/llm/chat-completion","matchLevel":0}},"firstHrefInLanguage":{}},"lastModified":"2026-01-28T15:46:24.860Z","originalFileLocation":"api-reference/llm/chat-completion.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Create a chat completion model that generates AI replies for given conversation messages. It supports multimodal inputs (text, images, audio, video, file), offers configurable parameters (like temperature, max tokens, tool use), and supports both streaming and non-streaming output modes.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Overview - Z.AI DEVELOPER DOCUMENT\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/zhipu-32152247/ksfquWFAc8TQf_Hb/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/zhipu-32152247/ksfquWFAc8TQf_Hb/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/zhipu-32152247/ksfquWFAc8TQf_Hb/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/zhipu-32152247/ksfquWFAc8TQf_Hb/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/zhipu-32152247/ksfquWFAc8TQf_Hb/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/zhipu-32152247/ksfquWFAc8TQf_Hb/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/zhipu-32152247/ksfquWFAc8TQf_Hb/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/zhipu-32152247/ksfquWFAc8TQf_Hb/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/zhipu-32152247/ksfquWFAc8TQf_Hb/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Chat Completion - Overview - Z.AI DEVELOPER DOCUMENT\">\u003cmeta data-mint-head property=\"og:description\" content=\"Create a chat completion model that generates AI replies for given conversation messages. It supports multimodal inputs (text, images, audio, video, file), offers configurable parameters (like temperature, max tokens, tool use), and supports both streaming and non-streaming output modes.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Overview - Z.AI DEVELOPER DOCUMENT\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.z.ai/api-reference/llm/chat-completion\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://zhipu-32152247.mintlify.app/_mintlify/api/og/v2?division=Model+API\u0026amp;title=Chat+Completion\u0026amp;description=Create+a+chat+completion+model+that+generates+AI+replies+for+given+conversation+messages.+It+supports+multimodal+inputs+%28text%2C+images%2C+audio%2C+video%2C+file%29%2C+offe\u0026amp;theme=28cd11ffa578495b9d6a62e8\u0026amp;signature=b8defb906e43ddac6e4a4458dab362ac1e0a19a403f693cc7d378ec8c81eb1e7\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Chat Completion - Overview - Z.AI DEVELOPER DOCUMENT\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Create a chat completion model that generates AI replies for given conversation messages. It supports multimodal inputs (text, images, audio, video, file), offers configurable parameters (like temperature, max tokens, tool use), and supports both streaming and non-streaming output modes.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://zhipu-32152247.mintlify.app/_mintlify/api/og/v2?division=Model+API\u0026amp;title=Chat+Completion\u0026amp;description=Create+a+chat+completion+model+that+generates+AI+replies+for+given+conversation+messages.+It+supports+multimodal+inputs+%28text%2C+images%2C+audio%2C+video%2C+file%29%2C+offe\u0026amp;theme=28cd11ffa578495b9d6a62e8\u0026amp;signature=b8defb906e43ddac6e4a4458dab362ac1e0a19a403f693cc7d378ec8c81eb1e7\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/zhipu-32152247/ksfquWFAc8TQf_Hb/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Overview - Z.AI DEVELOPER DOCUMENT\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#141618\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.z.ai/api-reference/llm/chat-completion\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/llm/chat-completion.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.z.ai/#organization\",\"name\":\"Overview - Z.AI DEVELOPER DOCUMENT\",\"url\":\"https://docs.z.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/zhipu-32152247/B_E8wI-eiNa1QlPV/logo/dark.svg?fit=max\u0026auto=format\u0026n=B_E8wI-eiNa1QlPV\u0026q=85\u0026s=75deefa9dea5bdbc84d4da68885c267f\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.z.ai#website\",\"name\":\"Overview - Z.AI DEVELOPER DOCUMENT\",\"url\":\"https://docs.z.ai\",\"publisher\":{\"@id\":\"https://docs.z.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.z.ai/api-reference/llm/chat-completion#webpage\",\"url\":\"https://docs.z.ai/api-reference/llm/chat-completion\",\"name\":\"Chat Completion\",\"description\":\"Create a chat completion model that generates AI replies for given conversation messages. It supports multimodal inputs (text, images, audio, video, file), offers configurable parameters (like temperature, max tokens, tool use), and supports both streaming and non-streaming output modes.\",\"dateModified\":\"2026-01-28T15:46:24.860Z\",\"isPartOf\":{\"@id\":\"https://docs.z.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.z.ai/api-reference/llm/chat-completion#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.z.ai/api-reference/llm/chat-completion#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Overview - Z.AI DEVELOPER DOCUMENT\",\"item\":\"https://docs.z.ai\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Chat Completion\",\"item\":\"https://docs.z.ai/api-reference/llm/chat-completion\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.z.ai/api-reference/llm/chat-completion#apireference\",\"headline\":\"Chat Completion\",\"name\":\"Chat Completion\",\"description\":\"Create a chat completion model that generates AI replies for given conversation messages. It supports multimodal inputs (text, images, audio, video, file), offers configurable parameters (like temperature, max tokens, tool use), and supports both streaming and non-streaming output modes.\",\"url\":\"https://docs.z.ai/api-reference/llm/chat-completion\",\"mainEntityOfPage\":{\"@id\":\"https://docs.z.ai/api-reference/llm/chat-completion#webpage\"},\"dateModified\":\"2026-01-28T15:46:24.860Z\",\"publisher\":{\"@id\":\"https://docs.z.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.z.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Overview - Z.AI DEVELOPER DOCUMENT\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Overview - Z.AI DEVELOPER DOCUMENT","nav":{"global":null,"versions":[{"version":"English","tabs":[{"tab":"Guides","pages":[{"title":"Guides","href":"/guides/overview/quick-start"}]},{"tab":"API Reference","groups":[{"group":"Using the APIs","pages":[{"title":"Introduction","href":"/api-reference/introduction"},{"title":"Errors","href":"/api-reference/api-code"},{"title":"Rate Limits","url":"https://z.ai/manage-apikey/rate-limits","description":null,"href":"/api-reference/rate-limit"}]},{"group":"Model API","pages":[{"title":"Chat Completion","openapi":"POST /paas/v4/chat/completions","href":"/api-reference/llm/chat-completion"}]},{"group":"Image API","pages":[{"title":"Generate Image","openapi":"POST /paas/v4/images/generations","description":"Use [GLM-Image](/guides/image/glm-image) series models to generate high-quality images from text prompts. Through quick and accurate understanding of user text descriptions, `AI` image expression becomes more precise and personalized.","href":"/api-reference/image/generate-image"},{"title":"Generate Image(Async)","openapi":"POST /paas/v4/async/images/generations","href":"/api-reference/image/generate-image-async"},{"title":"Retrieve Result","openapi":"GET /paas/v4/async-result/{id}","href":"/api-reference/image/get-image-status"}]},{"group":"Video API","pages":[{"title":"Generate Video(Async)","openapi":"POST /paas/v4/videos/generations","href":"/api-reference/video/generate-video"},{"title":"Retrieve Result","openapi":"GET /paas/v4/async-result/{id}","href":"/api-reference/video/get-video-status"}]},{"group":"Audio API","pages":[{"title":"Audio Transcriptions","openapi":"POST /paas/v4/audio/transcriptions","href":"/api-reference/audio/audio-transcriptions"}]},{"group":"Tool API","pages":[{"title":"Tokenizer","openapi":"POST /paas/v4/tokenizer","href":"/api-reference/tools/tokenizer"},{"title":"Layout Parsing","openapi":"POST /paas/v4/layout_parsing","href":"/api-reference/tools/layout-parsing"},{"title":"Web Search","openapi":"POST /paas/v4/web_search","href":"/api-reference/tools/web-search"},{"title":"Web Reader","openapi":"POST /paas/v4/reader","href":"/api-reference/tools/web-reader"}]},{"group":"Agent API","pages":[{"title":"Agent Chat","openapi":"POST /v1/agents","href":"/api-reference/agents/agent"},{"title":"File Upload","openapi":"POST /paas/v4/files","href":"/api-reference/agents/file-upload"},{"title":"Retrieve Result","openapi":"POST /v1/agents/async-result","href":"/api-reference/agents/get-async-result"},{"title":"Conversation History","openapi":"POST /v1/agents/conversation","href":"/api-reference/agents/agent-conversation"}]}]},{"tab":"Coding Plan","pages":[{"title":"Coding Plan","href":"/devpack/overview"}]},{"tab":"Released Notes","pages":[{"title":"Released Notes","href":"/release-notes/new-released"}]},{"tab":"Terms and Policy","pages":[{"title":"Terms and Policy","href":"/legal-agreement/privacy-policy"}]},{"tab":"Help Center","pages":[{"title":"Help Center","href":"/help/faq"}]}]}]},"title":"Chat Completion - Overview - Z.AI DEVELOPER DOCUMENT","buildId":"dpl_G8u2B2Ji9qJYF9umedjv293TxycS","deploymentId":"dpl_G8u2B2Ji9qJYF9umedjv293TxycS","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-S3ptrr-V.js","utils-CUxEJy9u.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-DavhVrxy.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-B1sOUY6E.js","snippetPresets-C-RLYOrF.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","ApiExamples-Duz18EdI.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-DPsbCc6D.js","shallow-B1dlhlOw.js","getApiPlaygroundDisplay-DvOu-BhE.js","CodeSnippet-By8wd64X.js","CodeSnippets-BxVv6TjI.js","Page-BGh0lBck.js","getPastedJson-DOAt9xJn.js","icon-BYg-qtQ2.js","MethodPill-Dtah8ZSz.js","DuplicateIcon-guWfDmh1.js","createIcon-pTGhj_hk.js","DynamicMarkdown-DpsHMHVL.js","SectionHeading-BbutQCjq.js","axios-vUo_bRtp.js","Markdown-DZ-stgDu.js","clsx-Dfme4k4V.js","lib--scc4DXi.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-CPNs0ebX.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-3JVAA-i3.js"]}