Python
import os
from openai import OpenAI
client = OpenAI( # api_key: your app's own, unchanged
base_url="https://gateway.os3compute.com/v1",
default_headers={"x-os3-key": os.environ["OS3_GATEWAY_KEY"]},
)
reply = client.chat.completions.create(
model="<your model>",
messages=[{"role": "user", "content": "Hello"}],
extra_headers={"x-os3-subject": "user-123"}, # optional
)
| Base URL | OpenAI SDK: https://gateway.os3compute.com/v1. Anthropic SDK: https://gateway.os3compute.com. |
| Goes to | The SDK’s own API. Another of that shape: its base URL after /p/, as https://gateway.os3compute.com/p/api.example.com/v1. |
x-os3-key | Gateway key |
x-os3-subject | End user’s id; not passed on. A trained model’s share keeps each user on one side. |
| No code change | /k/<url-key> after the host: https://gateway.os3compute.com/k/<url-key>/v1. URL key: secret, shown once beside a new gateway key. |
| Paths | /v1/chat/completions, /v1/responses, /v1/embeddings, /v1/messages; streams too |
| Cost | None from OS3. Your key pays its API as before. |
| Limits | Per key |
| Errors | The API’s own, passed on. OS3’s. |
| Request id | x-os3-request-id response header |