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.
Each model exposes supported
Models Supported
For available models and aliases, see Models.Gateway extensions
These fields are accepted at the top level of the request body (or viaextra_body in the OpenAI Python SDK):
| Field | Type | Default | Description |
|---|---|---|---|
method | string | model default | Model-specific operation (ocr, detect, markdown, …). |
method_params | object | null | Keyword arguments for the selected method. |
llm | string | null | Optional LLM for post-processing structured model output. |
document_dpi | integer | 150 | DPI when rasterizing PDF pages. |
document_max_pages | integer | 500 | Maximum PDF pages per request. |
image_resolution | string | null | Square resize preset (224x224 … 768x768). |
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:| Field | Description |
|---|---|
usage | Token counts; may include usage.cost for metering. |
Streaming
Setstream: true on document PDF requests (document_url). The VLM Run Gateway emits one SSE chunk per page block, in ascending
page order, followed by a final chunk with aggregated usage.
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