GUIDES

Switch from OpenAI in Python

One line changes: the base URL. Keys come from the console; model ids are the public names on each model page.

01

Install the SDK

pip install openai
02

Point base_url at the router

from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:3000/v1",
    api_key="<your api key>",
)
03

Call any model by id

resp = client.chat.completions.create(
    model="openai/gpt-oss-120b@groq",
    messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)

// snippet uses the local console URL; set it to your deployment's console host in production