Model gateway
Budgets and usage
Cap spend per key, limit request rates, and read the usage report.
How you're billed
Scalaix is pay as you go, with no monthly minimum and no plan to pick. You buy credits in the console under Billing, in the account menu at the bottom left (in whole dollars, with a saved card) and requests are charged from your team's balance.
- Price. A request is charged at the provider's price for its input and output tokens plus a 25% margin. Pricing lists every model's price per million tokens with the margin included. Credits are shown in the console at their USD value.
- Cached answers aren't charged.
- Your own provider keys (BYOK). Requests that run on your team's own provider key aren't charged by Scalaix; the provider bills you directly.
When the team runs out of credits, requests fail with 402 insufficient_quota until you buy more. Credits belong to the team and are shared with Axyen: if the team also has an Axyen plan, that plan is managed in Axyen and the credits work the same way here.
Monthly budgets per key
Set budget_usd_monthly on a key to cap what it can spend in a calendar month (UTC), in billed USD:
{ "budget_usd_monthly": 50 }Budgets are enforced with a reservation, so concurrent requests can't overshoot: each request first reserves its worst case (the priciest model in its fallback chain at the request's max_tokens, or at the model's maximum output when max_tokens isn't set), then settles to the real cost when it ends.
Once the key has spent its budget, its requests get 402 insufficient_quota until the next month starts. Other keys in the project keep working. The Keys page shows each key's spend this month.
On small budgets, set max_tokens. Near the end of a budget, a request without max_tokens reserves the model's full output limit and can get a 402 even though a short answer would fit. Published endpoints use the max_tokens in their definition.
Rate limits
rpm limits a key to that many requests per minute. Requests over the limit get 429 rate_limited with a Retry-After header in seconds.
import time
from openai import OpenAI, RateLimitError
client = OpenAI(base_url="https://www.scalaix.com/v1", api_key="sx_...")
for attempt in range(5):
try:
reply = client.chat.completions.create(model="gpt-4o-mini", messages=[{"role": "user", "content": "Hi"}])
break
except RateLimitError as e:
time.sleep(int(e.response.headers.get("retry-after", "1")))The OpenAI SDKs already retry 429 responses a few times on their own.
The usage report
Usage in a project shows, for any date range:
- totals: requests, errors, cache hits, input and output tokens, billed cost and average latency;
- requests and cost by day;
- breakdowns by key, by model (the model that answered) and by endpoint (
collection/endpoint); - the request log: time, key, kind (
chat,endpoint,testorassist), model requested and served, tokens, cost, latency, cache and fallbacks, status and error code.
Cost in the report is the billed amount. Console test runs appear with kind test and no key; drafting an endpoint from a description appears with kind assist (shown as Drafting) and no key.
An endpoint run that used both the platform's provider keys and your team's own (for example a fallback to a provider you bring your own key for) appears as two rows in the log: the platform part under the request id (req_…) and your own-key part under the same id with -b appended. Only the first is billed in credits. When a stream ends before the provider reports usage, the token counts are the gateway's estimate.