Chat Completions
API Reference
Chat Completions
OpenAI-compatible chat completions for OCR, VQA, and document inference
POST
Chat Completions
Authentication is optional for the VLM Run Gateway (at the moment). See
Authentication for tiers and
Rate Limits for per-tier quotas.
Models Supported
For available models and aliases, see Models. Standard OpenAI sampling fields (temperature, max_tokens, top_p,
frequency_penalty, presence_penalty, stop, n) are accepted on every
request, but OCR and detection models generally ignore sampling params since
they are not free-form text generators. Check a model’s
supported_parameters via Get Model
if a field you send does not appear to change the output.
Gateway extensions
These fields are accepted at the top level of the request body (or viaextra_body in the OpenAI Python SDK):
video_max_frames, video_fps, and video_resolution apply when the request
includes a video_url content part on a video-capable model. See
Video Inputs.
Each model exposes supported method values on
GET /v1/openai/models. See
Methods for a per-model reference with examples.
Content parts
Messages use the standard OpenAI multimodal shape. See Multimodal Inputs for the full content part reference (text, image_url, document_url) and
document-specific limits.
Response extensions
Non-streaming responses follow the OpenAI chat completion shape with one VLM Run Gateway extension:Streaming
Setstream: true on document PDF requests (document_url). The VLM Run Gateway emits SSE chunks in document order: a <document> open tag, one chunk per <page> block in ascending
page order, then the matching </document> close tag. A final chunk with aggregated usage follows.
Image-only and text-only requests do not support streaming on the Gateway
today. See Flexible Document OCR for the full SSE walkthrough.
Document OCR
Stream a document page-by-page
Errors and limits
- Error codes: capability violations, invalid documents, model not found, and sanitized 500 responses.
- Rate limits: 60 requests/min and 1000 requests/hr per IP (anonymous) or per user (authenticated).
x-request-id header. You may send your own id on
the request; otherwise the VLM Run Gateway mints one. Sanitized 500 responses also
include the id as error.request_id in the JSON body.
Related
List models
Query the live model catalog and capabilities.
Models
Full catalog with availability and use-case guidance.
Quickstart
First requests for VQA and document OCR.
Flexible Document OCR
Request knobs, page blocks, and streaming for PDFs.
Multimodal Inputs
Content part types, document limits, and format tradeoffs.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
OpenAI-compatible chat completion request.
Available options:
224x224, 336x336, 384x384, 448x448, 512x512, 768x768 Available options:
256x192, 320x240, 448x336, 512x384, 640x480 Response
Successful Response
OpenAI-compatible chat completion response.
Beyond the OpenAI shape we surface two extra fields so clients can audit which model actually produced the output:
served_model_id— the canonical id of the deployment that ran the request (e.g."rednote-hilab/dots.ocr"), even when the caller used a short alias. Mirrors the"id"echoed inGET /v1/openai/models.backend— static label naming the inference runtime that served the request ("vllm"/"transformers"/"llama.cpp"/"paddleocr"/ ...). Lets clients see the runtime without opening a separate /models RPC.
The OpenAI-standard model field still echoes the canonical
id (matching OpenAI's own behaviour where a generic alias like
gpt-4 resolves to the dated snapshot gpt-4-0613 in the
response).