Skip to main content
SGLang provides OpenAI-compatible APIs to enable a smooth transition from OpenAI services to self-hosted local models. A complete reference for the API is available in the OpenAI API Reference. This tutorial covers the vision APIs for vision language models. SGLang supports various vision language models such as Llama 3.2, LLaVA-OneVision, Qwen2.5-VL, Gemma3 and more. As an alternative to the OpenAI API, you can also use the SGLang offline engine.

Launch A Server

Launch the server in your terminal and wait for it to initialize.
Example

Using cURL

Once the server is up, you can send test requests using curl or requests.
Example

Using Python Requests

Example

Using OpenAI Python Client

Example

Multiple-Image Inputs

The server also supports multiple images and interleaved text and images if the model supports it.
Example
Example