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.
Use the following format for authentication: Bearer
Body
application/json
model
enum<string>
required
Model code: glm-ocr
Available options:
glm-ocr
Example:
"glm-ocr"
file
string
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
Whether to return detailed layout image result information
start_page_id
integer
Start page number for parsing when PDF is provided
Required range: x >= 1
end_page_id
integer
End page number for parsing when PDF is provided
Required range: x >= 1
request_id
string
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.
Required string length: 6 - 64
user_id
string
Unique ID for the end user, 6–128 characters. Avoid using sensitive information.
Required string length: 6 - 128
Response
Business processing successful
id
string
required
Task ID
Example:
"task_123456789"
created
integer<int64>
required
Request creation time, Unix timestamp in seconds
Example:
1727156815
model
string
required
Model name
Example:
"GLM-OCR"
md_results
string
Recognition result in Markdown format
Example:
"# Doc title\nThis is the document content..."
layout_details
object[][]
Detailed layout information
Hide child attributes
layout_details.index
integer
required
Element index
Example:
1
layout_details.label
enum<string>
required
Element type: image for images, text for text content, formula for inline formulas, table for tables
Available options:
image,
text,
formula,
table
Example:
"text"
layout_details.bbox_2d
number[]
Normalized element coordinates [x1,y1,x2,y2]
Required array length: 4 elements
Required range: 0 <= x <= 1
Example:
[0.1, 0.1, 0.5, 0.3]
layout_details.content
string
Element content (text / image URL / table HTML)
Example:
"This is the content of the element"
layout_details.height
integer
Page height
Example:
800
layout_details.width
integer
Page width
Example:
600
layout_visualization
string[]
Recognition result image URLs
data_info
object
Document basic information
Hide child attributes
data_info.num_pages
integer
required
Total number of document pages
Example:
5
data_info.pages
object[]
Document page count information
Hide child attributes
data_info.pages.width
integer
required
Page width
Example:
600
data_info.pages.height
integer
required
Page height
Example:
800
usage
object
Token usage statistics returned when the model call ends.
Hide child attributes
usage.prompt_tokens
number
Number of tokens in user input
usage.completion_tokens
number
Number of output tokens
usage.prompt_tokens_details
object
Hide child attributes
usage.prompt_tokens_details.cached_tokens
number
Number of tokens served from cache
usage.total_tokens
integer
Total number of tokens
request_id
string
Request ID
Example:
"req_123456789"
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Overview - Z.AI DEVELOPER DOCUMENT","description":"Use GLM models like GLM-5.4, GLM-5.3, GLM-5.3-Flash, GLM-5.3-FlashX, GLM-5.3-FlashX-Legal, GLM-5.2 \u0026 GLM-5-Turbo 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":"","_id":"6b10b6239ffae5051c400c35"},"feedback":{"thumbs":true},"entitlements":{},"buildId":"6b0ff69000bab4ca3133b0e4","clientVersion":"0.0.4453","searchFilterCounts":[{"language":"default","tag":"Guides","count":26},{"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":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","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":"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":"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":"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":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","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":"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":"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},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"auth-vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"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] *)){font-weight:900}.prose-dark :where(strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:900}"}]}
{"page":{"pagePath":"api-reference/tools/layout-parsing","slug":"/api-reference/tools/layout-parsing","pageMetadata":{"title":"Layout Parsing","openapi":"POST /paas/v4/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.","href":"/api-reference/tools/layout-parsing"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n a: \"a\",\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsxs(_components.p, {\n children: [\"Use the \", _jsx(_components.a, {\n href: \"/guides/vlm/glm-ocr\",\n children: \"GLM-OCR\"\n }), \" 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.\"]\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":"Layout Parsing","openapi":"POST /paas/v4/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.","href":"/api-reference/tools/layout-parsing"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"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":"4054bda2-0384-4708-b288-2936fcc32768","responses":{"200":"3206efc1-3b97-4c05-add1-ebe1635ef372","default":"494b58e6-8654-455c-9634-5e31ab573b8e"},"method":"post","type":"path","servers":["ac2caf56-7c20-45aa-bf76-a151ce949d4a"],"security":["30685db6-1922-4fe4-a68e-8f0006470d2c"],"path":"/paas/v4/layout_parsing","baseUrlOptions":["https://api.z.ai/api"],"title":"Layout Parsing","codeSamples":[],"requestExampleLanguages":["bash","python","javascript","java"],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated","prefillPlaygroundWithExample":true,"prefillPlaygroundExamples":[{"body.model":"glm-ocr","body.file":"https://cdn.bigmodel.cn/static/logo/introduction.png"}],"disableProxy":true},"dependencies":{"parameters":{},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["model","file"],"properties":{"model":{"type":"string","description":"Model code: `glm-ocr`","example":"glm-ocr","enum":["glm-ocr"],"isRequired":true,"uniqueKey":"model","typeLabel":"enum\u003cstring>"},"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 30 pages","example":"https://cdn.bigmodel.cn/static/logo/introduction.png","isRequired":true,"uniqueKey":"file","typeLabel":"string"},"return_crop_images":{"type":"boolean","description":"Whether to return screenshot information","default":false,"uniqueKey":"return_crop_images","typeLabel":"boolean"},"need_layout_visualization":{"type":"boolean","description":"Whether to return detailed layout image result information","default":false,"uniqueKey":"need_layout_visualization","typeLabel":"boolean"},"start_page_id":{"type":"integer","description":"Start page number for parsing when PDF is provided","minimum":1,"uniqueKey":"start_page_id","typeLabel":"integer"},"end_page_id":{"type":"integer","description":"End page number for parsing when PDF is provided","minimum":1,"uniqueKey":"end_page_id","typeLabel":"integer"},"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":"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":"user_id","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Layout Parsing Example":{"title":"Layout Parsing Example","value":{"model":"glm-ocr","file":"https://cdn.bigmodel.cn/static/logo/introduction.png"}}},"exampleType":"examples"}},"required":true,"exampleType":"examples"},"responses":{"3206efc1-3b97-4c05-add1-ebe1635ef372":{"description":"Business processing successful","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"Task ID","example":"task_123456789","isRequired":true,"uniqueKey":"id","typeLabel":"string"},"created":{"type":"integer","format":"int64","description":"Request creation time, Unix timestamp in seconds","example":1727156815,"isRequired":true,"uniqueKey":"created","typeLabel":"integer\u003cint64>"},"model":{"type":"string","description":"Model name","example":"GLM-OCR","isRequired":true,"uniqueKey":"model","typeLabel":"string"},"md_results":{"type":"string","description":"Recognition result in Markdown format","example":"# Doc title\nThis is the document content...","uniqueKey":"md_results","typeLabel":"string"},"layout_details":{"type":"array","description":"Detailed layout information","items":{"type":"array","items":{"type":"object","description":"Layout detail element","properties":{"index":{"type":"integer","description":"Element index","example":1,"isRequired":true,"uniqueKey":"layout_details.items.[INDEX].items.[INDEX].index","typeLabel":"integer"},"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","isRequired":true,"uniqueKey":"layout_details.items.[INDEX].items.[INDEX].label","typeLabel":"enum\u003cstring>"},"bbox_2d":{"type":"array","description":"Normalized element coordinates [x1,y1,x2,y2]","items":{"type":"number","minimum":0,"maximum":1,"uniqueKey":"layout_details.items.[INDEX].items.[INDEX].bbox_2d.items.[INDEX]","typeLabel":"number"},"minItems":4,"maxItems":4,"example":[0.1,0.1,0.5,0.3],"uniqueKey":"layout_details.items.[INDEX].items.[INDEX].bbox_2d","typeLabel":"number[]"},"content":{"type":"string","description":"Element content (text / image URL / table HTML)","example":"This is the content of the element","uniqueKey":"layout_details.items.[INDEX].items.[INDEX].content","typeLabel":"string"},"height":{"type":"integer","description":"Page height","example":800,"uniqueKey":"layout_details.items.[INDEX].items.[INDEX].height","typeLabel":"integer"},"width":{"type":"integer","description":"Page width","example":600,"uniqueKey":"layout_details.items.[INDEX].items.[INDEX].width","typeLabel":"integer"}},"required":["index","label"],"uniqueKey":"layout_details.items.[INDEX].items.[INDEX]","typeLabel":"object"},"uniqueKey":"layout_details.items.[INDEX]","typeLabel":"object[]"},"uniqueKey":"layout_details","typeLabel":"object[][]"},"layout_visualization":{"type":"array","description":"Recognition result image URLs","items":{"type":"string","uniqueKey":"layout_visualization.items.[INDEX]","typeLabel":"string"},"uniqueKey":"layout_visualization","typeLabel":"string[]"},"data_info":{"type":"object","description":"Document basic information","properties":{"num_pages":{"type":"integer","description":"Total number of document pages","example":5,"isRequired":true,"uniqueKey":"data_info.num_pages","typeLabel":"integer"},"pages":{"type":"array","description":"Document page count information","items":{"type":"object","description":"Page dimension information","properties":{"width":{"type":"integer","description":"Page width","example":600,"isRequired":true,"uniqueKey":"data_info.pages.items.[INDEX].width","typeLabel":"integer"},"height":{"type":"integer","description":"Page height","example":800,"isRequired":true,"uniqueKey":"data_info.pages.items.[INDEX].height","typeLabel":"integer"}},"required":["width","height"],"uniqueKey":"data_info.pages.items.[INDEX]","typeLabel":"object"},"uniqueKey":"data_info.pages","typeLabel":"object[]"}},"required":["num_pages"],"uniqueKey":"data_info","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"},"request_id":{"type":"string","description":"Request ID","example":"req_123456789","uniqueKey":"request_id","typeLabel":"string"}},"required":["id","created","model"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"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":["\u003cstring>"],"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"}}},"exampleType":"generated"}},"exampleType":"generated"},"494b58e6-8654-455c-9634-5e31ab573b8e":{"description":"Request 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":{"30685db6-1922-4fe4-a68e-8f0006470d2c":{"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":{"ac2caf56-7c20-45aa-bf76-a151ce949d4a":{"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":"Layout Parsing - Overview - Z.AI DEVELOPER DOCUMENT","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{"English":{"href":"/api-reference/tools/layout-parsing","matchLevel":0}},"firstHrefInLanguage":{}},"lastModified":"2026-02-02T16:26:04.382Z","originalFileLocation":"api-reference/tools/layout-parsing.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=\"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.\">\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=\"Layout Parsing - Overview - Z.AI DEVELOPER DOCUMENT\">\u003cmeta data-mint-head property=\"og:description\" content=\"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.\">\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/tools/layout-parsing\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://zhipu-32152247.mintlify.site/_mintlify/api/og/v2?division=Tool+API\u0026amp;title=Layout+Parsing\u0026amp;description=Use+the+%5BGLM-OCR%5D%28%2Fguides%2Fvlm%2Fglm-ocr%29+model+to+parse+the+layout+of+documents+and+images+and+extract+text+content.+Support+OCR+recognition+of+images+and+PDF+doc\u0026amp;theme=e598d81587661c063148304b\u0026amp;signature=7bae3bcce7568f679fb5748dfc4e738c4bddf6346cfe1da492ffea44d372f209\">\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=\"Layout Parsing - Overview - Z.AI DEVELOPER DOCUMENT\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"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.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://zhipu-32152247.mintlify.site/_mintlify/api/og/v2?division=Tool+API\u0026amp;title=Layout+Parsing\u0026amp;description=Use+the+%5BGLM-OCR%5D%28%2Fguides%2Fvlm%2Fglm-ocr%29+model+to+parse+the+layout+of+documents+and+images+and+extract+text+content.+Support+OCR+recognition+of+images+and+PDF+doc\u0026amp;theme=e598d81587661c063148304b\u0026amp;signature=7bae3bcce7568f679fb5748dfc4e738c4bddf6346cfe1da492ffea44d372f209\">\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/tools/layout-parsing\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/tools/layout-parsing.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/tools/layout-parsing#webpage\",\"url\":\"https://docs.z.ai/api-reference/tools/layout-parsing\",\"name\":\"Layout Parsing\",\"description\":\"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.\",\"dateModified\":\"2026-02-02T16:26:04.382Z\",\"isPartOf\":{\"@id\":\"https://docs.z.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.z.ai/api-reference/tools/layout-parsing#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.z.ai/api-reference/tools/layout-parsing#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Tool API\",\"item\":\"https://docs.z.ai/api-reference/tools/tokenizer\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Layout Parsing\",\"item\":\"https://docs.z.ai/api-reference/tools/layout-parsing\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.z.ai/api-reference/tools/layout-parsing#apireference\",\"headline\":\"Layout Parsing\",\"name\":\"Layout Parsing\",\"description\":\"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.\",\"url\":\"https://docs.z.ai/api-reference/tools/layout-parsing\",\"mainEntityOfPage\":{\"@id\":\"https://docs.z.ai/api-reference/tools/layout-parsing#webpage\"},\"dateModified\":\"2026-02-02T16:26:04.382Z\",\"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\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Overview - Z.AI DEVELOPER DOCUMENT\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/api-reference/tools/layout-parsing.md","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","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","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","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.","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","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.).","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"}]}]}]},"basePath":"","title":"Layout Parsing - Overview - Z.AI DEVELOPER DOCUMENT","deploymentId":"dpl_BLZw3QngerHodH9E8mGgC4v752y3","buildId":"dpl_BLZw3QngerHodH9E8mGgC4v752y3","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-CaRkHcld.js","snippetPresets-CbOVSLWB.js","utils-cjri0g4r.js","style-to-object-BY3JEAdk.js","utils-DINdUa17.js","v4-DIgz8zy6.js","addTypeLabelsToSchema-B6z-PJGf.js","conditional-requirements-CFM0id0Q.js","cloneDeep-BldndzCM.js","_Uint8Array-BFUkDgJK.js","isObject-FP1Yky1u.js","ApiExamples-gah5G0c1.js","usePlaygroundInputsStore-DMbftGRK.js","shallow-BPuQ-dV8.js","isEqual-Du6c450V.js","CodeSnippets-BSVM0Ibi.js","CodeSnippet-BtGQRZnK.js","use-playground-group-access-98JyaSW7.js","Page-DuvGhd6e.js","api-description-markdown-ja0XM5Ae.js","DynamicMarkdown-DgKZ4_wp.js","SectionHeading-S4Jc_qPe.js","MethodPill-HIsDH_bI.js","getPastedJson-BKEmMYEO.js","Check2Icon-CRFAnWm9.js","axios-CsQoIw0U.js","Markdown-CexXCNoj.js","AssistantPageLink-C2AZnMAs.js","dist-CjxLTLs9.js","lib-DMeTj1gb.js","lib-B8HbPgcC.js","katex-Dbtb6Wk7.js","html-void-elements-mCSPHezU.js","marked.esm-CZWythHk.js"]}