Skip to main content
The client.gateway object provides access to the VLM Run Gateway, an OpenAI-compatible surface for third-party OCR and vision-language models (e.g. zai-org/glm-ocr, paddleocr/pp-ocrv6, qwen/qwen3.5-0.8b). It authenticates with the same VLMRUN_API_KEY used everywhere else in the SDK. Under the hood the gateway points the OpenAI SDK at https://gateway.vlm.run/v1/openai, so client.gateway.completions, client.gateway.embeddings, and client.gateway.transcriptions are the standard OpenAI resource objects. You get the familiar chat-completions, embeddings, and audio-transcription interfaces without configuring a base URL yourself.
The gateway is a raw passthrough to the underlying models. Unlike client.agent (which calls the Orion agent), most gateway models, especially OCR models, do not accept text-only input, so you generally need at least one image_url/document_url content part.

Installation

The gateway uses the OpenAI SDK, available via the openai extra:

Chat Completions

Run an OCR / VLM model over a document or image. Pass PDFs as document_url content parts and images as image_url; gateway-specific fields (such as method and document_dpi) travel in extra_body.

Visual Q&A

Models that accept text input (e.g. qwen/qwen3.5-0.8b) can take a text content part alongside an image:

Streaming

The gateway streams document (PDF) requests one SSE chunk per page:
An async client is available via client.gateway.async_completions.

Embeddings

Embed text, images, or video with a gateway embedding model (e.g. qwen/qwen3-vl-embedding-2b).
Multimodal input nests content parts one level deeper than plain text: input is a list whose items are either a string or a list of content parts.

Transcriptions

Transcribe audio (or a video’s audio track) with a gateway transcription model (e.g. nvidia/parakeet-tdt-0.6b-v3):

Listing Models

List the models available on the gateway. Each model carries extra metadata (input/output pricing, modality support, supported methods) beyond the standard OpenAI fields, preserved on the object’s model_extra.

Health Check

Check whether the gateway is reachable and authenticated:

Configuration

By default the gateway targets https://gateway.vlm.run/v1. Override it with the VLMRUN_GATEWAY_URL environment variable:

SDK Reference

See the Gateway documentation for the full model catalog, methods, and multimodal input reference, and the vlmrun gw CLI for the terminal equivalent.