GLM-OCR¶
Class: GLMOCRBlockV1
Source: inference.core.workflows.core_steps.models.foundation.glm_ocr.v1.GLMOCRBlockV1
Recognize text in images using GLM-OCR, a vision language model by Zhipu AI specialized for optical character recognition.
GLM-OCR supports three built-in recognition modes:
- Text Recognition — General-purpose text recognition for serial numbers, labels, scene text, and documents.
- Formula Recognition — Recognizes mathematical formulas and equations.
- Table Recognition — Recognizes table structures and content.
You can also select Custom Prompt to provide your own prompt for specialized recognition tasks, or Structured Output to extract values from the image into a JSON document with a user-defined schema (pair with the JSON Parser block to materialize the keys as workflow outputs).
This block pairs well with detection models and DynamicCropBlock to isolate regions of interest before running OCR. For example, use an object detection model to find labels or text regions, crop them, then pass the crops to GLM-OCR.
Note: GLM-OCR requires a GPU for inference.
Type identifier¶
Use the following identifier in step "type" field: roboflow_core/glm_ocr@v1to add the block as
as step in your workflow.
Properties¶
| Name | Type | Description | Refs |
|---|---|---|---|
name |
str |
Enter a unique identifier for this step.. | ❌ |
task_type |
str |
Recognition task to perform. Determines the prompt sent to GLM-OCR. Accepts a selector (e.g. $inputs.task_type) so the mode can be set dynamically.. | ✅ |
prompt |
str |
Custom text prompt for GLM-OCR. Only used when task_type is 'custom'.. | ✅ |
output_structure |
Dict[str, str] |
Dictionary describing the structure of the expected JSON response. Keys are the JSON field names; values describe what the model should put in each field.. | ❌ |
max_new_tokens |
int |
Maximum number of tokens to generate. If not set, the model default will be used.. | ❌ |
model_version |
str |
The GLM-OCR model to be used for inference.. | ✅ |
The Refs column marks possibility to parametrise the property with dynamic values available
in workflow runtime. See Bindings for more info.
Runtime compatibility¶
-
hard— runtimeself_hosted_cpu; executionlocal - Requires a GPU; run_locally() loads a model that needs CUDA.
Available Connections¶
Compatible Blocks
Check what blocks you can connect to GLM-OCR in version v1.
- inputs:
Roboflow Asset Library Attributes,MoonshotAI Kimi,Image Blur,Reference Path Visualization,Event Writer,Slack Notification,Halo Visualization,VLM As Classifier,Google Gemma,Qwen 3.6 API,Object Detection Model,Dot Visualization,Label Visualization,Background Color Visualization,Llama 3.2 Vision,Email Notification,Pixelate Visualization,OpenAI-Compatible LLM,Google Gemini,Anthropic Claude,OpenAI,Trace Visualization,Llama 3.2 Vision,Clip Comparison,Camera Focus,OpenAI,GLM-OCR,MQTT Writer,SIFT Comparison,CSV Formatter,Webhook Sink,Image Contours,Local File Sink,Google Gemini,MoonshotAI Kimi,Polygon Visualization,SIFT,Classification Label Visualization,Multi-Label Classification Model,Instance Segmentation Model,Keypoint Detection Model,Keypoint Visualization,Instance Segmentation Model,Icon Visualization,Dynamic Crop,Stability AI Inpainting,Bounding Box Visualization,Polygon Zone Visualization,Stability AI Outpainting,Multi-Label Classification Model,Crop Visualization,Image Convert Grayscale,Mask Visualization,Halo Visualization,Text Display,Morphological Transformation,Anthropic Claude,Roboflow Dataset Upload,Object Detection Model,Ellipse Visualization,Keypoint Detection Model,Circle Visualization,Semantic Segmentation Model,Twilio SMS Notification,Email Notification,S3 Sink,Camera Focus,Single-Label Classification Model,Image Slicer,LMM For Classification,OCR Model,Heatmap Visualization,OpenAI,Google Gemma API,Stitch Images,Morphological Transformation,EasyOCR,Single-Label Classification Model,Current Time,Blur Visualization,Stitch OCR Detections,Florence-2 Model,Google Gemini,Corner Visualization,OpenRouter,Model Comparison Visualization,Model Monitoring Inference Aggregator,Google Vision OCR,Image Threshold,Instance Segmentation Model,LMM,Single-Label Classification Model,Polygon Visualization,Stability AI Image Generation,Line Counter Visualization,CogVLM,Relative Static Crop,Qwen3.5-VL,Grid Visualization,Image Preprocessing,Stitch OCR Detections,Anthropic Claude,OPC UA Writer Sink,Color Visualization,Triangle Visualization,QR Code Generator,Contrast Enhancement,Roboflow Dataset Upload,Absolute Static Crop,Qwen 3.5 API,Background Subtraction,Multi-Label Classification Model,OpenAI,Image Slicer,Semantic Segmentation Model,Qwen-VL,Florence-2 Model,Perspective Correction,Twilio SMS/MMS Notification,Roboflow Vision Events,Microsoft SQL Server Sink,Instance Segmentation Model,Depth Estimation,Roboflow Custom Metadata,Contrast Equalization,Camera Calibration,VLM As Detector,Keypoint Detection Model,Object Detection Model - outputs:
Cache Set,MoonshotAI Kimi,Roboflow Asset Library Attributes,Path Deviation,Image Blur,Reference Path Visualization,PTZ Tracking (ONVIF),Event Writer,Slack Notification,Halo Visualization,CLIP Embedding Model,VLM As Classifier,Google Gemma,Qwen 3.6 API,Dot Visualization,Label Visualization,Background Color Visualization,Llama 3.2 Vision,Email Notification,OpenAI-Compatible LLM,Google Gemini,JSON Parser,Anthropic Claude,Cache Get,OpenAI,Trace Visualization,Llama 3.2 Vision,OpenAI,Clip Comparison,GLM-OCR,MQTT Writer,Webhook Sink,SIFT Comparison,Local File Sink,Google Gemini,MoonshotAI Kimi,Polygon Visualization,Classification Label Visualization,Instance Segmentation Model,Keypoint Visualization,Instance Segmentation Model,Icon Visualization,Seg Preview,Dynamic Crop,Stability AI Inpainting,Bounding Box Visualization,Polygon Zone Visualization,Stability AI Outpainting,Multi-Label Classification Model,Crop Visualization,Mask Visualization,Halo Visualization,Detections Stitch,Distance Measurement,Anthropic Claude,Morphological Transformation,Text Display,VLM As Classifier,Roboflow Dataset Upload,VLM As Detector,Ellipse Visualization,Keypoint Detection Model,SAM3 Video Tracker,Time in Zone,SAM 3,Size Measurement,Circle Visualization,Semantic Segmentation Model,Path Deviation,Twilio SMS Notification,Email Notification,S3 Sink,SAM 3,LMM For Classification,Heatmap Visualization,Google Gemma API,OpenAI,Time in Zone,Morphological Transformation,Single-Label Classification Model,YOLO-World Model,Current Time,Stitch OCR Detections,Moondream2,Florence-2 Model,Google Gemini,Corner Visualization,OpenRouter,Pixel Color Count,Model Comparison Visualization,SAM 3,Model Monitoring Inference Aggregator,Google Vision OCR,Image Threshold,Instance Segmentation Model,LMM,Polygon Visualization,Segment Anything 2 Model,Time in Zone,Stability AI Image Generation,Line Counter Visualization,Line Counter,CogVLM,Qwen3.5-VL,Image Preprocessing,Stitch OCR Detections,Anthropic Claude,OPC UA Writer Sink,Color Visualization,Triangle Visualization,QR Code Generator,Qwen 3.5 API,Roboflow Dataset Upload,OpenAI,Qwen-VL,Florence-2 Model,Perspective Correction,Roboflow Vision Events,Microsoft SQL Server Sink,Twilio SMS/MMS Notification,Perception Encoder Embedding Model,Instance Segmentation Model,Depth Estimation,Roboflow Custom Metadata,Contrast Equalization,Detections Classes Replacement,VLM As Detector,Line Counter,Object Detection Model
Input and Output Bindings¶
The available connections depend on its binding kinds. Check what binding kinds
GLM-OCR in version v1 has.
Bindings
-
input
images(image): The image to infer on..task_type(string): Recognition task to perform. Determines the prompt sent to GLM-OCR. Accepts a selector (e.g. $inputs.task_type) so the mode can be set dynamically..prompt(string): Custom text prompt for GLM-OCR. Only used when task_type is 'custom'..model_version(roboflow_model_id): The GLM-OCR model to be used for inference..
-
output
parsed_output(Union[string,language_model_output]): String value ifstringor LLM / VLM output iflanguage_model_output.
Example JSON definition of step GLM-OCR in version v1
{
"name": "<your_step_name_here>",
"type": "roboflow_core/glm_ocr@v1",
"images": "$inputs.image",
"task_type": "<block_does_not_provide_example>",
"prompt": "Describe the text in the image.",
"output_structure": {
"my_key": "description"
},
"max_new_tokens": "<block_does_not_provide_example>",
"model_version": "glm-ocr"
}