Estimate Request Costs
curl --request POST \
--url https://www.ninjachat.ai/api/v1/estimate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"group": "chat",
"model": "gpt-5",
"count": 10
},
{
"group": "images",
"model": "flux-2-klein",
"count": 5
}
]
}
'import requests
url = "https://www.ninjachat.ai/api/v1/estimate"
payload = { "items": [
{
"group": "chat",
"model": "gpt-5",
"count": 10
},
{
"group": "images",
"model": "flux-2-klein",
"count": 5
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
items: [
{group: 'chat', model: 'gpt-5', count: 10},
{group: 'images', model: 'flux-2-klein', count: 5}
]
})
};
fetch('https://www.ninjachat.ai/api/v1/estimate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"items": [
{
"group": "<string>",
"model": "<string>",
"count": 123,
"estimated_cost": "$0.060"
}
],
"total": "$0.090"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
},
"message": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
},
"message": "<string>",
"code": "<string>",
"request_id": "<string>"
}Power Features
Estimate Request Costs
Estimate the cost of one or more planned API requests before sending them. Useful for budgeting and showing users a price quote.
POST
/
api
/
v1
/
estimate
Estimate Request Costs
curl --request POST \
--url https://www.ninjachat.ai/api/v1/estimate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"group": "chat",
"model": "gpt-5",
"count": 10
},
{
"group": "images",
"model": "flux-2-klein",
"count": 5
}
]
}
'import requests
url = "https://www.ninjachat.ai/api/v1/estimate"
payload = { "items": [
{
"group": "chat",
"model": "gpt-5",
"count": 10
},
{
"group": "images",
"model": "flux-2-klein",
"count": 5
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
items: [
{group: 'chat', model: 'gpt-5', count: 10},
{group: 'images', model: 'flux-2-klein', count: 5}
]
})
};
fetch('https://www.ninjachat.ai/api/v1/estimate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"items": [
{
"group": "<string>",
"model": "<string>",
"count": 123,
"estimated_cost": "$0.060"
}
],
"total": "$0.090"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
},
"message": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
},
"message": "<string>",
"code": "<string>",
"request_id": "<string>"
}Authorizations
API key starting with nj_sk_
Body
application/json
Planned request shapes to estimate.
Required array length:
1 - 100 elementsShow child attributes
Show child attributes
⌘I