Skip to main content

Quickstart

InertialAI-0.1 speaks the OpenAI Chat Completions protocol, so the fastest path is the client you probably already have installed.

1. Get a key

Create an API key in the dashboard (keys look like iai_... and are shown once) and export it:

export INERTIALAI_API_KEY="iai_..."

Every new account starts with $5 of free usage — at $0.25 per million input tokens, that is a lot of experimenting.

2. Install the OpenAI client

pip install openai

3. Warm the model up

InertialAI-0.1 scales to zero when idle. The first request after an idle period may take up to ~5 minutes (measured) while the model loads onto a GPU; every request after that is fast. If your workflow is latency-sensitive, send a tiny warmup ping first:

import os
from openai import OpenAI

client = OpenAI(
base_url="https://inertialai.com/api/v1",
api_key=os.environ["INERTIALAI_API_KEY"],
)

# Warmup ping: 1-token answer, costs a fraction of a cent.
client.chat.completions.create(
model="inertialai-0.1",
messages=[{"role": "user", "content": "ping"}],
max_tokens=1,
)

4. Ask a real question about real data

resp = client.chat.completions.create(
model="inertialai-0.1",
messages=[
{
"role": "system",
"content": "You are a monitoring assistant for industrial pumps.",
},
{
"role": "user",
"content": (
"Vibration RMS for pump A12 over the last 12 hours (mm/s):\n"
"2.1, 2.0, 2.2, 2.1, 2.3, 2.2, 2.1, 4.8, 5.1, 5.0, 5.2, 5.1\n\n"
"Summarize what happened and say whether we should dispatch "
"a technician."
),
},
],
)

print(resp.choices[0].message.content)
print(resp.usage) # prompt_tokens / completion_tokens — your exact cost basis

5. Add token-level confidence

For classification-style questions, ask for logprobs and read the answer token's probability — right answers score high, wrong ones low, so you can threshold on it:

import math

resp = client.chat.completions.create(
model="inertialai-0.1",
messages=[
{
"role": "user",
"content": (
"Readings: 2.1, 2.0, 2.2, 4.8, 5.1. "
"One word: normal or anomaly."
),
}
],
max_tokens=2,
logprobs=True,
top_logprobs=5,
)

first = resp.choices[0].logprobs.content[0]
confidence = math.exp(first.logprob)
print(first.token, f"{confidence:.2f}") # e.g. "anomaly 0.93"

if confidence < 0.80:
print("Low confidence — route to a human.")

More on this pattern in Token-level confidence.

The same request as raw HTTP

curl -sS -X POST "https://inertialai.com/api/v1/chat/completions" \
-H "Authorization: Bearer ${INERTIALAI_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"model": "inertialai-0.1",
"messages": [
{"role": "user", "content": "Readings: 2.1, 2.0, 4.8. Normal or anomaly?"}
]
}'

Next steps