Docs pages

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 auto with 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.
The key is shown onceCopy it when it appears and keep it in a secret store. Steerwise keeps only a hash, so a lost key cannot be shown again: revoke it and create a new one.

Keys start with sw_live_. Put yours in an environment variable:

bash
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.

Code samples in
bashpythonjavascript
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);
Got 402 insufficient_balance?Your wallet cannot cover the request. Top up in the Console under Wallet and send it again. Every other code is on Errors and limits.

Read the response

The reply has the usual OpenAI shape. model names the model that served the call, which matters when you sent auto.

Example response (json, 200)
{
  "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 auto it can differ from one request to the next, and the response carries x-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.

Next steps