Inference Inference quickstart
Inference quickstart
Call open-weight models through an OpenAI-compatible API. If your app already uses the OpenAI SDK, change the base URL and model name and you're done.
Package names, hosts and environment variables such as rsi and RSI_API_KEY are placeholders
until the SDK ships.
Choose a model
Pick a model ID from Models and pricing. Use the model ID from that table, for example Qwen3.8-27B.
Send a request
Authenticate with your API key as a bearer token.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.rsi-labs.ai/v1",
api_key=os.environ["RSI_API_KEY"],
)
resp = client.chat.completions.create(
model="Qwen3.8-27B",
messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)Stream responses
Set stream=True to receive tokens as they are generated.
stream = client.chat.completions.create(
model="Qwen3.8-27B",
messages=[{"role": "user", "content": "Write a haiku."}],
stream=True,
)
for chunk in stream:
if chunk.choices:
print(chunk.choices[0].delta.content or "", end="")Use tools
Pass tool definitions in the OpenAI format. The model returns tool calls for your code to run.
tools = [{
"type": "function",
"function": {
"name": "get_order_status",
"parameters": {"type": "object", "properties": {"order_id": {"type": "string"}}},
},
}]
resp = client.chat.completions.create(model="Qwen3.8-27B", messages=messages, tools=tools)Limits and errors
- Requests over your rate limit return
429. Retry with exponential backoff. - Requests longer than a model's context window are rejected; see the context column in Models and pricing.
- Limits depend on your plan and are shown in the Console.