Resellers
Reseller API
Sell our models to your own customers: one key each, with a credit you set, all paid from your balance.
A reseller account is an ordinary account with a few extras. Ask us on Telegram (@unaligned_support): we turn your account into a reseller account by hand and give it dedicated capacity. There is no subscription and no fee: tokens cost the same as on the pricing page, and you set your own prices on top.
How it works
- 01 Top up your balance as usual, in crypto. Everything your customers use comes off it.
- 02 Create a management key in Dashboard → Reseller. It only manages your customers’ keys: it can’t call a model.
- 03 From your own site or bot, create one API key per customer with the management key, with a credit: what that key may spend in all, in USD, $2 at least.
- 04 Give the key to your customer. They use it like any Unaligned key, with any of the three formats. Once its credit is spent, it gets a
402until you add more.
Your customers never see your balance or your usage. With their key, GET /v1/balance returns what their own credit has left, and GET /v1/usage/keys their key only.
Limits
- Up to 200 customer keys per reseller account.
- Each customer key runs 16 requests at once and starts 60 a minute at most. Going over returns a
429with aRetry-Afterheader. - Your account’s own limits (
atOnce,perMinutebelow) hold for all your customers’ keys together. - Your own API keys and the site’s chat keep a regular account’s limits, counted apart: they never use up your customers’ capacity, nor theirs yours. All of it is paid from the same balance.
- A key’s credit is $2 at least.
Authentication
Every route below takes your management key (rk-unal-…) as Authorization: Bearer … or x-api-key: …. Amounts are in USD, like /v1/balance. Keep the key on your server: anyone holding it can create keys that spend your balance. Replace or revoke it from the dashboard at any time.
Your account
GET /v1/reseller
curl https://api.unaligned.pw/v1/reseller -H "Authorization: Bearer $UNALIGNED_MANAGE_KEY"atOnce and perMinute are your limits for all your customers together. Ask us on Telegram for more capacity.
Create a key
POST /v1/reseller/keys
namestring required- Your own reference for the customer, 1 to 100 characters: an order or user ID.
creditnumber required- USD the key may spend in all, from 2 to 1,000,000.
curl https://api.unaligned.pw/v1/reseller/keys \
-H "Authorization: Bearer $UNALIGNED_MANAGE_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "order-1042", "credit": 10 }'secret is the customer’s key, returned this once only: we keep a hash of it. Send it to your customer right away.
Add credit
POST /v1/reseller/keys/{id}/credit
amountnumber required- USD added to the key’s credit at once. Negative takes some back, never below $2.
curl https://api.unaligned.pw/v1/reseller/keys/$KEY_ID/credit \
-H "Authorization: Bearer $UNALIGNED_MANAGE_KEY" \
-H "Content-Type: application/json" \
-d '{ "amount": 5 }'Returns the key, like every route below.
Change a key
PATCH /v1/reseller/keys/{id}
namestring- A new reference.
creditnumber- The credit as a whole, in USD, $2 at least.
disabledbooleantruerefuses the key like a revoked one, until set back tofalse.
Only the fields you send change. An unknown field is refused with a 400, so a typo never goes unnoticed.
List, read, delete
| Route | What it does |
|---|---|
GET /v1/reseller/keys | Every customer key, newest first. |
GET /v1/reseller/keys/{id} | One key: its credit, spent and remaining. |
GET /v1/reseller/keys/{id}/usage?days=30 | Its days: requests, tokens and cost (USD), newest first. |
DELETE /v1/reseller/keys/{id} | Deletes the key: it stops working at once. |
Example
A customer pays you for $20 of usage: your server creates their key, then tops it up when they pay again.
const api = (path, body, method = "POST") =>
fetch("https://api.unaligned.pw/v1" + path, {
method,
headers: {
Authorization: "Bearer " + process.env.UNALIGNED_MANAGE_KEY,
"Content-Type": "application/json"
},
body: body && JSON.stringify(body)
}).then((r) => r.json());
// A new customer: their key, with $20 to spend.
const { key, secret } = await api("/reseller/keys", { name: "user-581", credit: 20 });
// Store key.id with the customer; send them `secret`.
// They paid again: $20 more.
await api(`/reseller/keys/${key.id}/credit`, { amount: 20 });Errors
| Status | code | Why |
|---|---|---|
400 | invalid_input | A field is missing, mistyped or out of range (a credit under $2). |
400 | limit_reached | You have 200 customer keys already: delete one first. |
401 | unauthorized | Missing or wrong management key. |
403 | forbidden | Your reseller access was stopped: ask us on Telegram. Your customers’ keys keep working. |
404 | not_found | No such key on your account, or the account isn’t a reseller. |
Your customers get the usual errors: a 402 insufficient_balance when their credit is spent, or when your own balance is, and a 429 past their key’s limits.