vlmrun gw chat runs an OCR or VLM model on documents, images, or videos.
Inputs are local paths, remote URLs, or both.
Shared options and configuration are on gateway.
Response rule.
Metering is on the closing rule.
bbox_xywh and poly_xy are normalized to the page, not pixels.
Methods that return prose put the text in the <page> body with format="markdown".
markdown on zai-org/glm-ocr returns prose.
The closing rule lists these fields:
- Model
- Prompt, completion, and total tokens
- Throughput
- Pages
- Pages per second
- Latency
- Cost
- Tokens and throughput drop out without usage.
- Pages drop out for non-paginated replies.
- Cost drops out when none is returned.
Methods
Each model exposes one or more methods (ocr, detect, markdown) and a default.
vlmrun gw models <model> lists them.
--method sets the gateway method field.
--method-params sets the gateway method_params field.
Video input
Video files and video URLs are sent asvideo_url content parts.
video_fps and video_max_frames control frame sampling.
Pass them with -e.
Extra completion kwargs
-e forwards extra chat.completions.create() kwargs as repeatable key=value pairs.
Values are JSON-parsed.
Known keys are passed as real kwargs.
Unknown keys go through extra_body and become top-level gateway request fields.
Streaming
gw chat streams by default.
Tokens print live.
Multi-page documents stream one chunk per page.
-ns / --no-stream waits for the full reply.
The full reply renders in a bordered panel.
JSON output vs JSON mode
pages and pages_per_sec are included when the reply is paginated OCR.
usage is the gateway object, passed through unchanged.
It includes standard OpenAI breakdown fields, often null for OCR models.
It also includes the VLM Run cost field.
Read usage.cost.
Do not recompute cost from tokens.
--json-mode with -j double-encodes the result.
content is a JSON string that holds a JSON document.
Parse it twice: jq -r .content | jq ..
--response-format accepts text, json_object (alias json), or a JSON object such as '{"type":"json_schema", ...}'.
--json-mode is exactly --response-format json_object.
The two flags are mutually exclusive.
json_schema requires capabilities.supports_json_schema.
Chat and frontier models constrain generation to the schema.
OCR and detection models return a 400 capability_violation.
Use json_object on OCR and detection models.