v1 · REST + JSON
Styrite API
Every model, over HTTPS, billed from the same credit balance as the app at a small markup. Super members also get a weekly API allowance. Create a key on the API access page, then call it from anything that speaks JSON.
Super includes free API usage. Calls spend your $0.25/day free non-Super budget first, then a $2.99 free weekly allowance (resets Monday 00:00 UTC), then credits. Without Super, calls draw from credits.
01 Authentication
Pass your key as a Bearer token. Keys start with sk-sty-, spend your account's credit balance (guard them like passwords), can each have their own lifetime spend limit, and can be revoked anytime from the API access page. A key can call the API and read your balance; it can't manage keys or make purchases. The plaintext is shown exactly once, at creation.
curl https://styrite.com/api/v1/account \
-H "Authorization: Bearer sk-sty-..."
02 Pricing
Actual tokens × per-model rate, minimum $0.01 a call - same math as the app, times a 1.2× API markup. Bigger models cost more, exactly like usage inside Styrite.
| Model | Input / 1M | Output / 1M |
|---|---|---|
| Loading live rates… | ||
03 POST /api/v1/chat
Send messages, get a reply. Stateless - no threads server-side, so include whatever history the model should see. System prompts are Styrite's own, applied automatically.
# request
curl https://styrite.com/api/v1/chat \
-H "Authorization: Bearer sk-sty-..." \
-H "Content-Type: application/json" \
-d '{"model": "coldbrew", "messages": [{"role": "user", "content": "Write a debounce in JS"}]}'
# response
{
"model": "coldbrew",
"reply": "Here's a debounce…",
"usage": { "prompt_tokens": 2140, "completion_tokens": 318, "total_tokens": 2458 },
"cost": { "charged_cents": 1, "from_free_daily_cents": 0,
"from_super_weekly_cents": 0, "from_credits_cents": 1,
"shortfall_cents": 0, "rate_multiplier": 1.2 },
"balance_cents": 499
}
Fields: model is one of the ids in the table above; messages takes user, assistant and system roles (max 100 messages, no length limit per message beyond the model's context window - blanks are dropped). Every cost is in integer US cents.
04 OpenAI compatibility
POST /api/v1/chat/completions speaks the OpenAI chat-completions dialect - point any OpenAI client at /api/v1 as its base URL and use the model identifiers above. It supports streaming (stream: true) and tool calling (tools, tool_choice, parallel_tool_calls, assistant tool_calls and tool messages), so coding agents work out of the box. temperature, top_p, stop, reasoning_effort and max_tokens / max_completion_tokens (up to 128,000) pass through. Same billing, plus cost and balance_cents extras (OpenAI clients ignore them); when streaming they arrive on the final usage chunk.
Every call is capped to what your balance can cover: if the prompt alone would cost more than you have, it's refused up front with credits_insufficient, and otherwise the reply length is limited so a call can never spend more than you have. Images in messages are replaced with a short note, since the models read text only.
# python (openai package)
from openai import OpenAI
client = OpenAI(
base_url="https://styrite.com/api/v1",
api_key="sk-sty-...",
)
resp = client.chat.completions.create(
model="coldbrew",
messages=[{"role": "user", "content": "Write a debounce in JS"}],
)
print(resp.choices[0].message.content)
# curl equivalent
curl https://styrite.com/api/v1/chat/completions \
-H "Authorization: Bearer sk-sty-..." \
-H "Content-Type: application/json" \
-d '{"model": "coldbrew", "messages": [{"role": "user", "content": "Write a debounce in JS"}]}'
05 Coding agents & editors
Styrite works in OpenCode, Pi, omp, Cursor, Cline, Hermes and any other tool that supports an OpenAI-compatible provider, with streaming and tool calling. The coding agents guide has copy-paste setup steps for each one. The short version: base URL https://styrite.com/api/v1, your sk-sty- key, and model coldbrew.
06 GET /api/v1/models
Public, no key needed. Returns the standard OpenAI model list (object: "list", data: [...]), so tools that fetch models from the base URL find them automatically, plus Styrite's own models array with live API rates - this very page renders its pricing table from it.
07 GET /api/v1/account
Your credit balance in cents and the current rate multiplier, plus, for Super members, what's left of today's free budget and this week's API allowance and when the allowance resets. Top-ups happen in the app's payment dialog; keys spend the same balance.
08 Errors
| Status | code | Meaning |
|---|---|---|
| 400 | model_unknown / messages_invalid | Bad request - the response lists valid models. |
| 400 | messages_too_large | A message or the whole conversation is over the size limits below. |
| 400 | tools_invalid / tool_choice_invalid / temperature_invalid / top_p_invalid / max_tokens_invalid / stop_invalid / reasoning_invalid | OpenAI-dialect only: a parameter is malformed - the message says which. |
| 401 | api_key_invalid | Missing, wrong, or revoked key. |
| 402 | credits_insufficient | Not enough budget: none left at all, or not enough to cover this call's prompt (the message says how much it needs). Top up, or send a shorter conversation. |
| 402 | key_limit_reached | This key hit its lifetime spend limit (everything it spent, allowances included) - raise it on the access page. |
| 403 | - | Suspended account or blocked connection. |
| 429 | - | Over 60 calls/minute on this key - slow down. |
| 429 | too_many_requests | More than 5 generations running at once on this account - wait for one to finish. |
| 502 / 504 | upstream_* | Model hiccup or timeout - not billed, retry. |
| 400 | context_length_exceeded | OpenAI-dialect only: the conversation is over that model's context window (listed as context_length by GET /api/v1/models). |
| 503 | api_unavailable | API lane not configured on this server. |
On /chat/completions, errors use the OpenAI envelope: {"error": {"message", "type", "code"}}.
09 Limits
- 60 calls/minute per key.
- 5 simultaneous generations per account (
too_many_requestspast that). - 10 active keys per account, each with an optional lifetime spend limit. A call is capped to what's left under the key's limit, so the limit is never overshot; once it's used up, calls are refused with
key_limit_reached. /chat/completions: up to 1,000 messages, 400,000 characters per message and 2,000,000 in total, per call./chat: 100 messages, with no per-message character limit beyond the model's context window.- Timeouts: two minutes per
/chatcall, ten minutes per non-streaming/chat/completionscall, and a stream closes if the model sends nothing for three minutes.
10 Data note
Several routes only serve traffic that opts into provider data collection - without the opt-in they 404 outright. API calls include that opt-in automatically (there is no way to use these prices without it), so treat anything you send through the API accordingly.