gpuosBeta

Integration · SDK

Use the OpenAI Python SDK with a self-hosted LLM

Use the official openai package with your own GPUs by changing the base URL and the key.

Base URL
https://gpuos.si/v1
API key
gpuos_key_… from the dashboard
Model
a catalog id, e.g. qwen3-32b

Point the client at gpuos

Use the official openai package for gpuos's supported chat completions, completions and embeddings endpoints. Set base_url to your gpuos endpoint, use a workspace key and a deployed model id, and test any model-specific features your app needs.

Install
pip install openai
Chat completion
import os
from openai import OpenAI

client = OpenAI(base_url="https://gpuos.si/v1", api_key=os.environ["GPUOS_API_KEY"])

reply = client.chat.completions.create(
    model="qwen3-32b",
    messages=[{"role": "user", "content": "Write a haiku about GPUs."}],
)
print(reply.choices[0].message.content)

Create the key in API keys and deploy the model first in Models. GET /v1/models lists deployed models. gpuos supports chat completions, completions, embeddings and streaming; other OpenAI operations need separate support. Qwen3 32B requires Pro; use qwen3-8b to start on Community.

Streaming and embeddings

Python
stream = client.chat.completions.create(
    model="qwen3-32b",
    messages=[{"role": "user", "content": "Explain VRAM in two sentences."}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")

vectors = client.embeddings.create(model="bge-m3", input=["first text", "second text"])

Errors come back in the OpenAI format, so openai.RateLimitError, openai.AuthenticationError and openai.PermissionDeniedError behave as usual. A quota or rate limit set on the key returns a 429.

Official documentation: github.com/openai/openai-python

Questions

Do I need a different SDK for gpuos?
Use the official OpenAI Python SDK for supported chat completions, completions and embeddings. Configure base_url, api_key and the deployed model id. The gateway does not expose every OpenAI API operation.
Can I set OPENAI_BASE_URL instead?
Yes. The SDK reads OPENAI_BASE_URL and OPENAI_API_KEY, so exporting OPENAI_BASE_URL=https://gpuos.si/v1 and your gpuos key as OPENAI_API_KEY works without code changes.

Related

Use OpenAI Python SDK with models on your GPUs

Free for one GPU. Connect a machine, deploy a model, then paste the base URL and your key.