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 embedding APIs for embedding models. For a list of the supported models see the corresponding overview page

Launch A Server

Launch the server in your terminal and wait for it to initialize. Remember to add --is-embedding to the command.
Example

Using cURL

Example

Using Python Requests

Example

Using OpenAI Python Client

Example

Using Input IDs

SGLang also supports input_ids as input to get the embedding.
Example
Example

Multi-Modal Embedding Model

Please refer to Multi-Modal Embedding Model