GLM OCR API
GLM OCR converts document images to Markdown or JSON for developers parsing invoices, forms and reports, from $0.027.
- Image in, text out
- 8K token context
- 1.3B parameters, FP8
- MIT licence
from openai import OpenAI
client = OpenAI(
base_url="https://api.modelsheep.com",
api_key=API_KEY_MODELSHEEP,
)
response = client.chat.completions.create(
model="zai-org/GLM-OCR",
messages=[
{
"role": "user",
"content": [
{
"type": "text",
"text": "Read the text in this image."
},
{
"type": "image_url",
"image_url": {
"url": "https://modelsheep.com/invoice.png"
}
}
]
}
],
)
print(response.choices[0].message.content)How to use the GLM OCR API
- 1
Create a ModelSheep account and copy an API key from the dashboard.
- 2
Point the OpenAI SDK at the base url
https://api.modelsheep.comand set the model tozai-org/GLM-OCR. - 3
Send one user message that holds a text part and an image part, pass the image as a URL or a base64 data URL, and read the Markdown or JSON back from the first choice.
What GLM OCR is
GLM OCR is a document recognition model from Z.ai. It reads a page image and returns the text, tables and formulas. Z.ai trained it for two tasks. It parses a document or extracts named fields. Other vision models in this catalogue answer open questions about an image. GLM OCR transcribes the page.
What it does well
- Converts a scanned invoice or receipt to Markdown.
- Rebuilds a table from a report page as HTML.
- Extracts named fields from a form or certificate to JSON.
What it is not for
- Open questions about a photo. The model card lists two tasks: document parsing and information extraction. The model does not describe a scene or discuss an image.
- Long documents in one call. The context window holds 8K tokens. One dense page and a long JSON answer can fill it. Send one page per request.
Calling it
Call POST /chat/completions with the model string zai-org/GLM-OCR. Include a text part and an image part in the same user message. The image must be a URL or a base64 data URL. Pass a JSON schema in response_format when you need fields. A loose instruction returns loose text.
zai-org/GLM-OCR /chat/completions
SDKs and languages
GLM OCR answers on an HTTP endpoint, so any language that can post JSON reaches it. These are the ones the box above writes out.
- OpenAI SDK
- PythonTypeScript
- Anthropic SDK
- PythonTypeScript
- HTTP
- cURLPythonTypeScriptGoRustJavaC#PHP
Specifications
| Author | Z.ai |
|---|---|
| Category | vision |
| Accepts | text, image |
| Returns | text |
| Total parameters | 1.3B |
| Active parameters | dense, all of them |
| Score | not rated |
| Languages | 8 namedChinese, English, French, Spanish, Russian, German, Japanese and Korean. Z.ai ends the list with "etc.", so eight is a floor. Arabic is not supported today. |
| Precision served | FP8 |
| Context | 8K tokens |
| Vector | n/a |
| License | MIT |
Price
Input
$0.027
per million tokens
Output
$0.027
per million tokens
Against OpenRouter
10%
below the cheapest of 1 provider
The cheapest OpenRouter price for this model was $0.030 in and $0.030 out, with a median of $0.030 and $0.030 across the comparable providers. Read on 2026-09-17.
License
Z.ai publishes the weights under the MIT licence, which permits commercial use. The full Z.ai document pipeline adds the PP-DocLayoutV3 layout component under Apache 2.0. Read both licences before you self-host that pipeline.
Similar models
- Parameters
- 304.2B, 13B
- Context
- 1.3M
- Input per 1M
- $0.027
- Output per 1M
- $0.117
- License
- MIT
- Parameters
- 1.55B
- Context
- 0K
- Input per 1M
- $0.024 /hr
- Output per 1M
- n/a
- License
- MIT
- Parameters
- 7.953B
- Context
- 33K
- Vector
- 4096
- Input per 1M
- $0.031
- Output per 1M
- n/a
- License
- OpenMDW 1.1
Start using GLM OCR
Point the OpenAI SDK at api.modelsheep.com. Your prompts stay in Germany, and nothing is retained.