Keep a model warm
Keep a model loaded between requests on its own, by its number such as router@4, or
stop. Its own switch must be on: 409 model_off otherwise, and switching it off stops
keep warm too. Switching on loads and probes it first, then holds its first hour, at
most max_price_usd. A model kept warm through its family as well takes one warm place
and is billed once. switch_off stops keep warm on families or models in the same
step and leaves their switches on, so a request at the limit can swap. Past the
account’s limit, 409 warm_limit lists the models still kept warm after that, least
recently used first (used_at), each with the keep warms that hold it: its own
(keep_warm) and its families’ (families). A size with no kept-warm place left
answers 503 warm_capacity, unless switch_off stops a model of that size. With adapter, only while the number names the model the caller
saw: 409 model_changed otherwise, before anything loads.
curl --request POST \
--url https://api.sqwish.ai/v1/models/{model}/keep-warm \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"enabled": true,
"max_price_usd": "<string>",
"adapter": "<string>",
"switch_off": [
"<string>"
]
}
'import requests
url = "https://api.sqwish.ai/v1/models/{model}/keep-warm"
payload = {
"enabled": True,
"max_price_usd": "<string>",
"adapter": "<string>",
"switch_off": ["<string>"]
}
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({
enabled: true,
max_price_usd: '<string>',
adapter: '<string>',
switch_off: ['<string>']
})
};
fetch('https://api.sqwish.ai/v1/models/{model}/keep-warm', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "<string>",
"status": "<string>",
"evaluation_key": "<string>",
"name": "<string>",
"description": "<string>",
"family": "<string>",
"size_order": 123,
"lora": "<string>",
"metrics": {},
"max_input_tokens": 123,
"max_questions": 123,
"calibration": "<string>",
"availability_reason": "<string>",
"adapter_capacity": {
"max_rank": 123
},
"created_at": 123,
"deleted_at": 123,
"discarded_at": 123,
"on_at": 123,
"keep_warm": true,
"keep_warm_window": {
"started_at": 123,
"ends_at": 123,
"reserved_usd": "<string>"
},
"keep_warm_trial": {
"slot": 123,
"started_at": 123,
"ends_at": 123,
"state": "pending"
},
"keep_warm_stopped_at": 123,
"used_at": 123,
"switches_off_at": 123,
"off_reason": "owner",
"off_at": 123,
"job_id": "<string>",
"model_name": "<string>",
"version": 123,
"parent": "<string>",
"decision_price_nano": "<string>",
"base": "<string>",
"evaluation_set": {
"dataset": {
"id": "<string>",
"name": "<string>",
"archived_at": 123,
"deleted": true
},
"training_examples": 123,
"validation_examples": 123,
"earlier_examples": 123
},
"request_latency": {
"median_ms": 123,
"samples": 123,
"median_is_lower_bound": true,
"start": "<string>",
"end": "<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>"
}
]
}
}Body
The most you agree to pay for the first hour, which switching keep warm on holds, in USD, such as the price you were shown. It is a decimal string, such as "2.500000000", never a JSON number, so no precision is lost: a number is refused with invalid_request, naming this field. If it costs more when it is admitted, it is refused with price_changed and nothing is held.
^\d{1,9}(\.\d{1,9})?$Response
Successful Response
A base model or a trained adapter.
curl --request POST \
--url https://api.sqwish.ai/v1/models/{model}/keep-warm \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"enabled": true,
"max_price_usd": "<string>",
"adapter": "<string>",
"switch_off": [
"<string>"
]
}
'import requests
url = "https://api.sqwish.ai/v1/models/{model}/keep-warm"
payload = {
"enabled": True,
"max_price_usd": "<string>",
"adapter": "<string>",
"switch_off": ["<string>"]
}
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({
enabled: true,
max_price_usd: '<string>',
adapter: '<string>',
switch_off: ['<string>']
})
};
fetch('https://api.sqwish.ai/v1/models/{model}/keep-warm', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "<string>",
"status": "<string>",
"evaluation_key": "<string>",
"name": "<string>",
"description": "<string>",
"family": "<string>",
"size_order": 123,
"lora": "<string>",
"metrics": {},
"max_input_tokens": 123,
"max_questions": 123,
"calibration": "<string>",
"availability_reason": "<string>",
"adapter_capacity": {
"max_rank": 123
},
"created_at": 123,
"deleted_at": 123,
"discarded_at": 123,
"on_at": 123,
"keep_warm": true,
"keep_warm_window": {
"started_at": 123,
"ends_at": 123,
"reserved_usd": "<string>"
},
"keep_warm_trial": {
"slot": 123,
"started_at": 123,
"ends_at": 123,
"state": "pending"
},
"keep_warm_stopped_at": 123,
"used_at": 123,
"switches_off_at": 123,
"off_reason": "owner",
"off_at": 123,
"job_id": "<string>",
"model_name": "<string>",
"version": 123,
"parent": "<string>",
"decision_price_nano": "<string>",
"base": "<string>",
"evaluation_set": {
"dataset": {
"id": "<string>",
"name": "<string>",
"archived_at": 123,
"deleted": true
},
"training_examples": 123,
"validation_examples": 123,
"earlier_examples": 123
},
"request_latency": {
"median_ms": 123,
"samples": 123,
"median_is_lower_bound": true,
"start": "<string>",
"end": "<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>"
}
]
}
}