Skip to main content
client.gateway is an OpenAI-compatible surface for third-party OCR and vision-language models. Models include zai-org/glm-ocr, paddleocr/pp-ocrv6, and qwen/qwen3.5-0.8b. 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 is a raw passthrough to the underlying models. Unlike client.agent, most gateway models, especially OCR models, do not accept text-only input. You generally need at least one image_url or document_url content part.

Installation

The openai extra installs the OpenAI SDK:

Chat Completions

Pass PDFs as document_url content parts. Pass images as image_url. Gateway fields such as method and document_dpi go in extra_body.

Visual Q&A

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

Streaming

Document (PDF) requests stream one SSE chunk per page.
Async chat completions use client.gateway.async_completions.

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 or a video’s audio track.

Listing Models

Each model stores extra metadata on model_extra, outside the standard OpenAI fields:
  • input and output pricing
  • modality support
  • supported methods

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 drives the official typesafe-sdk client, available via the typesafe extra:
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 criteria. decide() also takes model, detail, steps, samples, reasoning_effort, timeout, extra_body and extra_headers. build_request() returns the body without sending it, and models() lists the models the route serves. For a series of inputs, stream() reads many decisions against one question spec and yields them in input order. Pass transport="ws" (pip install "vlmrun[ws]") to pipeline the reads over one WebSocket session. VideoReader needs the video extra (pip install "vlmrun[video]"):

Health Check

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

Configuration

By default the gateway targets https://gateway.vlm.run/v1. Override it with the VLMRUN_GATEWAY_BASE_URL environment variable. The older VLMRUN_GATEWAY_URL is still honoured when VLMRUN_GATEWAY_BASE_URL is unset:
System One derives its /typesafe root from the gateway URL; set TYPESAFE_BASE_URL to point it elsewhere.

SDK Reference

Model catalog: Gateway documentation. Methods and multimodal input. CLI: vlmrun gw. The Node.js SDK exposes the same surface.