Skip to main content
client.gateway is an OpenAI-compatible surface for third-party OCR and vision-language models. Auth uses the same VLMRUN_API_KEY as the rest of the SDK. The OpenAI SDK base URL is https://gateway.vlm.run/v1/openai. client.gateway.completions, client.gateway.embeddings, and client.gateway.transcriptions are standard OpenAI resource objects.
The gateway passes requests through to the underlying model. Most models, especially OCR models, do not accept text-only input. You generally need at least one image_url or document_url content part. Agent calls use client.agent.

Installation

The OpenAI SDK is an optional peer dependency.

Chat Completions

Pass PDFs as document_url content parts. Pass images as image_url. method and document_dpi travel with the standard OpenAI fields.

Visual Q&A

Models that accept text, such as qwen/qwen3.5-0.8b, take a text content part with an image.

Streaming

Document (PDF) requests stream one SSE chunk per page.

Embeddings

Models accept text, images, or video.
Multimodal input nests content parts one level deeper than plain text. input is a list. Each item is a string or a list of content parts.

Transcriptions

Models accept audio, including a video’s audio track.

Listing Models

Each model adds input and output pricing, modality support, and supported methods beyond the OpenAI fields.

System One

client.gateway.systemone answers typed questions about text, JSON, images and PDFs on POST /typesafe/v1/systemone, returning a calibrated probability for every answer. It uses the client’s API key and the gateway base URL, so no extra package or configuration is needed.
Questions are a list with an id on each, or a mapping of id to question. options (choice) and levels (score) are the friendly spellings of the wire’s criteria, and a noul’s criteria accepts yes/no for true/false. A malformed spec throws InputError before anything is sent.

Media

Attach up to 8 images (local paths, http(s) URLs or data URLs) and one PDF. Images are always inlined as base64 data URLs and checked by magic bytes (JPEG, PNG, WebP, GIF; 5 MB each). Remote images are fetched by the SDK, which refuses hosts that resolve to private or loopback addresses unless VLMRUN_ALLOW_PRIVATE_URLS=1 is set. A remote PDF is passed by URL for the gateway to fetch.
buildRequest() returns the exact body decide() would send, without sending it. models() lists the models the route serves.

Streams

For a series of inputs (video frames, a camera, a queue) with the same questions, open a stream. map() overlaps up to concurrency reads and yields results in input order; send() reads one input at a time.
Inputs may be { frame, index, timestampS } objects to keep a timeline. Streams run over HTTP by default. Pass transport: "ws" to pipeline the reads over one WebSocket session; this needs the optional ws package (npm install ws).

Health Check

health() returns true when the gateway is reachable and authenticated.

Configuration

The default gateway URL is https://gateway.vlm.run/v1. Override it with VLMRUN_GATEWAY_URL.
System One derives its /typesafe root from the gateway URL (https://gateway.vlm.run/typesafe); set TYPESAFE_BASE_URL to point it elsewhere. Multi-page PDF OCR often exceeds the client timeout default of 120s. The gateway timeout floor is 600s. An explicit timeout other than the default is used as-is.

SDK Reference

Gateway documentation lists the model catalog. Methods. Multimodal input. Python equivalent.