curl -X POST "$ATAI_API_ENDPOINT/inference/sessions/ses_01jcx4m8t2vq6xn3r7k5hbzw9e/cancel" \
-H "Authorization: Bearer $ATAI_API_KEY"
import os
import requests
base_url = os.environ["ATAI_API_ENDPOINT"]
api_key = os.environ["ATAI_API_KEY"]
response = requests.post(
f"{base_url}/inference/sessions/ses_01jcx4m8t2vq6xn3r7k5hbzw9e/cancel",
headers={"Authorization": f"Bearer {api_key}"},
)
if response.ok:
print(response.json()["status"])
else:
print(f"Error: {response.json()['errors']}")
const response = await fetch(
`${process.env.ATAI_API_ENDPOINT}/inference/sessions/ses_01jcx4m8t2vq6xn3r7k5hbzw9e/cancel`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
}
}
);
const body = await response.json();
if (response.ok) {
console.log(body.status);
} else {
console.error('Error:', body.errors);
}
{
"id": "ses_01jcx4m8t2vq6xn3r7k5hbzw9e",
"model": "omega-embedding",
"status": "cancelled",
"values": {"window_size": 1024, "step_size": 512},
"error": null,
"created_at": "2026-11-11T09:12:44Z",
"started_at": "2026-11-11T09:12:51Z",
"completed_at": "2026-11-11T09:40:02Z"
}
Sessions
Cancel Model Session
Close one of your sessions on a platform-hosted model
POST
/
api
/
inference
/
sessions
/
{session_id}
/
cancel
curl -X POST "$ATAI_API_ENDPOINT/inference/sessions/ses_01jcx4m8t2vq6xn3r7k5hbzw9e/cancel" \
-H "Authorization: Bearer $ATAI_API_KEY"
import os
import requests
base_url = os.environ["ATAI_API_ENDPOINT"]
api_key = os.environ["ATAI_API_KEY"]
response = requests.post(
f"{base_url}/inference/sessions/ses_01jcx4m8t2vq6xn3r7k5hbzw9e/cancel",
headers={"Authorization": f"Bearer {api_key}"},
)
if response.ok:
print(response.json()["status"])
else:
print(f"Error: {response.json()['errors']}")
const response = await fetch(
`${process.env.ATAI_API_ENDPOINT}/inference/sessions/ses_01jcx4m8t2vq6xn3r7k5hbzw9e/cancel`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
}
}
);
const body = await response.json();
if (response.ok) {
console.log(body.status);
} else {
console.error('Error:', body.errors);
}
{
"id": "ses_01jcx4m8t2vq6xn3r7k5hbzw9e",
"model": "omega-embedding",
"status": "cancelled",
"values": {"window_size": 1024, "step_size": 512},
"error": null,
"created_at": "2026-11-11T09:12:44Z",
"started_at": "2026-11-11T09:12:51Z",
"completed_at": "2026-11-11T09:40:02Z"
}
Requires version 2.0.1 or later of the Archetype platform.
Overview
This endpoint closes a running session. The session ends ascancelled, and its place under your
organization’s limit for the model frees up at once.
Request
Response
Returns200 with the session object, now
cancelled.
curl -X POST "$ATAI_API_ENDPOINT/inference/sessions/ses_01jcx4m8t2vq6xn3r7k5hbzw9e/cancel" \
-H "Authorization: Bearer $ATAI_API_KEY"
import os
import requests
base_url = os.environ["ATAI_API_ENDPOINT"]
api_key = os.environ["ATAI_API_KEY"]
response = requests.post(
f"{base_url}/inference/sessions/ses_01jcx4m8t2vq6xn3r7k5hbzw9e/cancel",
headers={"Authorization": f"Bearer {api_key}"},
)
if response.ok:
print(response.json()["status"])
else:
print(f"Error: {response.json()['errors']}")
const response = await fetch(
`${process.env.ATAI_API_ENDPOINT}/inference/sessions/ses_01jcx4m8t2vq6xn3r7k5hbzw9e/cancel`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
}
}
);
const body = await response.json();
if (response.ok) {
console.log(body.status);
} else {
console.error('Error:', body.errors);
}
{
"id": "ses_01jcx4m8t2vq6xn3r7k5hbzw9e",
"model": "omega-embedding",
"status": "cancelled",
"values": {"window_size": 1024, "step_size": 512},
"error": null,
"created_at": "2026-11-11T09:12:44Z",
"started_at": "2026-11-11T09:12:51Z",
"completed_at": "2026-11-11T09:40:02Z"
}
Important Notes
404means the session doesn’t exist or isn’t visible to you.409means the session has already ended, which can happen on its own, for example when it expires.- The call can take up to 15 seconds while the session’s in-flight work winds down. The cancel stands even if that can’t be confirmed.
Was this page helpful?