SDKs and HTTP · Python
OpenAI Python SDK
How do I use OpenAI Python SDK with Onrup?
Point the OpenAI Python client at your deployment base URL and pass an Onrup API key. Every other line of your code stays the same — the chat completions request and response shapes are identical, including streaming.
The official Python client for the OpenAI API, and the most common way Python code talks to a language model.
Minimal working example
from openai import OpenAI
client = OpenAI(
base_url="https://serve.onrup.com/<tenant>/<deployment>/v1",
api_key="onrup_sk_...",
)
response = client.chat.completions.create(
model="default",
messages=[{"role": "user", "content": "Summarise this ticket."}],
)
print(response.choices[0].message.content)The thing that catches people out
The `model` parameter is not ignored, but it does not select a model — the deployment already determines that. Pass "default" unless you have several adapters attached to one deployment, in which case pass the adapter name.
Worth knowing
- Streaming works unchanged: pass `stream=True` and iterate the response.
- The client retries on 429 by default and honours the Retry-After header, which is the behaviour you want on a scale-to-zero endpoint.
- Set a generous timeout if the endpoint can scale to zero. A cold start is a slow first request, not a failure.
Other sdks and http
Start with the free tier
A magic link creates your account, your tenant and your first API key. No card until you ask for compute.