Skip to main content
Use your API Key to look up the charge for each call, and the actual price your account pays for a model. None of the three endpoints check the balance; they work even when the balance is 0.

Authentication

string
required
Use the same API Key you use to call models, with Bearer Token authentication. Get your key on the API Key management page.

Endpoints

Amounts are in USD; cost_credits and credits are in credits, equal to USD × 10.

Look up a single record by request ID

string
required
  • Synchronous calls: the value of the X-Oneapi-Request-Id response header
  • Asynchronous tasks: the task ID returned on submission
Logs are written asynchronously and usually appear within a few seconds after the request ends. If you get 404 log_not_found, retry later. Asynchronous tasks must be looked up by task ID, and only have a record once the task has completed or failed.
The lookup covers the whole account that owns the API Key. data is an array; the same ID may have both a consume record and an error record. Main fields: cost_usd is the final settled amount: error records are always 0, and refunds for failures are completed before the record is written. Summing records whose type is consume gives the total charged for your calls.

Sync Request Logs

Page through every record in your account over a time range — ideal for scheduled reconciliation. Each record has the same fields as the single-record lookup.
integer
required
Start time, Unix timestamp in seconds.
integer
End time, Unix timestamp in seconds. Defaults to now. Both ends are inclusive, and the range must not exceed 31 days.
string
default:"all"
Record type: all, consume, or error.
string
Filter by model name.
integer
Only return records of the given API Key. Copy the ID from the “API Keys” list in the console (shown below the key name); the ID stays the same after the key is rotated.
integer
default:"100"
Page size, 1–1000.
string
Pagination cursor. Pass back the previous page’s next_cursor unchanged, and keep all other parameters the same while paging.
In the response, has_more tells you whether there is another page, next_cursor is the cursor for the next page, and watermark is the server time minus 300 seconds.
Recommended sync pattern: keep each run’s end_timestamp no later than watermark; start the next run 10 minutes before the previous run’s end and dedupe by (id, type); within one time window, keep paging until has_more is false.

Get account pricing

Get the actual price the account that owns the current API Key pays for a model. Custom pricing, membership pricing, group ratio, and discounts are all applied, matching what you are charged when calling. The pricing page shows public prices; use this endpoint to estimate costs for your own account.
string
required
Model name; aliases are supported.
string
Resolution or tier; must be a tier the model supports.
string
Image size.
string
Quality tier.
integer
Duration in seconds, 1–3600, for per-second models.
integer
Number of outputs, 1–100.
Without spec parameters, the model’s default spec is quoted. For per-second models, only the per-second price is returned when duration is omitted. Main response fields: Up to 60 requests per minute per API Key.

Errors