Skip to main content
Use the OpenAI Python SDK with VLM Run Agents. Set the client base URL and API key.
VLM Agents are fully compatible with the OpenAI API. They also accept multi-modal data types OpenAI does not support. Endpoint: https://api.vlm.run/v1/openai.
Create the key on the API Keys page.

OpenAI Client Configuration

Or set these environment variables:

Usage 1: Basic Chat Completion

On client.chat.completions.create, pass domain and request metadata in extra_body.

Usage 2: Chat Completion with Structured Outputs

Usage 3: Basic Chat Completion with Streaming

Usage 4: Mixed-Modality Inputs

Extra Body

extra_body.vlmrun holds request metadata outside the OpenAI SDK. Examples include allow_training and environment.

Request Metadata

Send these fields in extra_body.vlmrun.metadata.

Token Usage

Each response includes usage statistics. See VLM Run Pricing.

Compatibility Differences

  • messages can include input_file objects {"type": "input_file", "file_id": "<file_id>"}. file_id is the id of a file uploaded to the VLM Run Agents API. Use this for large files such as videos and images.
  • max_tokens on chat.completions.create is not respected. If the output exceeds the limit, the server still returns the full output.
  • logprobs, logit_bias, top_logprobs, presence_penalty, frequency_penalty, n, stream, stop are not supported.