curl -X POST "$ATAI_API_ENDPOINT/inference/query" \
-H "Authorization: Bearer $ATAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "newton-c-2.6",
"query": "List three checks to run before starting a conveyor belt."
}'
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/query",
headers={"Authorization": f"Bearer {api_key}"},
json={
"model": "newton-c-2.6",
"query": "List three checks to run before starting a conveyor belt.",
},
)
if response.ok:
print(response.json()["response"]["response"])
else:
print(f"Error: {response.json()['errors']}")
const response = await fetch(`${process.env.ATAI_API_ENDPOINT}/inference/query`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'newton-c-2.6',
query: 'List three checks to run before starting a conveyor belt.'
})
});
const body = await response.json();
if (response.ok) {
console.log(body.response.response);
} else {
console.error('Error:', body.errors);
}
{
"errors": [
{
"code": "not_found",
"message": "model 'newton-c-9' is not available",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "unavailable",
"message": "model 'newton-c-2.6' has no ready replica; retry shortly",
"suggestion": "Retry the request.",
"error_uid": "err-xxxxxxxx"
}
]
}
Inference API
Inference: Direct Query
Query a platform-hosted model with a Direct Query request body
POST
/
api
/
inference
/
query
curl -X POST "$ATAI_API_ENDPOINT/inference/query" \
-H "Authorization: Bearer $ATAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "newton-c-2.6",
"query": "List three checks to run before starting a conveyor belt."
}'
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/query",
headers={"Authorization": f"Bearer {api_key}"},
json={
"model": "newton-c-2.6",
"query": "List three checks to run before starting a conveyor belt.",
},
)
if response.ok:
print(response.json()["response"]["response"])
else:
print(f"Error: {response.json()['errors']}")
const response = await fetch(`${process.env.ATAI_API_ENDPOINT}/inference/query`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'newton-c-2.6',
query: 'List three checks to run before starting a conveyor belt.'
})
});
const body = await response.json();
if (response.ok) {
console.log(body.response.response);
} else {
console.error('Error:', body.errors);
}
{
"errors": [
{
"code": "not_found",
"message": "model 'newton-c-9' is not available",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "unavailable",
"message": "model 'newton-c-2.6' has no ready replica; retry shortly",
"suggestion": "Retry the request.",
"error_uid": "err-xxxxxxxx"
}
]
}
Requires version 2.0.1 or later of the Archetype platform.
Overview
This endpoint sends a Direct Query request to a model that the Archetype Platform hosts. The body has the same shape as a Direct Query on/api/lens/query, and model
names one of the available models. The platform
forwards the body to a running copy of that model and returns its answer unchanged.
Every model available on the Inference API serves this endpoint.
Request
Name of the model to query, such as
newton-c-2.6 or omega-embedding. See Available
Models. An unknown name returns 404.The natural-language query. For
omega-embedding, leave it empty and send the sensor window as a
data.numeric_array event in events.Video for
newton-c-2.6 and newton-fusion-1.0, sent inline as "base64:<mp4 data>". Still
images and uploaded files (by name or by fil_ ID) are refused; send images to Chat
Completions instead. See Current
Limitations.How long to wait for the answer before the request returns
504. It can only lower the model’s
own time budget, not raise it.Accepted for compatibility with existing Direct Query clients, and ignored:
omega-embedding
normalizes its input itself, whatever the value.These fields of the
/api/lens/query body aren’t supported on this endpoint. Setting one returns
400: a non-empty template_name, max_frames, presence_penalty, render: true, and
multi_image: true.Response
The model’s answer, in the Direct Query response shape. The model’s output is the array atresponse.response: text for newton-c-2.6 and
newton-fusion-1.0, and embedding vectors for omega-embedding.
curl -X POST "$ATAI_API_ENDPOINT/inference/query" \
-H "Authorization: Bearer $ATAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "newton-c-2.6",
"query": "List three checks to run before starting a conveyor belt."
}'
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/query",
headers={"Authorization": f"Bearer {api_key}"},
json={
"model": "newton-c-2.6",
"query": "List three checks to run before starting a conveyor belt.",
},
)
if response.ok:
print(response.json()["response"]["response"])
else:
print(f"Error: {response.json()['errors']}")
const response = await fetch(`${process.env.ATAI_API_ENDPOINT}/inference/query`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'newton-c-2.6',
query: 'List three checks to run before starting a conveyor belt.'
})
});
const body = await response.json();
if (response.ok) {
console.log(body.response.response);
} else {
console.error('Error:', body.errors);
}
{
"errors": [
{
"code": "not_found",
"message": "model 'newton-c-9' is not available",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "unavailable",
"message": "model 'newton-c-2.6' has no ready replica; retry shortly",
"suggestion": "Retry the request.",
"error_uid": "err-xxxxxxxx"
}
]
}
Important Notes
- Every error is listed in Errors on the Inference API overview.
400withmodel '<model>' refused this requestmeans the model rejected the body, for example because it sets one of the unsupported fields above.503means no copy of the model is ready right now. Retry shortly.
Was this page helpful?