Before you Begin
You’ll need Python 3.11 or later and an API key from a production account: go to the API Keys page (e.g. platform.u1.archetypeai.app/console/profile) to create one.1. Setup
Create a virtual environment, install the Archetype AI Python client, and set your credentials. Replace"insert_your_key" with your API key.
The virtual environment matters: recent Python installs on macOS (Homebrew) and Debian/Ubuntu block system-wide installs, so a bare
pip install fails with externally-managed-environment. If you see that error, activate the venv first. Conda environments work too — see Python Client Setup.model field names the model:
- Newton C 2.6 (
newton-c-2.6) onPOST /inference/query— reasons over text and video, and answers in natural language. Newton Fusion 1.0 (newton-fusion-1.0), a larger reasoning model, takes the same requests. - Newton Omega 1.5 (
omega-embedding) — encodes a window of time-series sensor readings into a fixed-size embedding vector per channel, for building classifiers and anomaly detectors. The example opens a session to set its window length, then sends onePOSTper window to that session.
2. Describe a Video with Newton C 2.6
This example sends a short assembly video to Newton C 2.6 and asks what the worker does. The video goes inline in the request, base64-encoded infile_ids: no upload step.
Download the sample clip (470 KB, 31 seconds: a worker fitting an o-ring, a cap and a manifold, then
tightening with a wrench):
On Windows, use
curl.exe — in PowerShell, plain curl is an alias for Invoke-WebRequest, which rejects these flags.video_example.py:
video_example.py
What you should see
After about 2 seconds (longer on the first call), the model’s description prints to your terminal:The model reads 16 evenly spaced frames from every clip, each resized to 224 × 224 pixels, so a
brief action or a small detail can be missed. Trim a clip to the action and keep it short.
To send a larger video, shrink it first, for example
ffmpeg -i input.mp4 -vf "scale=448:-2,fps=4" -c:v libx264 -crf 28 -an small.mp4.3. Detect a Machine Fault with Newton Omega 1.5
The Omega model turns a window of time-series sensor readings into a 768-dimensional embedding — no prompt needed. You send the raw numbers and get vectors back, ready for downstream classification or anomaly detection. This example runs the full cycle on real vibration data from a bearing run-to-failure experiment:- Build an n-shot library — embed a handful of labeled windows (healthy and degraded).
- Classify held-out windows the library has never seen, with a k-nearest-neighbors vote over the embeddings.
- Score the predictions against ground-truth labels.
omega_example.py:
omega_example.py
What you should see
The 116 embedding calls (16 library windows, 100 test windows) fan out 8-way in parallel; the run takes about 10 seconds:atai-newton-omega-model skill runs this same kind of pipeline at full scale.
Choosing the Window Length
WINDOW sets the session’s window_size, and the script uses it for both the library and the test windows. The right length depends on the signal, so compare a few. On this data, with the settings above:
Every length catches nearly all degraded windows. Longer windows flag more healthy windows as degraded, so precision drops as the window grows. Don’t assume 1024 is best: pick the length from a held-out comparison like this one.
The session fixes the window length: every request sent to it is cut into
window_size-timestep windows, and each full window returns one row of 768 values per channel. A shorter input returns success: false with an empty response, and leftover samples past the last full window are dropped. Windows shorter than 1024 are padded and masked inside the model. Omega normalizes each channel inside every window and still sees its overall level, so there is no normalize_input option to set.A session ends when you cancel it, when it sits idle long enough, or when the server holding it is replaced; a query on an ended session returns HTTP 409, and the fix is to open a new one. An organization can keep up to 16 sessions open on a model. Without a session, POST /inference/query uses a fixed 1024-timestep window.Data attribution: the sample files are a curated subset of the NASA IMS Bearing Dataset (Set 2: a bearing run-to-failure experiment with four accelerometer channels), produced by the University of Cincinnati Center for Intelligent Maintenance Systems (IMS) and distributed via the NASA Prognostics Data Repository. If you use this data in a publication or redistribute it, include NASA’s requested citation: J. Lee, H. Qiu, G. Yu, J. Lin, and Rexnord Technical Services (2007). Bearing Data Set, IMS, University of Cincinnati. NASA Prognostics Data Repository, NASA Ames Research Center, Moffett Field, CA.
Try Variations
- Try Newton Fusion 1.0 — set
MODEL = "newton-fusion-1.0"invideo_example.py. It’s a reasoning model: the script adds/no_thinkfor a direct answer; remove it to let the model reason first, and raisemax_new_tokensto at least2048. See Reasoning. - Ask for structured output — make the prompt the schema, for example:
Respond with ONLY a JSON object: {"steps": ["<step>", ...], "tool_used": "<tool>"}. - Send an image — images go to the OpenAI-compatible Chat Completions endpoint as a data URI, not to
/inference/query. See Images. - Vary the Omega window length — change
WINDOWto 32, 128 or 512 and compare with the table above; the script opens its session with that length. - Evaluate more held-out windows — raise
TEST_WINDOWSfrom 100 toward the ~1000 available; each window is one independent call to the session.
Build with a Coding Agent
The official Agent Skills teach coding agents like Claude Code, Cursor, and Codex these patterns — including the gotchas — so you can describe what you want and let the agent write the code.Troubleshooting
If you’re getting errors, see the Troubleshooting page, or the errors you’re most likely to meet on the Inference API, listed in Migrating from the Direct Query API and Migrating Omega from the Direct Query API. A400 with model '<model>' refused this request usually means an input or field the Inference API doesn’t support yet; see Current Limitations.
Learn More
Inference API
The endpoints, the models they serve, sessions, and errors.
Migrating from the Direct Query API
Moving Newton C 2.6 calls to the Inference API, and when to stay on the Direct Query API.
Migrating Omega from the Direct Query API
Moving from Omega 1.4 to Omega 1.5 embeddings.
Example Projects
Working demos on the Inference API, from traffic analysis to wind-turbine fault detection.