API reference · Credits
Buy a price lock
POST/api/account/price-locksSigned in session
Moves amountMicros from the balance into a new lock on the model and charges the premium beside it, in one transaction. 403 `price_locks_off` while the operator has not offered locks, and 403 `holder_only` on a deployment with $ANTI holder tiers when the signed in wallet does not hold the lowest tier (a lock already bought is honoured); 400 `model_not_lockable` for an autopilot, a router, an alias, a free or unpriced model; 402 `not_funded` before a first deposit and `insufficient_credits` when the balance cannot cover the credit and the premium; 409 `price_lock_exists` for a second open lock on one model, `price_lock_limit` past 20 open locks, and `price_lock_capacity` when the operator's exposure cap has no room. Same origin only.
Request body
application/json, required
| Field | Type | What it is |
|---|---|---|
| modelrequired | string | The model id to lock. |
| amountMicrosrequired | integer | Credit to lock, in micro dollars: whole cents. |
| daysrequired | integer | Whole days, 1 to the offer's maxDays. |
Example
{
"model": "antimatter/auto",
"amountMicros": 0,
"days": 0
}Answer 201
The lock, as bought.
| Field | Type | What it is |
|---|---|---|
| lockrequired | object | |
| lock. | integer | |
| lock. | string | |
| lock. | object | The billed rates frozen on the day the lock was bought. |
| lock. | number | USD per 1M input tokens. |
| lock. | number | USD per 1M output tokens. |
| lock. | number or null | Null when none was published; cached input then bills at the input rate. |
| lock. | number or null | |
| lock. | integer | The prepaid credit moved into the lock. |
| lock. | integer | |
| lock. | integer | Charged once at purchase as its own ledger line; never refunded. |
| lock. | integer | |
| lock. | string | One of "open", "expired". |
| lock. | integer | |
| lock. | integer | |
| lock. | integer or null | |
| lock. | integer or null | What went back to the balance at expiry. |
| lock. | integer | What the lock can still spend, open holds taken off. |
| lock. | integer | Held for requests in flight. |
| lock. | integer | Spent by requests the lock paid for. |
| lock. | object or null | The model's billed card today, for an open lock; null when it is not priced now. |
| lock. | number | USD per 1M input tokens. |
| lock. | number | USD per 1M output tokens. |
| lock. | number or null | Null when none was published; cached input then bills at the input rate. |
| lock. | number or null |
Errors
- 400OpenAI shaped error.
- 401OpenAI shaped error.
- 402OpenAI shaped error.
- 403OpenAI shaped error.
- 404OpenAI shaped error.
- 409OpenAI shaped error.
- 429OpenAI shaped error.
Every error answers in one shape, with its type, code and the field it names. The whole list is in the docs' Errors section.