Skip to main content
POST
This API endpoint is under active development and is subject to change.

Overview

The /query endpoint runs a synchronous query against an Archetype model. The request is enqueued on the GPU Processing Queue (GPQ), routed to a worker node, and the final result is returned in the same HTTP response. A query can be grounded in:
  • Uploaded files — reference files by ID via file_ids after uploading them through the Files API. Supported file types: .png, .jpg, .jpeg, .txt, .json, .csv, .mp4.
  • Inline data events — pass payloads directly via events (text, JSON, base64-encoded image, or numeric arrays) without a separate upload step.
  • Prompt only — neither files nor events.
The model parameter selects what runs against your inputs. Two model families are currently exposed on /query:
  • Newton C language models (Newton::c2_...) — text reasoning, structured-output generation, image understanding, and (on C 2.6 fusion checkpoints) video understanding. Used in archetypeai-swat-demo-direct-query, archetypeai-earthquake-demo, archetypeai-grid-demo, and the operator-suggestion patterns documented in the newton-query-prompting skill. Examples on this page use Newton::c2_5_8b_260413b723a9ab. For video, use a C 2.6 fusion checkpoint such as Newton::c2_6_8b_fp8_260424d7a55d5e — see the atai-newton-fusion-model skill.
  • Omega encoders (OmegaEncoder::omega_embeddings_01) — numeric-only. Returns embedding vectors instead of text. Used with data.numeric_array events to feed channel-first sensor windows; the response carries one 768-dim embedding per channel. Pattern documented in the newton-machine-state-direct-query skill.
The exact model identifiers available to your organization may differ — invalid values return 400 invalid_model_version.

Request

string
required
Versioned model identifier such as Newton::c2_5_8b_260413b723a9ab (text + image reasoning) or OmegaEncoder::omega_embeddings_01 (numeric encoder). Validated against the available model registry — invalid values return 400 invalid_model_version. See Overview for the model families currently exposed on this endpoint.
string
required
The natural-language query to run against the model. For numeric-encoder models (Omega) this is typically "" — pass the sensor window as a data.numeric_array event in events instead.
string
default:""
Optional system prompt prepended to the query.
string
default:""
Optional instruction prompt appended to the system prompt.
string
default:""
Optional prefix used to seed the model’s response.
string
default:""
Optional named prompt template to apply server-side.
string[]
File IDs returned by the Files API. Two gotchas worth knowing:
  1. Use the file_id (filename) the upload response returned, not the file_uid (fil_…). /query filters file types by extension on the file_id string — fil_… has no extension and is rejected as unsupported_file_type.
  2. Newton text models see contents of .png / .jpg / .jpeg / .txt / .json injected into the prompt; .csv is the exception. CSV uploads succeed and /query accepts the reference, but the file contents are not visible to the text-reasoning model (likely routed to the numeric ingestion path the LLM doesn’t observe). As a workaround, rename the file to end with .txt before uploading, or pass the CSV contents as a data.text event instead. .mp4 requires a C 2.6 fusion checkpoint such as Newton::c2_6_8b_fp8_260424d7a55d5e — older C 2.4/2.5 text checkpoints do not process video frames. The clip is decoded and uniformly sampled server-side (control this with max_frames); see the atai-newton-fusion-model skill for the full video patterns.
object[]
Inline data events in place of file uploads. See Data Events for the supported event types: data.text, data.json, data.base64_img, data.base64_img_array, data.numeric_array. For data.json, set event_data.contents to a serialized JSON string (passing a parsed object returns 400 invalid_parameter_type).
integer
default:"256"
Maximum tokens to generate in the response.
integer
default:"32"
Maximum video frames to sample when an .mp4 file is supplied via file_ids. The platform maximum is 64 — values above 64 fail silently: the request returns 200 but the video is dropped and the model answers from priors. Video requires a C 2.6 fusion checkpoint (see Overview).
number
Sampling temperature. Omit to use the model default.
boolean
Whether to use sampling instead of greedy decoding.
number
Penalty for repeating tokens already produced.
number
Nucleus sampling cutoff.
integer
Top-k sampling cutoff.
number
Penalty for tokens already present in the prompt.
boolean
default:"false"
Apply server-side input normalization. For numeric-encoder models (Omega), this z-scores each data.numeric_array event per window before encoding. That preserves cross-channel comparability but erases cross-window amplitude signal — typically the wrong default for anomaly-detection workloads. Leave false and pre-normalize with a global scaler if cross-window magnitudes carry meaning. Has no effect on text-reasoning models.
boolean
default:"false"
When true, treat multiple file_ids / image events as a single multi-image input rather than independent inputs.
boolean
default:"false"
When true, retains rendered intermediate artifacts on the server. The retrieval endpoint for these artifacts is not exposed on /v0.5; leave this false unless instructed otherwise.
object
Free-form metadata stored alongside the query for the caller’s own bookkeeping.
number
Override the maximum combined prompt size in MB. Defaults to the server’s MAX_QUERY_SIZE_MB setting (typically 0.04 MB).
number
Override the maximum time to wait for a synchronous result before returning a 504.
boolean
default:"true"
When true, strips internal fields (api_key, org_id, query_metadata, file_ids, data_types, render, input_items, sanitize) from the response. Set to false only if you need to inspect the raw query record.

Response

string
Server-generated identifier for this query. Include it when reporting issues to support so the platform team can correlate to server logs.
string
Terminal status — completed for successful queries, failed if the worker returned an error.
object
Structured payload from the worker. The primary model output is the array at response.response (typically one or more strings). The remaining fields echo the prompt inputs (query, prompt, system, instruction) and per-stage timing (generation_latency, query_gpq_latency, query_queue_latency, results_timestamp, prefetch_stats) for debugging.
number
Unix timestamp when the query was submitted.
number
Unix timestamp when data loading began.
number
Unix timestamp when inference began.
number
Unix timestamp when the response was finalized.
number
Seconds spent in the queue before processing began.
number
Seconds spent on inference.
number
End-to-end latency from submission to response.
string
Identifier of the GPQ worker node that processed the query.
string[]
Plain-string error log accumulated by GPQ during query processing. Only present when GPQ has appended at least one message — successful queries typically omit this field entirely.
string
Single error string set by GPQ only when status is failed.
Non-2xx responses (400, 429, 504) are reduced to an { "errors": [...] } envelope by the shared API response wrapper — fields like query_id, status, and timing data are stripped. 401 responses are rendered as { "detail": "..." } by FastAPI. See Errors for the shared AtaiError shape.