Skip to content

examples.demo_openai_video

Demo: OpenAI API - Video Analysis Shows how to use vllm-mlx with the OpenAI Python SDK for video understanding.

View the complete module source at #L1-L156.

API details

Each callable below includes its exact signature, type annotations, inputs, defaults, return contract, documented exceptions, implementation source, and parsed docstring sections when the source provides them.

examples.demo_openai_video

Demo: OpenAI API - Video Analysis

Shows how to use vllm-mlx with the OpenAI Python SDK for video understanding.

Usage
  1. Start the server with a VLM model ("video-model" is the name used in the OpenAI API): vllm-mlx serve --served-model-name video-model mlx-community/Qwen3-VL-4B-Instruct-3bit --port 8000

  2. Run this script: python examples/demo_openai_video.py

examples.demo_openai_video.client module-attribute

client = OpenAI(base_url='http://localhost:8000/v1', api_key='not-needed')

examples.demo_openai_video.video_url module-attribute

video_url = 'https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4'

examples.demo_openai_video.response module-attribute

response = client.chat.completions.create(model='video-model', messages=messages, max_tokens=100)

examples.demo_openai_video.action_video_url module-attribute

action_video_url = 'https://test-videos.co.uk/vids/jellyfish/mp4/h264/360/Jellyfish_360_10s_1MB.mp4'

examples.demo_openai_video.messages module-attribute

messages = [{'role': 'user', 'content': [{'type': 'text', 'text': 'What colors are most prominent in this video?'}, {'type': 'video_url', 'video_url': {'url': video_url}}]}]

Complete contract reference

Expand any definition for its exact inputs, annotations, defaults, return contract, directly raised exceptions, source-grounded behavior, and immutable line link. This section includes private and nested definitions that ordinary API generators omit.

This module does not declare classes or functions.

Complete symbol map

This map also includes private definitions and nested helpers. The signature column exposes every explicit input even when an internal helper has no dedicated parameter prose.

This module does not declare classes or functions.