Estimate the cost of decisions
Counts customer input using the pinned billing tokenizer and resolves the current model and fallback price. Reserves no credit and runs no model. Estimates consume their own account token budget; the execution policy and available balance are checked again when the request is submitted.
curl --request POST \
--url https://api.sqwish.ai/v1/decide/estimate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"decisions": [
{
"id": "<string>",
"question": "<string>",
"kind": "single",
"outcomes": "<unknown>",
"rubric": [
"<unknown>"
],
"policy": {
"action_costs": {},
"abstain_below": 0.5
}
}
],
"model": "<string>",
"context": "",
"images": [
{
"id": 32,
"data": "<string>"
}
],
"temperature": 2.6
}
'import requests
url = "https://api.sqwish.ai/v1/decide/estimate"
payload = {
"decisions": [
{
"id": "<string>",
"question": "<string>",
"kind": "single",
"outcomes": "<unknown>",
"rubric": ["<unknown>"],
"policy": {
"action_costs": {},
"abstain_below": 0.5
}
}
],
"model": "<string>",
"context": "",
"images": [
{
"id": 32,
"data": "<string>"
}
],
"temperature": 2.6
}
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({
decisions: [
{
id: '<string>',
question: '<string>',
kind: 'single',
outcomes: '<unknown>',
rubric: ['<unknown>'],
policy: {action_costs: {}, abstain_below: 0.5}
}
],
model: '<string>',
context: '',
images: [{id: 32, data: '<string>'}],
temperature: 2.6
})
};
fetch('https://api.sqwish.ai/v1/decide/estimate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"currency": "USD",
"input_tokens": 123,
"tokenizer": {
"name": "<string>",
"revision": "<string>"
},
"maximum_charge_usd": "<string>",
"models": [
{
"id": "<string>",
"quote_usd": "<string>"
}
]
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"request_id": "<string>",
"details": [
{
"path": [
"<string>"
],
"message": "<string>",
"type": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"request_id": "<string>",
"details": [
{
"path": [
"<string>"
],
"message": "<string>",
"type": "<string>"
}
]
}
}Authorizations
Create an API key in the console.
Body
1 - 128 elementsShow child attributes
Show child attributes
1 - 128Up to 8 images the decisions are about, each shown where the context says <image:id>. The context must then be a string with an anchor for each image. fat and chub (kettei-fat, kettei-chub) read images; other models refuse them with images_not_supported.
1 - 8 elementsShow child attributes
Show child attributes
auto, none The temperature T of every answer of this request: probabilities become p^(1/T), renormalised, so below 1 they are sharper and above 1 softer. The top answer never changes. Leave it out for the model's own default for each kind of decision; send 1 for the probabilities exactly as the engine scored them.
0.2 <= x <= 5curl --request POST \
--url https://api.sqwish.ai/v1/decide/estimate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"decisions": [
{
"id": "<string>",
"question": "<string>",
"kind": "single",
"outcomes": "<unknown>",
"rubric": [
"<unknown>"
],
"policy": {
"action_costs": {},
"abstain_below": 0.5
}
}
],
"model": "<string>",
"context": "",
"images": [
{
"id": 32,
"data": "<string>"
}
],
"temperature": 2.6
}
'import requests
url = "https://api.sqwish.ai/v1/decide/estimate"
payload = {
"decisions": [
{
"id": "<string>",
"question": "<string>",
"kind": "single",
"outcomes": "<unknown>",
"rubric": ["<unknown>"],
"policy": {
"action_costs": {},
"abstain_below": 0.5
}
}
],
"model": "<string>",
"context": "",
"images": [
{
"id": 32,
"data": "<string>"
}
],
"temperature": 2.6
}
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({
decisions: [
{
id: '<string>',
question: '<string>',
kind: 'single',
outcomes: '<unknown>',
rubric: ['<unknown>'],
policy: {action_costs: {}, abstain_below: 0.5}
}
],
model: '<string>',
context: '',
images: [{id: 32, data: '<string>'}],
temperature: 2.6
})
};
fetch('https://api.sqwish.ai/v1/decide/estimate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"currency": "USD",
"input_tokens": 123,
"tokenizer": {
"name": "<string>",
"revision": "<string>"
},
"maximum_charge_usd": "<string>",
"models": [
{
"id": "<string>",
"quote_usd": "<string>"
}
]
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"request_id": "<string>",
"details": [
{
"path": [
"<string>"
],
"message": "<string>",
"type": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"request_id": "<string>",
"details": [
{
"path": [
"<string>"
],
"message": "<string>",
"type": "<string>"
}
]
}
}