翻篇收录说明
翻篇网页快照

Layout Parsing - Overview - Z.AI DEVELOPER DOCUMENT

https://docs.z.ai/api-reference/tools/layout-parsing

最近抓取:2026-12-03 18:07:18(北京时间)

最近内容变化:2026-12-03 18:07:18(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

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.

正文摘录

Layout ParsingcURLcurl --request POST \ --url https://api.z.ai/api/paas/v4/layout_parsing \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data ' { "model": "glm-ocr", "file": "https://cdn.bigmodel.cn/static/logo/introduction.png" } '200default{ "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 } ] ], "layout_visualization": [ "<string>" ], "data_info": { "num_pages": 5, "pages": [ { "width": 600, "height": 800 } ] }, "usage": { "prompt_tokens": 123, "completion_tokens": 123, "prompt_tokens_details": { "cached_tokens": 123 }, "total_tokens": 123 }, "request_id": "req_123456789" }POST/paas/v4/layout_parsingTry itLayout ParsingcURLcurl --request POST \ --url https://api.z.ai/api/paas/v4/layout_parsing \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data ' { "model": "glm-ocr", "file": "https://cdn.bigmodel.cn/static/logo/introduction.png" } '200default{ "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 } ] ], "layout_visualization": [ "<string>" ], "data_info": { "num_pages": 5, "pages": [ { "width": 600, "height": 800 } ] }, "usage": { "prompt_tokens": 123, "completion_tokens": 123, "prompt_tokens_details": { "cached_tokens": 123 }, "total_tokens": 123 }, "request_id": "req_123456789" }AuthorizationsAuthorizationstringheaderrequiredUse the following format for authentication: Bearer Bodyapplication/jsonmodelenum<string>requiredModel code: glm-ocrAvailable options: glm-ocr Example:"glm-ocr"filestringrequiredImage or PDF document to be recognized, supports URL and base64. Supported image formats: PDF, JPG, PNG. Single image ≤10MB, PDF ≤50MB, maximum support 30 pagesExample:"https://cdn.bigmodel.cn/static/logo/introduction.png"return_crop_imagesbooleandefault:falseWhether to return screenshot informationneed_layout_visualizationbooleandefault:falseWhether to return detailed layout image result informationstart_page_idintegerStart page number for parsing when PDF is providedRequired range: x >= 1end_page_idintegerEnd page number for parsing when PDF is providedRequired range: x >= 1request_idstringPassed 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.Required string length: 6 - 64user_idstringUnique ID for the end user, 6–128 characters. Avoid using sensitive information.Required string length: 6 - 128Response200application/jsonBusiness processing successfulidstringrequiredTask IDExample:"task_123456789"createdinteger<int64>requiredRequest creation time, Unix timestamp in secondsExample:1727156815modelstringrequiredModel nameExample:"GLM-OCR"md_resultsstringRecognition result in Markdown formatExample:"# Doc title\nThis is the document content..."layout_detailsobject[][]Detailed layout informationHide child attributeslayout_details.indexintegerrequiredElement indexExample:1layout_details.labelenum<string>requiredElement type: image for images, text for text content, formula for inline formulas, table for tablesAvailable options: image, text, formula, table Example:"text"layout_details.bbox_2dnumber[]Normalized element coordinates [x1,y1,x2,y2]Required array length: 4 elementsRequired range: 0 <= x <= 1Example:[0.1, 0.1, 0.5, 0.3]layout_details.contentstringElement content (text / image URL / table HTML)Example:"This is the content of the element"layout_details.heightintegerPage heightExample:800layout_details.widthintegerPage widthExample:600layout_visualizationstring[]Recognition result image URLsdata_infoobjectDocument basic informationHide child attributesdata_info.num_pagesintegerrequiredTotal number of document pagesExample:5data_info.pagesobject[]Document page count informationHide child attributesdata_info.pages.widthintegerrequiredPage widthExample:600data_info.pages.heightintegerrequiredPage heightExample:800usageobjectToken usage statistics returned when the model call ends.Hide child attributesusage.prompt_tokensnumberNumber of tokens in user inputusage.completion_tokensnumberNumber of output tokensusage.prompt_tokens_detailsobjectHide child attributesusage.prompt_tokens_details.cached_tokensnumberNumber of tokens served from cacheusage.total_tokensintegerTotal number of tokensrequest_idstringRequest IDExample:"req_123456789"Was this page helpful?YesNo