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:
Keypoint Visualization,Twilio SMS/MMS Notification,OPC UA Writer Sink,Keypoint Detection Model,Qwen 3.6 API,Grid Visualization,Object Detection Model,Llama 3.2 Vision,PLC Writer,Absolute Static Crop,Roboflow Visual Search Classifier,Image Threshold,Polygon Zone Visualization,CogVLM,MQTT Writer,Contrast Equalization,Google Gemini,OCR Model,GLM-OCR,Background Subtraction,Contrast Enhancement,Reference Path Visualization,Twilio SMS Notification,Instance Segmentation Model,Google Gemma API,VLM As Detector,Florence-2 Model,Dynamic Crop,Halo Visualization,Image Blur,LMM,Ellipse Visualization,OpenAI,Florence-2 Model,LMM For Classification,Semantic Segmentation Model,Instance Segmentation Model,Event Writer,OpenAI,Single-Label Classification Model,Keypoint Detection Model,Google Gemma,Slack Notification,Heatmap Visualization,Semantic Segmentation Model,Email Notification,Circle Visualization,Perspective Correction,Camera Focus,Crop Visualization,Polygon Visualization,Keypoint Detection Model,Multi-Label Classification Model,Stability AI Inpainting,OpenAI-Compatible LLM,Object Detection Model,VLM As Classifier,Image Slicer,Google Gemini,Roboflow Vision Events,Multi-Label Classification Model,Local File Sink,Object Detection Model,Dot Visualization,Line Counter Visualization,Depth Estimation,Instance Segmentation Model,Stitch OCR Detections,PP-OCR,Blur Visualization,EasyOCR,Anthropic Claude,CSV Formatter,Color Visualization,Image Convert Grayscale,Stitch OCR Detections,Single-Label Classification Model,Qwen 3.5 API,Trace Visualization,Icon Visualization,Current Time,Model Comparison Visualization,Camera Focus,QR Code Generator,Google Gemini,Instance Segmentation Model,Qwen-VL,Mask Visualization,MoonshotAI Kimi,Microsoft SQL Server Sink,Text Display,Stability AI Image Generation,Google Vision OCR,Webhook Sink,OpenAI,Pixelate Visualization,Stitch Images,S3 Sink,Classification Label Visualization,MoonshotAI Kimi,Polygon Visualization,Anthropic Claude,Roboflow Dataset Upload,Morphological Transformation,Bounding Box Visualization,Image Contours,Image Slicer,Stability AI Outpainting,Anthropic Claude,Roboflow Custom Metadata,Multi-Label Classification Model,Camera Calibration,Roboflow Asset Library Attributes,Morphological Transformation,Relative Static Crop,Background Color Visualization,Model Monitoring Inference Aggregator,Clip Comparison,Corner Visualization,SIFT,Roboflow Visual Search,OpenRouter,Llama 3.2 Vision,Qwen3.5-VL,Email Notification,Single-Label Classification Model,Triangle Visualization,OpenAI,Roboflow Dataset Upload,Image Preprocessing,SIFT Comparison,Halo Visualization,Label Visualization - outputs:
Keypoint Visualization,Twilio SMS/MMS Notification,OPC UA Writer Sink,Keypoint Detection Model,Perception Encoder Embedding Model,Qwen 3.6 API,SAM 3,Llama 3.2 Vision,JSON Parser,Distance Measurement,Roboflow Visual Search Classifier,Image Threshold,Polygon Zone Visualization,CogVLM,MQTT Writer,Contrast Equalization,Google Gemini,GLM-OCR,Reference Path Visualization,Twilio SMS Notification,Google Gemma API,Instance Segmentation Model,PTZ Tracking (ONVIF),Detections Classes Replacement,VLM As Detector,Florence-2 Model,Dynamic Crop,Halo Visualization,Image Blur,LMM,Seg Preview,SAM 3,Ellipse Visualization,OpenAI,Florence-2 Model,Line Counter,LMM For Classification,Time in Zone,Cache Set,Semantic Segmentation Model,OpenAI,Path Deviation,Event Writer,Instance Segmentation Model,Time in Zone,Google Gemma,Slack Notification,Heatmap Visualization,Email Notification,Circle Visualization,Perspective Correction,Crop Visualization,Polygon Visualization,Line Counter,Stability AI Inpainting,OpenAI-Compatible LLM,SAM 3,VLM As Classifier,Google Gemini,Roboflow Vision Events,Multi-Label Classification Model,Size Measurement,Local File Sink,Object Detection Model,SAM3 Video Tracker,Dot Visualization,Line Counter Visualization,Time in Zone,Instance Segmentation Model,Depth Estimation,Stitch OCR Detections,Anthropic Claude,Segment Anything 2 Model,Color Visualization,Stitch OCR Detections,Qwen 3.5 API,Trace Visualization,Icon Visualization,Current Time,Cache Get,Model Comparison Visualization,QR Code Generator,Google Gemini,Detections Stitch,Instance Segmentation Model,Qwen-VL,Mask Visualization,MoonshotAI Kimi,Microsoft SQL Server Sink,Text Display,Stability AI Image Generation,Google Vision OCR,Webhook Sink,OpenAI,VLM As Detector,S3 Sink,Classification Label Visualization,MoonshotAI Kimi,Polygon Visualization,Anthropic Claude,Roboflow Dataset Upload,Morphological Transformation,Bounding Box Visualization,VLM As Classifier,Stability AI Outpainting,Anthropic Claude,Roboflow Custom Metadata,Roboflow Asset Library Attributes,Morphological Transformation,Path Deviation,Background Color Visualization,Model Monitoring Inference Aggregator,Clip Comparison,Corner Visualization,Moondream2,Roboflow Visual Search,OpenRouter,Qwen3.5-VL,Llama 3.2 Vision,Email Notification,CLIP Embedding Model,Single-Label Classification Model,Triangle Visualization,OpenAI,Pixel Color Count,Roboflow Dataset Upload,Image Preprocessing,SIFT Comparison,YOLO-World Model,Halo Visualization,Label Visualization
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"
}