Skip to content

AI cost against credits settled

GET
/ai/admin/margin
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.

from

ISO start of the range. Defaults to the start of this month.

string

ISO start of the range. Defaults to the start of this month.

to

ISO end of the range, exclusive.

string

ISO end of the range, exclusive.

creditMicroUsd

What one credit sells for, in millionths of a USD.

string
Example
2000

What one credit sells for, in millionths of a USD.

Cost and margin by feature.

Media typeapplication/json
object
from
required
string
to
required
string
creditMicroUsd
required
number | null
totals
required
object
calls
required
number
costMicroUsd
required
number
creditsSettled
required
number
rows
required
Array<object>
object
key
additional properties
key
additional properties
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.

Media typeapplication/json
object
error
required
string
code
required
string
Allowed values: BAD_INPUT
key
additional properties
Example
{
"code": "BAD_INPUT"
}

A bearer that is neither the token nor a live session (code: AUTH_REQUIRED).

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
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).

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}