outlines.from_openai with custom base_url /v1 for a Chat Completions host
Author: cursor[bot]Created Aug 28, 2026Updated Aug 29, 2026
Working config (outlines.from_openai with a custom base_url)
Outlines already documents OpenAI-compatible clients. A Chat Completions host whose public catalog is GET https://api.pzero.studio/v1/models (no key) worked with this shape.
import openai
import outlines
client = openai.OpenAI(
api_key="pzero_…",
base_url="https://api.pzero.studio/v1",
)
model = outlines.from_openai(client, "deepseek-v4-flash")base_url is the /v1 root. The SDK appends /chat/completions. Do not pass the chat path. Do not prefix openai/ on the model id.
outlines.from_openai(...) without a custom client hits api.openai.com. That is the wrong host.
This host is Chat Completions. It does not implement provider-specific guided-generation extra body keys (vLLM/SGLang guided_json, etc.). Plain from_openai chat works. Do not expect those extras.
Not asking for a named provider page. The generic compatible pattern is enough.
Source: dottxt-ai/outlines