> ## Documentation Index
> Fetch the complete documentation index at: https://docs.archetypeai.app/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Start with /introduction/getting-started. Use the Inference API's Direct Query endpoint (POST /api/inference/query) with the newton-c-2.6 or newton-fusion-1.0 model (text, image, and video reasoning) or the omega-embedding encoder (time-series embeddings). ATAI_API_ENDPOINT is the base URL https://platform.u1.archetypeai.app with no version path; every endpoint path begins with /api. Pages whose descriptions are marked (Archived) document the legacy Lens runtime — do not use them for new projects.

# Inference: Direct Query

> Query a platform-hosted model with a Direct Query request body

Requires [version 2.0.1](https://docs.archetypeai.app/release-notes/2.0.x.md#v2-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](https://docs.archetypeai.app/api-reference/query.md) on `/api/lens/query`, and `model`
names one of the [available models](https://docs.archetypeai.app/api-reference/inference/about#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

**model** `string` *required*

Name of the model to query, such as `newton-c-2.6` or `omega-embedding`. See [Available
Models](https://docs.archetypeai.app/api-reference/inference/about#available-models). An unknown name returns `404`.

**query** `string`

The natural-language query. For `omega-embedding`, leave it empty and send the sensor window as a
`data.numeric_array` event in `events`.

**system\_prompt** `string`

System prompt for this request, in place of the model's configured one.

**instruction\_prompt** `string`

Instruction appended after the system prompt.

**response\_start\_prompt** `string`

Text that seeds the start of the model's reply.

**file\_ids** `string[]`

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](https://docs.archetypeai.app/api-reference/inference/chat-completions.md) instead. See [Current
Limitations](https://docs.archetypeai.app/api-reference/inference/migrate-from-direct-query.md#current-limitations).

**events** `object[]`

Inline data events. Only `data.numeric_array` events are supported on this endpoint.

**max\_new\_tokens** `integer`

Maximum number of tokens to generate.

**temperature** `number`

Sampling temperature.

**do\_sample** `boolean`

Whether to sample. `false` uses greedy decoding.

**top\_p** `number`

Nucleus sampling cutoff.

**top\_k** `integer`

Top-k sampling cutoff.

**repetition\_penalty** `number`

Penalty for repeated tokens.

**max\_wait\_time\_sec** `number`

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.

**normalize\_input** `boolean`

Accepted for compatibility with existing Direct Query clients, and ignored: `omega-embedding`
normalizes its input itself, whatever the value.

> [!NOTE]
>
> 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](https://docs.archetypeai.app/api-reference/query.md#response) shape. The
model's output is the array at `response.response`: text for `newton-c-2.6` and
`newton-fusion-1.0`, and embedding vectors for `omega-embedding`.

```bash cURL theme={"system"}
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."
  }'
```

```python Python theme={"system"}
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']}")
```

```javascript JavaScript theme={"system"}
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);
}
```

```json 404 - Unknown model theme={"system"}
{
  "errors": [
    {
      "code": "not_found",
      "message": "model 'newton-c-9' is not available",
      "suggestion": null,
      "error_uid": "err-xxxxxxxx"
    }
  ]
}
```

```json 503 - No copy of the model is ready theme={"system"}
{
  "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

> [!NOTE]
>
> * Every error is listed in [Errors](https://docs.archetypeai.app/api-reference/inference/about#errors) on the Inference API overview.
> * `400` with `model '<model>' refused this request` means the model rejected the body, for example
>   because it sets one of the unsupported fields above.
> * `503` means no copy of the model is ready right now. Retry shortly.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.