SUPREME Setu API — Early Access
The SUPREME Setu OpenAI-compatible endpoints preview the upcoming public release. Want early access or custom organizational quota limits? Contact our solutions engineering team.
Python Client SDK
Integrate Setu into your Python applications with full async streaming, type safety, and automatic retry support using the standard openai package.
Installation
bash
pip install openaiBasic Completion
python
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("SUPREME_API_KEY"),
base_url="https://supremeai.services/api/setu/v1"
)
response = client.chat.completions.create(
model="quantum-lite",
messages=[
{"role": "system", "content": "You are a bilingual tutor in Nepali and English."},
{"role": "user", "content": "Explain gravity in one concise sentence."}
],
temperature=0.7
)
print(response.choices[0].message.content)Real-Time Token Streaming
python
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("SUPREME_API_KEY"),
base_url="https://supremeai.services/api/setu/v1"
)
stream = client.chat.completions.create(
model="quantum-lite",
messages=[
{"role": "user", "content": "Write a short poem about the Himalayas."}
],
stream=True
)
for chunk in stream:
if chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="", flush=True)
print()Async Streaming with AsyncOpenAI
python
import asyncio
import os
from openai import AsyncOpenAI
async def main():
client = AsyncOpenAI(
api_key=os.environ.get("SUPREME_API_KEY"),
base_url="https://supremeai.services/api/setu/v1"
)
response = await client.chat.completions.create(
model="quantum-flash",
messages=[{"role": "user", "content": "Summarize the history of Kathmandu."}],
stream=True
)
async for chunk in response:
delta = chunk.choices[0].delta.content
if delta:
print(delta, end="", flush=True)
if __name__ == "__main__":
asyncio.run(main())