openapi: 3.0.1
info:
title: Z.AI Agents Paas API
description: Z.AI API available endpoints
license:
name: Z.AI Developer Agreement and Policy
url: https://chat.z.ai/legal-agreement/terms-of-service
version: 1.0.0
contact:
name: Z.AI Developers
url: https://chat.z.ai/legal-agreement/privacy-policy
email: user_feedback@z.ai
servers:
- url: https://api.z.ai/api
description: Production server
security:
- bearerAuth: []
tags:
- name: Paas
paths:
/paas/v4/chat/completions:
post:
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:
- $ref: '#/components/parameters/AcceptLanguage'
requestBody:
content:
application/json:
schema:
oneOf:
- title: Text Model
$ref: '#/components/schemas/ChatCompletionTextRequest'
- title: Vision Model
$ref: '#/components/schemas/ChatCompletionVisionRequest'
examples:
Basic Example:
value:
model: glm-5.1
messages:
- role: system
content: You are a useful AI assistant.
- role: user
content: Please tell us about the development of artificial intelligence.
temperature: 1
stream: false
Stream Example:
value:
model: glm-5.1
messages:
- role: user
content: Write a poem about spring.
temperature: 1
stream: true
Thinking Example:
value:
model: glm-5.1
messages:
- role: user
content: Write a poem about spring.
thinking:
type: enabled
stream: true
Multi Conversation:
value:
model: glm-5.1
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:
value:
model: glm-5v-turbo
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:
value:
model: glm-5v-turbo
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:
value:
model: glm-5v-turbo
messages:
- role: user
content:
- type: file_url
file_url:
url: https://cdn.bigmodel.cn/static/demo/demo2.txt
- type: file_url
file_url:
url: https://cdn.bigmodel.cn/static/demo/demo1.pdf
- type: text
text: What are the files show about?
Function Call Example:
value:
model: glm-5.1
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
required: true
responses:
'200':
description: Processing successful
content:
application/json:
schema:
$ref: '#/components/schemas/ChatCompletionResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- Paas
/paas/v4/videos/generations:
post:
description: 'CogVideoX is a video generation large model developed by Z.AI, equipped with powerful video generation capabilities. Simply inputting text or images allows for effortless video creation.
Vidu: A high-performance video large model that combines high consistency and high dynamism, with precise semantic understanding and exceptional reasoning speed.'
parameters:
- $ref: '#/components/parameters/AcceptLanguage'
requestBody:
content:
application/json:
schema:
oneOf:
- title: CogVideoX-3
$ref: '#/components/schemas/CogVideoX3Request'
- title: 'Vidu: Text to Video'
$ref: '#/components/schemas/ViduText2VideoRequest'
- title: 'Vidu: Image to Video'
$ref: '#/components/schemas/ViduImage2VideoRequest'
- title: 'Vidu: First & Last Frame to Video'
$ref: '#/components/schemas/ViduFrames2VideoRequest'
- title: 'Vidu: Ref to Video'
$ref: '#/components/schemas/ViduReference2VideoRequest'
examples:
Text to Video Example:
value:
model: cogvideox-3
prompt: A cat is playing with a ball.
quality: quality
with_audio: true
size: 1920x1080
fps: 30
Image to Video Example:
value:
model: cogvideox-3
image_url: https://img.iplaysoft.com/wp-content/uploads/2019/free-images/free_stock_photo.jpg
prompt: Make the picture move
quality: quality
with_audio: true
size: 1920x1080
fps: 30
First Last Frame to Video:
value:
model: cogvideox-3
image_url:
- https://gd-hbimg.huaban.com/ccee58d77afe8f5e17a572246b1994f7e027657fe9e6-qD66In_fw1200webp
- https://gd-hbimg.huaban.com/cc2601d568a72d18d90b2cc7f1065b16b2d693f7fa3f7-hDAwNq_fw1200webp
prompt: Make the picture move
quality: quality
with_audio: true
size: 1920x1080
fps: 30
required: true
responses:
'200':
description: Processing successful.
content:
application/json:
schema:
$ref: '#/components/schemas/VideoResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- Paas
/paas/v4/async-result/{id}:
get:
description: This endpoint is used to query the result of an asynchronous request.
parameters:
- $ref: '#/components/parameters/AcceptLanguage'
- name: id
in: path
required: true
schema:
type: string
description: Task id.
responses:
'200':
description: Processing successful
content:
application/json:
schema:
oneOf:
- title: Video Generation
$ref: '#/components/schemas/AsyncVideoGenerationResponse'
- title: Image Generation
$ref: '#/components/schemas/AsyncImageGenerationResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- Paas
/paas/v4/images/generations:
post:
summary: Generate Image
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.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateImageRequest'
examples:
Generate Image Example:
value:
model: glm-image
prompt: A cute little kitten sitting on a sunny windowsill, with the background of blue sky and white clouds.
size: 1280x1280
required: true
responses:
'200':
description: Processing successful
content:
application/json:
schema:
$ref: '#/components/schemas/ImageGenerationResponse'
default:
description: Request Failed
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- Paas
/paas/v4/async/images/generations:
post:
summary: Generate Image (Async)
description: Use the [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. Only supports `GLM-Image` model.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AsyncCreateImageRequest'
examples:
Image Generation Example:
value:
model: glm-image
prompt: A cute little kitten sitting on a sunny windowsill, with the background of blue sky and white clouds.
size: 1280x1280
required: true
responses:
'200':
description: Processing successful
content:
application/json:
schema:
$ref: '#/components/schemas/AsyncResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- Paas
/paas/v4/audio/transcriptions:
post:
summary: Speech to Text
description: Use the [GLM-ASR-2512](/guides/audio/glm-asr-2512) model to transcribe audio files into text, supporting multiple languages and real-time streaming transcription.
requestBody:
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/AudioTranscriptionRequest'
example:
model: glm-asr-2512
stream: false
required: true
responses:
'200':
description: Request processed successfully
content:
application/json:
schema:
$ref: '#/components/schemas/AudioTranscriptionResponse'
text/event-stream:
schema:
$ref: '#/components/schemas/AudioTranscriptionStreamResponse'
default:
description: Request failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- Paas
/paas/v4/tokenizer:
post:
summary: Text Tokenizer
description: '`Tokenizer` is used to split text into `tokens` recognizable by the model and calculate the count. It receives user input text, processes it through the model for tokenization, and finally returns the corresponding `token` count. It is suitable for text length evaluation, model input estimation, dialogue context truncation, cost calculation, etc.'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/TokenizerRequest'
examples:
Text Tokenization Example:
value:
model: glm-4.6
messages:
- role: user
content: What opportunities and challenges will the Chinese large model industry face in 2025?
required: true
responses:
'200':
description: Business processing successful
content:
application/json:
schema:
$ref: '#/components/schemas/TokenizerResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- Paas
/paas/v4/layout_parsing:
post:
summary: Layout Parsing
description: Use the [GLM-OCR](/guides/vlm/glm-ocr) model to parse the layout of documents and images and extract text content. Support OCR recognition of images and PDF documents, returning detailed layout information and visualization results.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/LayoutParsingRequest'
examples:
Layout Parsing Example:
value:
model: glm-ocr
file: https://cdn.bigmodel.cn/static/logo/introduction.png
required: true
responses:
'200':
description: Business processing successful
content:
application/json:
schema:
$ref: '#/components/schemas/LayoutParsingResponse'
default:
description: Request failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- Paas
/paas/v4/web_search:
post:
description: The [Web Search](/guides/tools/web-search) is a specialized search engine for large language models. Building upon traditional search engine capabilities like web crawling and ranking, it enhances intent recognition to return results better suited for LLM processing (including webpage titles, URLs, summaries, site names, favicons etc.).
parameters:
- $ref: '#/components/parameters/AcceptLanguage'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/WebSearchRequest'
required: true
responses:
'200':
description: Processing successful
content:
application/json:
schema:
$ref: '#/components/schemas/WebSearchResponse'
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- Paas
/paas/v4/files:
post:
description: This API is designed for uploading auxiliary files (such as glossaries, terminology lists) to support the translation service. It allows users to upload reference materials that can enhance translation accuracy and consistency.
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
purpose:
type: string
description: Upload purpose (agent)
default: agent
enum:
- agent
file:
type: string
format: binary
description: 'File to upload. Limit to `100MB`. Allowed formats: `pdf`, `doc`, `xlsx`, `ppt`, `txt`, `jpg`, `png`.'
required:
- purpose
- file
required: true
responses:
'200':
description: Processing successful
content:
application/json:
schema:
type: object
properties:
id:
type: string
description: Unique identifier of the uploaded file.
object:
type: string
description: Object type.
bytes:
type: integer
description: File size in bytes.
filename:
type: string
description: Name of the uploaded file.
purpose:
type: string
description: Purpose of the uploaded file.
created_at:
type: integer
description: Timestamp of file creation.
default:
description: The request has failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tags:
- Paas
components:
schemas:
ViduText2VideoRequest:
allOf:
- type: object
properties:
model:
type: string
description: The model code to be called.
enum:
- viduq1-text
prompt:
type: string
description: Text description of the video, maximum input length of 512 characters.
style:
type: string
description: 'Style
Default: `general`
Optional values: `general` , `anime`
- `general`: General style, can be controlled using prompts to define the style.
- `anime`: Anime style, optimized for anime-specific visuals. The style can be controlled using different anime-themed prompts.'
enum:
- general
- anime
duration:
type: integer
description: 'Video duration parameter.
Default: `5` , Optional: `5`.'
example: 5
enum:
- 5
aspect_ratio:
type: string
description: 'Aspect ratio
Default: `16:9`, Optional values: `16:9`, `9:16`, `1:1`'
example: '16:9'
enum:
- '16:9'
- '9:16'
- '1:1'
size:
type: string
description: 'Resolution parameter
Default: `1920x1080`, Optional: `1920x1080`'
example: 1920x1080
enum:
- 1920x1080
movement_amplitude:
type: string
description: 'Motion amplitude
Default: `auto` , Optional values: `auto` ,`small` ,`medium` ,`large`'
example: auto
enum:
- auto
- small
- medium
- large
required:
- model
- prompt
- $ref: '#/components/schemas/VideoCommonRequest'
WebSearchToolSchema:
type: object
title: Web Search
properties:
type:
type: string
default: web_search
enum:
- web_search
web_search:
$ref: '#/components/schemas/WebSearchObject'
required:
- type
- web_search
additionalProperties: false
AudioTranscriptionResponse:
type: object
properties:
id:
type: string
description: Task ID
created:
type: integer
format: int64
description: Request creation time, as a `Unix` timestamp in seconds.
request_id:
type: string
description: Passed by the client, must be unique. A unique identifier to distinguish each request. If not provided by the client, the platform will generate one by default.
model:
type: string
description: Model name
text:
type: string
description: The complete transcribed content of the audio.
RetrievalToolSchema:
type: object
title: Retrieval
properties:
type:
type: string
default: retrieval
enum:
- retrieval
retrieval:
$ref: '#/components/schemas/RetrievalObject'
required:
- type
- retrieval
additionalProperties: false
Error:
required:
- code
- message
type: object
description: The request has failed.
properties:
code:
type: integer
format: int32
description: Error code.
message:
type: string
description: Error message.
AsyncVideoGenerationResponse:
type: object
properties:
model:
type: string
description: Model name.
task_status:
type: string
description: 'Processing status, `PROCESSING` (processing), `SUCCESS` (success), `FAIL` (failure). Note: Processing status needs to be obtained via query.'
video_result:
type: array
description: Video generation results.
items:
type: object
properties:
url:
type: string
description: Video URL.
cover_image_url:
type: string
description: Video cover URL.
request_id:
type: string
description: Task number submitted by the user during the client request or generated by the platform.
RetrievalObject:
type: object
properties:
knowledge_id:
type: string
description: Knowledge base ID, created or obtained from the platform
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.'
required:
- knowledge_id
LayoutDetail:
type: object
description: Layout detail element
properties:
index:
type: integer
description: Element index
example: 1
label:
type: string
description: 'Element type: image for images, text for text content, formula for inline formulas, table for tables'
enum:
- image
- text
- formula
- table
example: text
bbox_2d:
type: array
description: Normalized element coordinates [x1,y1,x2,y2]
items:
type: number
minimum: 0
maximum: 1
minItems: 4
maxItems: 4
example:
- 0.1
- 0.1
- 0.5
- 0.3
content:
type: string
description: Element content (text / image URL / table HTML)
example: This is the content of the element
height:
type: integer
description: Page height
example: 800
width:
type: integer
description: Page width
example: 600
required:
- index
- label
DataInfo:
type: object
description: Document basic information
properties:
num_pages:
type: integer
description: Total number of document pages
example: 5
pages:
type: array
description: Document page count information
items:
$ref: '#/components/schemas/PageInfo'
required:
- num_pages
TokenizerRequest:
type: object
required:
- model
- messages
properties:
model:
type: string
description: The model code to be called.
example: glm-4.6
default: glm-4.6
enum:
- glm-4.6
- glm-4.6v
- glm-4.5
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:
- title: User Message
type: object
properties:
role:
type: string
enum:
- user
description: Role of the message author
default: user
content:
oneOf:
- type: array
description: Multimodal message content, supports text, images, video, file
items:
$ref: '#/components/schemas/VisionMultimodalContentItem'
- 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?
required:
- role
- content
- title: System Message
type: object
properties:
role:
type: string
enum:
- system
description: Role of the message author
default: system
content:
oneOf:
- type: string
description: Message text content
example: You are a helpful assistant.
required:
- role
- content
- title: Assistant Message
type: object
description: Can include tool calls
properties:
role:
type: string
enum:
- assistant
description: Role of the message author
default: assistant
content:
oneOf:
- type: string
description: Text message content
example: I'll help you with that analysis.
required:
- role
minItems: 1
tools:
type: array
description: List of tools the model can call. Supports up to `128` functions.
anyOf:
- items:
$ref: '#/components/schemas/FunctionToolSchema'
request_id:
type: string
description: Passed by the client, must be unique. If empty, it will be generated by default.
user_id:
type: string
description: Unique `ID` of the end user
ImageGenerationResponse:
type: object
properties:
created:
type: integer
example: 1760335349
description: Request creation time, in `Unix` timestamp format, unit is seconds.
data:
type: array
description: Array, containing the generated image `URL`. Currently, the array only contains one image.
items:
type: object
properties:
url:
type: string
description: Image link. The temporary link expires after `30` days, please store it promptly.
required:
- url
content_filter:
type: array
description: Array, containing content safety related information.
items:
type: object
properties:
role:
type: string
description: Safety enforcement stage, including `role = assistant` model inference, `role = user` user input, `role = history` historical context.
enum:
- assistant
- user
- history
level:
type: integer
description: Severity level `level 0-3`, `level 0` is most severe, `3` is least severe.
minimum: 0
maximum: 3
CogVideoX3Request:
allOf:
- type: object
properties:
model:
type: string
description: The model code to be called.
enum:
- cogvideox-3
prompt:
type: string
description: Text description of the video, maximum input length of 512 characters. Either image_url or prompt must be provided, or both.
quality:
type: string
description: "Output mode, default is `speed`.\n- `quality`: Prioritizes quality, higher generation quality. \n- `speed`: Prioritizes speed, faster generation time, relatively lower quality."
example: speed
enum:
- speed
- quality
with_audio:
type: boolean
description: 'Whether to generate AI sound effects. Default: `false` (no sound effects).'
example: false
image_url:
type: array
description: 'Provide an image based on which content will be generated. If this parameter is passed, the system will operate based on this image. Supports passing images via URL or Base64 encoding. Image requirements: images support `.png`, `.jpeg`, `.jpg` formats; image size: no more than `5M`. Either image_url and prompt can be used, or both can be passed simultaneously.
First and last frames: supports inputting two images. The first uploaded image is regarded as the first frame, and the second image is regarded as the last frame. The model will generate the video based on the images passed in this parameter.
First and last frame mode only supports `speed` mode'
items:
oneOf:
- title: Image URL
type: string
format: uri
example: https://example.com/image.png
- title: Base64 Encoded Image
type: string
format: byte
example: data:image/png;base64, XXX
size:
type: string
description: 'Default value: if not specified, the short side of the generated video is 1080 by default, and the long side is determined according to the original image ratio. Maximum support for 4K resolution. Resolution options: "1280x720", "720x1280", "1024x1024", "1080x1920", "2048x1080", "3840x2160"'
example: 1920x1080
enum:
- 1280x720
- 720x1280
- 1024x1024
- 1920x1080
- 1080x1920
- 2048x1080
- 3840x2160
fps:
type: integer
description: 'Video frame rate (FPS), optional values are `30` or `60`. Default: `30`.'
example: 30
enum:
- 30
- 60
duration:
type: integer
description: Video duration, default is 5 seconds, supports `5` and `10` seconds.
example: 5
enum:
- 5
- 10
required:
- model
- $ref: '#/components/schemas/VideoCommonRequest'
ViduReference2VideoRequest:
allOf:
- type: object
properties:
model:
type: string
description: The model code to be called.
enum:
- vidu2-reference
prompt:
type: string
description: Text description of the video, maximum input length of 512 characters. Either image_url or prompt must be provided, or both.
image_url:
type: array
description: 'Image reference
Supports input of 1 to 3 images. The model will use the themes from the images provided in this parameter as references to generate a video with consistent subjects.
1. Supports image URLs or images encoded in Base64 (ensure accessibility; it is recommended to prioritize using image URLs).
2. Supported formats: `png`, `jpeg`, `.jpg`, `webp`.
3. Image resolution must not be smaller than `128x128`, and the aspect ratio must be less than `1:4` or `4:1`.
4. Image file size must not exceed `50 MB`.
5. Note: After Base64 decoding, the byte length must be less than 50 MB, and the encoding must include the proper content-type string, such as `data:image/png;base64,{base64_encode}`.'
items:
type: string
minLength: 1
minItems: 1
maxItems: 3
duration:
title: vidu2-reference
type: integer
description: 'Video duration parameter.
Default: `4` , Optional: `4`.'
example: 4
enum:
- 4
aspect_ratio:
type: string
description: 'Aspect ratio
Default: `16:9`, Optional values: `16:9`, `9:16`, `1:1`'
example: '16:9'
enum:
- '16:9'
- '9:16'
- '1:1'
size:
title: 'vidu2-reference '
type: string
description: 'Resolution parameter
Default: `1280x720`, Optional: `1280x720`'
example: 1280x720
enum:
- 1280x720
movement_amplitude:
type: string
description: 'Motion amplitude
Default: `auto` , Optional values: `auto` ,`small` ,`medium` ,`large`'
example: auto
enum:
- auto
- small
- medium
- large
with_audio:
type: boolean
description: Add background music to the generated video.
required:
- model
- $ref: '#/components/schemas/VideoCommonRequest'
WebSearchRequest:
type: object
properties:
search_engine:
type: string
description: "The search engine code to call.\n search-prime: Z.AI Premium Version Search Engine"
example: search-prime
default: search-prime
enum:
- search-prime
search_query:
type: string
description: The content to be searched.
count:
type: integer
description: "The number of results to return\nFillable range: `1-50`, maximum `50` results per single search\nDefault is `10`\nSupported search engines: \n`search_pro_jina`."
minimum: 1
maximum: 50
search_domain_filter:
type: string
description: "Used to limit the scope of search results and only return content from specified whitelist domains.\nWhitelist: Directly enter the domain name (e.g., `www.example.com`)\nSupported search engines: \n`search_pro_jina`"
search_recency_filter:
type: string
description: "Search for webpages within a specified time range.\nDefault is `noLimit`\nFillable values:\n`oneDay`: within one day\n`oneWeek`: within one week\n`oneMonth`: within one month\n`oneYear`: within one year\n`noLimit`: no limit (default)\nSupported search engines: \n`search_pro_jina`"
enum:
- oneDay
- oneWeek
- oneMonth
- oneYear
- noLimit
request_id:
type: string
description: User-provided unique identifier for distinguishing requests. If not provided, the platform will generate one.
user_id:
type: string
description: 'Unique ID of the end user, helping the platform intervene in illegal activities, inappropriate content generation, or other abuses. ID length: 6 to 128 characters.'
required:
- search_engine
- search_query
VideoResponse:
type: object
properties:
model:
description: Model name used in this call.
type: string
id:
description: Task order number generated by the Z.AI, use this order number when calling the request result interface.
type: string
request_id:
description: Task number submitted by the user during the client request or generated by the platform.
type: string
task_status:
description: Processing status, `PROCESSING (processing)`,` SUCCESS (success)`, `FAIL (failure)`. Results need to be obtained via query.
type: string
AsyncCreateImageRequest:
type: object
required:
- model
- prompt
properties:
model:
type: string
description: Model code
enum:
- glm-image
example: glm-image
prompt:
type: string
description: The text description of the image to be generated.
example: A cute little kitten.
quality:
type: string
description: 'The quality of the generated image. `hd`: Generates a more detailed and rich image with higher overall consistency, takes about `20` seconds.'
enum:
- hd
default: hd
size:
type: string
description: 'Image size, recommended enum values: `1280x1280` (default), `1568x1056`, `1056x1568`, `1472x1088`, `1088x1472`, `1728x960`, `960x1728`.
Custom parameter: Both width and height must be between `1024px-2048px`, and must be divisible by `32`, and the maximum pixel count must not exceed `2^22px`.'
default: 1280x1280
example: 1280x1280
user_id:
type: string
description: 'Unique ID of the end user, helping the platform intervene in illegal activities, inappropriate content generation, or other abuses. ID length: 6 to 128 characters.'
minLength: 6
maxLength: 128
LayoutParsingRequest:
type: object
required:
- model
- file
properties:
model:
type: string
description: 'Model code: `glm-ocr`'
example: glm-ocr
enum:
- glm-ocr
file:
type: string
description: 'Image or PDF document to be recognized, supports URL and base64. Supported image formats: PDF, JPG, PNG. Single image ≤10MB, PDF ≤50MB, maximum support 100 pages'
example: https://cdn.bigmodel.cn/static/logo/introduction.png
return_crop_images:
type: boolean
description: Whether to return screenshot information
default: false
need_layout_visualization:
type: boolean
description: Whether to return detailed layout image result information
default: false
start_page_id:
type: integer
description: Start page number for parsing when PDF is provided
minimum: 1
end_page_id:
type: integer
description: End page number for parsing when PDF is provided
minimum: 1
request_id:
type: string
description: Unique request identifier, automatically generated if not provided
example: req_123456789
user_id:
type: string
description: 'End user ID for abuse monitoring. Length: 6-128 characters'
minLength: 6
maxLength: 128
example: user_123456
VisionMultimodalContentItem:
oneOf:
- title: Text
type: object
properties:
type:
type: string
enum:
- text
description: Content type is text
default: text
text:
type: string
description: Text content
required:
- type
- text
additionalProperties: false
- title: Image
type: object
properties:
type:
type: string
enum:
- image_url
description: Content type is image URL
default: image_url
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 GLM4.6V series are limited to 150 sheets, GLM4.5V limit 50 sheets. Supports jpg, png, jpeg formats.
required:
- url
additionalProperties: false
required:
- type
- image_url
additionalProperties: false
- title: Video
type: object
properties:
type:
type: string
enum:
- video_url
description: Content type is video URL
default: video_url
video_url:
type: object
description: Video information.
properties:
url:
type: string
description: Video URL address.The video size is limited to within 200 MB, GLM-5V GLM4.6V series are limited to 2 videos, GLM4.5V limit 1 video, and the format supports `mp4`,`mkv`,`mov`.
required:
- url
additionalProperties: false
required:
- type
- video_url
additionalProperties: false
- title: File
type: object
properties:
type:
type: string
enum:
- file_url
description: Content type is file URL, not support passing both the `file_url` and `image_url` or `video_url` parameters at the same time.
default: file_url
file_url:
type: object
description: File information.
properties:
url:
type: string
description: File URL address. Only GLM-5V-Turbo, GLM-4.6V, GLM-4.5V supported. Supports formats such as pdf、txt、word、jsonl、xlsx、pptx, with a maximum of 50.
required:
- url
additionalProperties: false
required:
- type
- file_url
additionalProperties: false
ChatCompletionResponseMessage:
type: object
properties:
role:
type: string
description: Current conversation role, default is ‘assistant’ (model)
example: assistant
content:
type: string
description: "Current conversation content. Hits function is null, otherwise returns model inference result. \nFor the GLM-4.5V series models, the output may contain the reasoning process tags ` ` or the text boundary tags `<|begin_of_box|> <|end_of_box|>`."
reasoning_content:
type: string
description: Reasoning content, supports by GLM-4.5 series.
tool_calls:
type: array
description: Function names and parameters generated by the model that should be called.
items:
$ref: '#/components/schemas/ChatCompletionResponseMessageToolCall'
WebSearchObject:
type: object
properties:
enable:
type: boolean
description: 'Whether to enable search functionality.
Default is `false`. Set to true to `enable`.'
search_engine:
type: string
description: 'Type of search engine.
Default is `search_pro_jina`. Supports: `search_pro_jina`.'
enum:
- search_pro_jina
search_query:
type: string
description: Force trigger a search
count:
type: integer
description: 'Number of returned results
Range: `1-50`, max `50` results per search
Default is `10`
Supported engines: `search_pro_jina`
'
minimum: 1
maximum: 50
search_domain_filter:
type: string
description: 'Limits search results to specified whitelisted domains. Whitelist: input domains directly (e.g., www.example.com)
Supported engines: `search_pro_jina`'
search_recency_filter:
type: string
description: 'Limits search to a specific time range.
Default is `noLimit`
Values:
`oneDay`, within a day
`oneWeek`, within a week
`oneMonth`, within a month
`oneYear`, within a year
`noLimit`, no limit (default)
Supported engines: `search_pro_jina`'
enum:
- oneDay
- oneWeek
- oneMonth
- oneYear
- noLimit
content_size:
type: string
description: 'Number of characters for webpage summaries.
Default is `medium`
`medium`: Balanced mode for most queries. 400-600 characters
`high`: Maximizes context for comprehensive answers, 2500 characters.'
enum:
- medium
- high
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
search_result:
type: boolean
description: 'Whether to return search results in the response.
Default is `false`'
require_search:
type: boolean
description: 'Whether to force model response based on search result.
Default is `false`'
search_prompt:
type: string
description: 'Prompt to customize how search results are processed.
Default Prompt:
`You are an intelligent Q&A 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.`'
required:
- search_engine
AudioTranscriptionRequest:
type: object
required:
- file
- model
properties:
file:
type: string
format: binary
description: 'The audio file to be transcribed. Supported audio file formats: `.wav / .mp3`. Specifications: file size ≤ `25 MB`, audio duration ≤ `30 seconds`.'
file_base64:
type: string
description: Base64 encoded audio file. Only one of file_base64 or file needs to be provided (if both are provided, file takes precedence).
model:
type: string
description: The model ID to invoke.
enum:
- glm-asr-2512
default: glm-asr-2512
prompt:
type: string
description: In long text scenarios, you can provide previous transcription results as context. Recommended to be less than 8000 characters.
hotwords:
type: array
description: 'Hotword list to improve recognition accuracy for domain-specific vocabulary. Format example: ["person_name","place_name"]. Recommended not to exceed 100 items.'
items:
type: string
maxItems: 100
stream:
type: boolean
default: false
description: 'This parameter should be set to `false` or omitted when using synchronous calls. It indicates that the model returns all content at once after generating all content. Default is `false`. If set to `true`, the model will return generated content in chunks via standard `Event Stream`. When the `Event Stream` ends, a `data: [DONE]` message will be returned.'
request_id:
type: string
description: Passed by the client, must be unique. A unique identifier to distinguish each request. If not provided by the client, the platform will generate one by default.
user_id:
type: string
description: 'A unique `ID` for the end user, helping the platform intervene in illegal activities, generation of illegal or inappropriate content, or other abusive behaviors by end users. `ID` length requirement: at least `6` characters, at most `128` characters.'
LayoutParsingResponse:
type: object
properties:
id:
type: string
description: Task ID
example: task_123456789
created:
type: integer
format: int64
description: Request creation time, Unix timestamp in seconds
example: 1727156815
model:
type: string
description: Model name
example: GLM-OCR
md_results:
type: string
description: Recognition result in Markdown format
example: '# Doc title
This is the document content...'
layout_details:
type: array
description: Detailed layout information
items:
type: array
items:
$ref: '#/components/schemas/LayoutDetail'
layout_visualization:
type: array
description: Recognition result image URLs
items:
type: string
data_info:
$ref: '#/components/schemas/DataInfo'
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
completion_tokens:
type: number
description: Number of output tokens
prompt_tokens_details:
type: object
properties:
cached_tokens:
type: number
description: Number of tokens served from cache
total_tokens:
type: integer
description: Total number of tokens
request_id:
type: string
description: Request ID
example: req_123456789
required:
- id
- created
- model
ViduImage2VideoRequest:
allOf:
- type: object
properties:
model:
type: string
description: The model code to be called.
enum:
- viduq1-image
- vidu2-image
prompt:
type: string
description: Text description of the video, maximum input length of 512 characters. Either image_url or prompt must be provided, or both.
image_url:
type: string
description: 'The model will use the image provided in this parameter as the first frame to generate the video.
Only `1` image is supported.
Supported formats: `png` , `jpeg` , `jpg` , `webp` .
Image aspect ratio must be less than `1:4` or `4:1`.
Image file size must not exceed `50MB`.
Note: After Base64 decoding, the byte length must be less than 50 MB, and the encoding must include the appropriate content type string (e.g., `data:image/png;base64,{base64_encode}`).'
oneOf:
- title: Image URL
type: string
format: uri
example: https://example.com/image.png
- title: Base64 Encoded Image
type: string
format: byte
example: data:image/png;base64, XXX
duration:
oneOf:
- title: viduq1-image
type: integer
description: 'Video duration parameter.
Default: `5` , Optional: `5`.'
example: 5
enum:
- 5
- title: viduq2-image
type: integer
description: 'Video duration parameter.
Default: `4` , Optional: `4`.'
example: 4
enum:
- 4
size:
oneOf:
- title: viduq1-image
type: string
description: 'Resolution parameter
Default: `1920x1080`, Optional: `1920x1080`'
example: 1920x1080
enum:
- 1920x1080
- title: viduq2-image
type: string
description: 'Resolution parameter
Default: `1280x720`, Optional: `1280x720`'
example: 1280x720
default: 1280x720
enum:
- 1280x720
movement_amplitude:
type: string
description: 'Motion amplitude
Default: `auto` , Optional values: `auto` ,`small` ,`medium` ,`large`'
example: auto
enum:
- auto
- small
- medium
- large
with_audio:
type: boolean
description: Add background music to the generated video.
required:
- model
- $ref: '#/components/schemas/VideoCommonRequest'
TokenizerResponse:
type: object
properties:
created:
type: integer
format: int64
example: 1727156815
id:
type: string
example: 20241120141244890ab4ee4af84acf
description: The task sequence number generated by the Zhipu AI Open Platform. Please use this number when calling the request result interface.
request_id:
type: string
example: '1'
description: The task number submitted by the client or generated by the platform when the request was initiated.
usage:
type: object
properties:
prompt_tokens:
type: number
description: Prompt tokens in this input
image_tokens:
type: number
description: Image tokens in this input
video_tokens:
type: number
description: Video tokens in this input
total_tokens:
type: number
description: Total tokens in this input
required:
- id
- usage
FunctionParameters:
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
WebSearchResponse:
type: object
properties:
id:
description: Task ID.
type: string
created:
description: Request creation time, Unix timestamp in seconds.
type: integer
search_result:
description: Search results.
type: array
items:
$ref: '#/components/schemas/WebSearchObjectResponse'
AsyncResponse:
type: object
properties:
model:
description: Model name used in this call.
type: string
id:
description: Task order number generated by the platform, use this order number when calling the async result interface.
type: string
request_id:
description: Task number submitted by the user during the client request or generated by the platform.
type: string
task_status:
description: Processing status, `PROCESSING (processing)`, `SUCCESS (success)`, `FAIL (failure)`. Results need to be obtained via query.
type: string
AudioTranscriptionStreamResponse:
type: object
properties:
id:
type: string
description: Task ID
created:
type: integer
format: int64
description: Request creation time, as a `Unix` timestamp in seconds.
model:
type: string
description: Model name
type:
type: string
description: Audio transcription event type. `transcript.text.delta` indicates transcription in progress, `transcript.text.done` indicates transcription completed.
delta:
type: string
description: Incremental audio transcription information returned by the model.
FunctionToolSchema:
type: object
title: Function Call
properties:
type:
type: string
default: function
enum:
- function
function:
$ref: '#/components/schemas/FunctionObject'
required:
- type
- function
additionalProperties: false
CreateImageRequest:
type: object
required:
- model
- prompt
properties:
model:
type: string
description: Model code
enum:
- glm-image
- cogview-4-250304
example: glm-image
prompt:
type: string
description: The text description of the image to be generated.
example: A cute little kitten.
quality:
type: string
description: 'The quality of the generated image. `glm-image` default is `hd`, others model is `standard`. `hd`: Generates a more detailed and rich image with higher overall consistency, but takes about `20` seconds. `standard`: Generates an image quickly, suitable for scenarios with higher requirements for generation speed, takes about `5-10` seconds.'
enum:
- hd
- standard
default: hd
size:
type: string
description: "Image size. `glm-image` recommended enum values: `1280x1280` (default), `1568x1056`, `1056x1568`, `1472x1088`, `1088x1472`, `1728x960`, `960x1728`. Custom parameter: Both width and height must be between `1024px-2048px`, and must be divisible by `32`, and the maximum pixel count must not exceed `2^22px`. \nOthers model recommended enum values: `1024x1024` (default), `768x1344`, `864x1152`, `1344x768`, `1152x864`, `1440x720`, `720x1440`. Custom parameter: Both width and height must be between `512px-2048px`, and must be divisible by `16`, and the maximum pixel count must not exceed `2^21px`."
default: 1280x1280
example: 1280x1280
user_id:
type: string
description: 'Unique ID of the end user, helping the platform intervene in illegal activities, inappropriate content generation, or other abuses. ID length: 6 to 128 characters.'
minLength: 6
maxLength: 128
ChatCompletionVisionRequest:
required:
- model
- messages
type: object
properties:
model:
type: string
description: The model code to be called. GLM-5V-Turbo are the new generation of visual reasoning models. `AutoGLM-Phone-Multilingual` is mobile intelligent assistant model.
example: glm-5v-turbo
default: glm-5v-turbo
enum:
- glm-5v-turbo
- glm-4.6v
- autoglm-phone-multilingual
- glm-4.6v-flash
- glm-4.6v-flashx
- glm-4.5v
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:
- title: User Message
type: object
properties:
role:
type: string
enum:
- user
description: Role of the message author
default: user
content:
oneOf:
- type: array
description: Multimodal message content, supports text, images, video, file
items:
$ref: '#/components/schemas/VisionMultimodalContentItem'
- 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?
required:
- role
- content
- title: System Message
type: object
properties:
role:
type: string
enum:
- system
description: Role of the message author
default: system
content:
oneOf:
- type: string
description: Message text content
example: You are a helpful assistant.
required:
- role
- content
- title: Assistant Message
type: object
description: Can include tool calls
properties:
role:
type: string
enum:
- assistant
description: Role of the message author
default: assistant
content:
oneOf:
- type: string
description: Text message content
example: I'll help you with that analysis.
required:
- role
minItems: 1
request_id:
type: string
description: Passed by the user side, needs to be unique; used to distinguish each request. If not provided by the user side, the platform will generate one by default.
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`.
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.'
thinking:
$ref: '#/components/schemas/ChatThinking'
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-5V-Turbo, GLM-4.6V, GLM-4.5V series default value is `0.8`, the autoglm-phone-multilingual default value is `0.0`.'
format: float
example: 0.8
default: 0.8
minimum: 0
maximum: 1
top_p:
type: number
description: 'Another method of temperature sampling, value range is: `[0.01, 1.0]`, value range is: `[0.01, 1.0]`. The GLM-5V-Turbo, GLM-4.6V, GLM-4.5V series default value is `0.6`, the autoglm-phone-multilingual default value is `0.85`.'
format: float
example: 0.6
default: 0.6
minimum: 0.01
maximum: 1
max_tokens:
type: integer
description: The maximum number of tokens for model output, the GLM-5V-Turbo supports 128K maximum output, GLM-4.6V series supports 32K maximum output, the GLM-4.5V series supports 16K maximum output, the autoglm-phone-multilingual supports 4K maximum output.
example: 1024
minimum: 1
maximum: 131072
tools:
type: array
description: 'A list of tools the model may call. Only support by GLM-4.6V series and autoglm-phone-multilingual. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.
'
items:
anyOf:
- $ref: '#/components/schemas/FunctionToolSchema'
tool_choice:
oneOf:
- type: string
enum:
- auto
description: Used to control how the model selects which function to call. This is only applicable when the tool type is function. The default value is auto, and only auto is supported.
description: Controls how the model selects a tool.
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
maxItems: 1
user_id:
type: string
description: Unique ID for the end user, 6–128 characters. Avoid using sensitive information.
minLength: 6
maxLength: 128
ChatCompletionTextRequest:
required:
- model
- messages
type: object
properties:
model:
type: string
description: The model code to be called. GLM-5.1, GLM-5, GLM-5-Turbo are the latest flagship model series, foundational models specifically designed for agent applications.
example: glm-5.1
default: glm-5.1
enum:
- glm-5.1
- glm-5-turbo
- glm-5
- glm-4.7
- glm-4.7-flash
- glm-4.7-flashx
- glm-4.6
- glm-4.5
- glm-4.5-air
- glm-4.5-x
- glm-4.5-airx
- glm-4.5-flash
- glm-4-32b-0414-128k
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:
- title: User Message
type: object
properties:
role:
type: string
enum:
- user
description: Role of the message author
default: user
content:
oneOf:
- type: string
description: Text message content
example: What opportunities and challenges will the Chinese large model industry face in 2025?
required:
- role
- content
- title: System Message
type: object
properties:
role:
type: string
enum:
- system
description: Role of the message author
default: system
content:
oneOf:
- type: string
description: Message text content
example: You are a helpful assistant.
required:
- role
- content
- title: Assistant Message
type: object
description: Can include tool calls
properties:
role:
type: string
enum:
- assistant
description: Role of the message author
default: assistant
content:
oneOf:
- type: string
description: Text message content
example: I'll help you with that analysis.
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
type:
type: string
description: Tool type, supports web_search, retrieval, function
enum:
- function
- web_search
- retrieval
function:
type: object
description: Function call information, not empty when type is function
properties:
name:
type: string
description: Function name
arguments:
type: string
description: Function parameters, JSON format string
required:
- name
- arguments
required:
- id
- type
required:
- role
- title: Tool Message
type: object
properties:
role:
type: string
enum:
- tool
description: Role of the message author
default: tool
content:
oneOf:
- type: string
description: Message text content
example: 'Function executed successfully with result: ...'
tool_call_id:
type: string
description: Indicates the tool call ID corresponding to this message
required:
- role
- content
- tool_call_id
minItems: 1
request_id:
type: string
description: Passed by the user side, needs to be unique; used to distinguish each request. If not provided by the user side, the platform will generate one by default.
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`.
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.'
thinking:
$ref: '#/components/schemas/ChatThinking'
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.1, GLM-5, GLM-4.7, GLM-4.6 series default value is `1.0`, GLM-4.5 series default value is `0.6`, GLM-4-32B-0414-128K default value is `0.75`.'
format: float
example: 1
default: 1
minimum: 0
maximum: 1
top_p:
type: number
description: 'Another method of temperature sampling, value range is: `[0.01, 1.0]`. The GLM-5.1, GLM-5, GLM-4.7, GLM-4.6, GLM-4.5 series default value is `0.95`, GLM-4-32B-0414-128K default value is `0.9`.'
format: float
example: 0.95
default: 0.95
minimum: 0.01
maximum: 1
max_tokens:
type: integer
description: The maximum number of tokens for model output, the GLM-5.1, GLM-5, GLM-4.7, GLM-4.6 series supports 128K maximum output, the GLM-4.5 series supports 96K maximum output, the GLM-4.6v series supports 32K maximum output, the GLM-4.5v series supports 16K maximum output, GLM-4-32B-0414-128K supports 16K maximum output.
example: 1024
minimum: 1
maximum: 131072
tool_stream:
type: boolean
example: false
default: false
description: Whether to enable streaming response for Function Calls. Default value is false. Only supported by GLM-4.6 and above. Refer the [Stream Tool Call](/guides/tools/stream-tool)
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.
'
items:
anyOf:
- $ref: '#/components/schemas/FunctionToolSchema'
- $ref: '#/components/schemas/RetrievalToolSchema'
- $ref: '#/components/schemas/WebSearchToolSchema'
tool_choice:
oneOf:
- type: string
enum:
- auto
description: Used to control how the model selects which function to call. This is only applicable when the tool type is function. The default value is auto, and only auto is supported.
description: Controls how the model selects a tool.
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
maxItems: 1
response_format:
type: object
description: 'Specifies the response format of the model. Defaults to text. Supports two formats:{ "type": "text" } plain text mode, returns natural language text, { "type": "json_object" } JSON mode, returns valid JSON data. When using JSON mode, it’s recommended to clearly request JSON output in the prompt.'
properties:
type:
type: string
enum:
- text
- json_object
default: text
description: 'Output format type: text for plain text, json_object for JSON-formatted output.'
required:
- type
user_id:
type: string
description: Unique ID for the end user, 6–128 characters. Avoid using sensitive information.
minLength: 6
maxLength: 128
ViduFrames2VideoRequest:
allOf:
- type: object
properties:
model:
type: string
description: The model code to be called.
enum:
- viduq1-start-end
- vidu2-start-end
prompt:
type: string
description: Text description of the video, maximum input length of 512 characters. Either image_url or prompt must be provided, or both.
image_url:
type: array
description: 'Images
Supports input of two images: the first uploaded image will be treated as the first frame, and the second image as the last frame. The model will use the images provided in this parameter to generate a video.
The resolutions of the two input images (first and last frame) must be similar, with the ratio between the resolution of the first frame and the resolution of the last frame falling within `0.8–1.25`. Additionally, the image aspect ratio must be less than `1:4` or `4:1`.
Supports image URLs or images encoded in Base64 (ensure accessibility; using image URLs is recommended).
Supported formats: `png`, `jpeg`, `.jpg`, `webp`.
Image file size must not exceed `50 MB`.
Note: After Base64 decoding, the byte length must be less than 50 MB, and the encoding must include the appropriate content type string, such as `data:image/png;base64,{base64_encode}`.'
items:
type: string
minLength: 1
minItems: 1
maxItems: 2
duration:
oneOf:
- title: viduq1-start-end
type: integer
description: 'Video duration parameter.
Default: `5` , Optional: `5`.'
example: 5
enum:
- 5
- title: vidu2-start-end
type: integer
description: 'Video duration parameter.
Default: `4` , Optional: `4`.'
example: 4
enum:
- 4
size:
oneOf:
- title: viduq1-start-end
type: string
description: 'Resolution parameter
Default: `1920x1080`, Optional: `1920x1080`'
example: 1920x1080
enum:
- 1920x1080
- title: vidu2-start-end
type: string
description: 'Resolution parameter
Default: `1280x720`, Optional: `1280x720`'
example: 1280x720
default: 1280x720
enum:
- 1280x720
movement_amplitude:
type: string
description: 'Motion amplitude
Default: `auto` , Optional values: `auto` ,`small` ,`medium` ,`large`'
example: auto
enum:
- auto
- small
- medium
- large
with_audio:
type: boolean
description: Add background music to the generated video.
required:
- model
- $ref: '#/components/schemas/VideoCommonRequest'
AsyncImageGenerationResponse:
type: object
properties:
model:
type: string
description: Model name.
task_status:
type: string
description: 'Processing status, `PROCESSING` (processing), `SUCCESS` (success), `FAIL` (failure). Note: Processing status needs to be obtained via query.'
image_result:
type: array
description: Array containing the generated image URLs.
items:
type: object
properties:
url:
type: string
description: Image URL. The temporary link expires after `30` days, please store it promptly.
request_id:
type: string
description: Unique ID identifying this request, can be submitted by the user or generated by the platform.
FunctionObject:
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_-]+$
description:
type: string
description: A description of what the function does, used by the model to choose when and how to call the function.
parameters:
$ref: '#/components/schemas/FunctionParameters'
required:
- name
- description
- parameters
VideoCommonRequest:
type: object
properties:
request_id:
type: string
description: Provided by the client, must be unique; used to distinguish each request’s unique identifier. If not provided by the client, the platform will generate one by default.
user_id:
type: string
description: 'Unique ID of the end-user, assists the platform in intervening in end-user violations, generating illegal or inappropriate information, or other abusive behaviors. ID length requirement: minimum `6` characters, maximum `128` characters.'
ChatCompletionResponse:
type: object
properties:
id:
description: Task ID
type: string
request_id:
description: Request ID
type: string
created:
description: Request creation time, Unix timestamp in seconds
type: integer
model:
description: Model name
type: string
choices:
type: array
description: List of model responses
items:
type: object
properties:
index:
type: integer
description: Result index.
message:
$ref: '#/components/schemas/ChatCompletionResponseMessage'
finish_reason:
type: string
description: Reason for model inference termination. Can be `stop`, `tool_calls`, `length`, `sensitive`, `model_context_window_exceeded` or `network_error`.
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
completion_tokens:
type: number
description: Number of output tokens
prompt_tokens_details:
type: object
properties:
cached_tokens:
type: number
description: Number of tokens served from cache
total_tokens:
type: integer
description: Total number of tokens
web_search:
description: Search results.
type: array
items:
$ref: '#/components/schemas/WebSearchObjectResponse'
ChatCompletionResponseMessageToolCall:
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.
arguments:
type: object
description: JSON format of the function call parameters generated by the model. Validate the parameters before calling the function.
required:
- name
- arguments
id:
type: string
description: Unique identifier for the hit function.
type:
type: string
description: Tool type called by the model, currently only supports ‘function’.
WebSearchObjectResponse:
type: object
properties:
title:
type: string
description: Title.
content:
type: string
description: Content summary.
link:
type: string
description: Result URL.
media:
type: string
description: Website name.
icon:
type: string
description: Website icon.
refer:
type: string
description: Index number.
publish_date:
type: string
description: Website publication date.
ChatThinking:
type: object
description: Only supported by GLM-4.5 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(When enabled, GLM-5.1 GLM-5 GLM-5-Turbo GLM-5V-Turbo GLM-4.7 GLM-4.5V will think compulsorily, while GLM-4.6, GLM-4.6V, GLM-4.5 and others will automatically determine whether to think), default: enabled'
default: enabled
enum:
- enabled
- disabled
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
PageInfo:
type: object
description: Page dimension information
properties:
width:
type: integer
description: Page width
example: 600
height:
type: integer
description: Page height
example: 800
required:
- width
- height
parameters:
AcceptLanguage:
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
required: false
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: 'Use the following format for authentication: Bearer [](https://z.ai/manage-apikey/apikey-list)'