← AI Root

Quickstart

AI Root is OpenAI-compatible. If your code already calls OpenAI, you switch by changing the base URL and API key — nothing else.

1. Get a key & your balance

Sign in on the portal and create a key. Give each client or engagement its own key with a tag and a monthly cap, so spend is attributable and bounded.

2. Call a model (OpenAI-compatible)

Use the OpenAI SDK you already have. Point base_url at the gateway. Model auto routes to the best available model; cheapest and fastest also work.

Python (openai SDK)
from openai import OpenAI

client = OpenAI(
    base_url="https://airoot-gateway.fly.dev/v1",
    api_key="sk-air_your_key_here",
)

resp = client.chat.completions.create(
    model="auto",                       # or "cheapest" / a specific model
    messages=[{"role": "user", "content": "Summarise this trial balance variance."}],
)
print(resp.choices[0].message.content)
curl
curl https://airoot-gateway.fly.dev/v1/chat/completions \
  -H "Authorization: Bearer sk-air_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"model":"auto","messages":[{"role":"user","content":"Hello"}]}'

3. Redact client data before it hits a model

Strip TFNs, ABNs, account numbers, names and addresses. You get placeholdered text plus a mapping you keep on your side. Send a PDF or plain text.

Redact a PDF
curl https://airoot-gateway.fly.dev/v1/redact/file \
  -H "Authorization: Bearer sk-air_your_key_here" \
  -F "file=@engagement-letter.pdf"
# → { redacted_text, mapping: [{placeholder, type, original}], counts, ... }

4. The compliance workflow: redact → process → re-identify

The pattern that lets you use cheap models on client work safely: redact, send the redacted text to a model, then restore the originals locally. The mapping never leaves your control, and re-identify is free.

Python — full round trip
import httpx

BASE = "https://airoot-gateway.fly.dev/v1"
H = {"Authorization": "Bearer sk-air_your_key_here"}
doc = open("client_note.txt").read()

# 1. Redact
r = httpx.post(f"{BASE}/redact", headers=H, json={"text": doc}).json()
safe_text, mapping = r["redacted_text"], r["mapping"]

# 2. Process the REDACTED text with any model
out = httpx.post(f"{BASE}/chat/completions", headers=H, json={
    "model": "auto",
    "messages": [{"role": "user", "content": f"Draft a reply:\n{safe_text}"}],
}).json()["choices"][0]["message"]["content"]

# 3. Re-identify locally (mapping stays on your side)
final = httpx.post(f"{BASE}/redact/reidentify", headers=H,
                   json={"text": out, "mapping": mapping}).json()["text"]
print(final)

5. Per-client cost allocation

Mint a key per client with a tag; every call is attributed. Month-end, export a CSV filtered by tag and disburse the AI cost to that client file.

Create a tagged, capped key
curl https://airoot-gateway.fly.dev/v1/keys \
  -H "Authorization: Bearer sk-air_your_admin_key" \
  -H "Content-Type: application/json" \
  -d '{"name":"acme-fy25","tag":"acme-pty-ltd","monthly_budget_usd":50}'
Export that client's usage as CSV
curl "https://airoot-gateway.fly.dev/v1/usage.csv?tag=acme-pty-ltd" \
  -H "Authorization: Bearer sk-air_your_admin_key" -o acme-ai-costs.csv
Ready to try it on your own documents?
Open the free redactor →