OpenAI SDK
SDKs & frameworksThe official OpenAI libraries work unchanged: set base_url and the key.
Fill the guide with your values
Stays in this browser tab — never sent or stored by us. Sign in to create one
Setup
- 1Install the SDK for your language.
- 2Create the client with base URL
https://api.ultragpt.pro/v1and your UltraGPT key.
# pip install openai
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.ultragpt.pro/v1", api_key=os.environ["ULTRAGPT_API_KEY"])
res = client.chat.completions.create(
model="grok-4.7",
messages=[{"role": "user", "content": "Hello!"}],
)
print(res.choices[0].message.content)Tips
- Any model id from Models works; suffixes like :online (web search) and :nitro work too.
- Give each tool its own key with a spend limit, so usage shows separately in Activity.
- Something off? Error codes · Support