v1

latestOpenAPI 3.0.1Z.AI Developer Agreement and Policy2026-07-131458163.2 KB

Layout Parsing

Use the 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.

post/paas/v4/layout_parsing

Request body

model'glm-ocr' required

Model code: glm-ocr

filestring required

Image or PDF document to be recognized, supports URL and base64. Supported image formats: PDF, JPG, PNG. Single image ≤10MB, PDF ≤50MB, maximum support 30 pages

return_crop_imagesboolean

Whether to return screenshot information

need_layout_visualizationboolean

Whether to return detailed layout image result information

start_page_idinteger

Start page number for parsing when PDF is provided

end_page_idinteger

End page number for parsing when PDF is provided

request_idstring

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.

user_idstring

Unique ID for the end user, 6–128 characters. Avoid using sensitive information.

Example request

{
  "model": "glm-ocr",
  "file": "https://cdn.bigmodel.cn/static/logo/introduction.png"
}

Response

Business processing successful

idstring required

Task ID

createdinteger required

Request creation time, Unix timestamp in seconds

modelstring required

Model name

md_resultsstring

Recognition result in Markdown format

layout_visualizationstring[]

Recognition result image URLs

request_idstring

Request ID

Example response

{
  "id": "task_123456789",
  "created": 1727156815,
  "model": "GLM-OCR",
  "md_results": "# Doc title\nThis is the document content...",
  "layout_details": [
    [
      {
        "index": 1,
        "label": "text",
        "bbox_2d": [
          0.1,
          0.1,
          0.5,
          0.3
        ],
        "content": "This is the content of the element",
        "height": 800,
        "width": 600
      }
    ]
  ],
  "data_info": {
    "num_pages": 5,
    "pages": [
      {
        "width": 600,
        "height": 800
      }
    ]
  },
  "request_id": "req_123456789"
}