Quickstart
Create an account, make a key with a spend cap, and send your first request. Steerwise speaks the OpenAI API, so any OpenAI SDK works once you change the base URL.
Create an account
Create an account and choose where you are. Accounts in India get a wallet in rupees and GST invoices; other accounts get a wallet in US dollars. Top up the wallet with the payment methods shown at checkout: every request is paid from it.
Create a key with a cap
In the Console, open API keys and create a key.
- Name it after what uses it, for example “CI” or “billing-service”.
- Optionally limit its allowed models. To use
autowith a limited key, check Auto too. - Give it spend caps in the Console under Spend caps. At a cap, requests on the key are refused, not billed.
Keys start with sw_live_. Put yours in an environment variable:
export STEERWISE_API_KEY="YOUR_API_KEY"Send your first request
Send "model": "auto" and Steerwise picks a model your plan and key can use for each call: a light one for small requests, a stronger one for hard ones. You can also name a model: any id from GET /v1/models.
curl https://api.steerwise.s3techpulse.com/v1/chat/completions \
-H "Authorization: Bearer $STEERWISE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "auto",
"messages": [
{ "role": "user", "content": "Write a haiku about rate limits." }
]
}' import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.steerwise.s3techpulse.com/v1",
api_key=os.environ["STEERWISE_API_KEY"],
)
resp = client.chat.completions.create(
model="auto",
messages=[{"role": "user", "content": "Write a haiku about rate limits."}],
)
print(resp.model, resp.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.steerwise.s3techpulse.com/v1",
apiKey: process.env.STEERWISE_API_KEY,
});
const resp = await client.chat.completions.create({
model: "auto",
messages: [{ role: "user", content: "Write a haiku about rate limits." }],
});
console.log(resp.model, resp.choices[0].message.content);Read the response
The reply has the usual OpenAI shape. model names the model that served the call, which matters when you sent auto.
{
"id": "chatcmpl-<x-request-id>",
"object": "chat.completion",
"created": <unix time>,
"model": "<the model that served the call>",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "<the reply>", "refusal": null },
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": <n>,
"completion_tokens": <n>,
"total_tokens": <n>,
"prompt_tokens_details": { "cached_tokens": <n> },
"completion_tokens_details": { "reasoning_tokens": <n> }
},
"system_fingerprint": null
}- model: the model used. With
autoit can differ from one request to the next, and the response carriesx-steerwise-routed-from: auto. - usage: the tokens billed for this request. The cost shows in the Console under Usage.
- Each request is paid from your wallet and counted against the key’s caps.