AI cost against credits settled
const url = 'https://api.sloose.com/ai/admin/margin?creditMicroUsd=2000';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://api.sloose.com/ai/admin/margin?creditMicroUsd=2000' \ --header 'Authorization: Bearer <token>'Backoffice route: a staff session, or ADMIN_TOKEN. What each feature cost us in provider spend against the credits we charged for it. Pass creditMicroUsd to price a credit and get revenue and margin columns; without it those come back null rather than guessed.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”ISO start of the range. Defaults to the start of this month.
ISO start of the range. Defaults to the start of this month.
ISO end of the range, exclusive.
ISO end of the range, exclusive.
What one credit sells for, in millionths of a USD.
Example
2000What one credit sells for, in millionths of a USD.
Responses
Section titled “Responses”Cost and margin by feature.
object
object
object
Examplegenerated
{ "from": "example", "to": "example", "creditMicroUsd": 1, "totals": { "calls": 1, "costMicroUsd": 1, "creditsSettled": 1 }, "rows": [ { "additionalProperty": "example" } ]}from or to is not an ISO date.
object
Example
{ "code": "BAD_INPUT"}A bearer that is neither the token nor a live session (code: AUTH_REQUIRED).
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}A customer’s session, an API token, or no bearer at all — not staff, and not the ADMIN_TOKEN (code: ADMIN_REQUIRED).
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}