Docs

Ailerix speaks two contracts: OpenRouter-style chat, and TypeSafe System One. Jev classifies task families; software walks the frontier.

POST
/api/v1/route
Jev + frontier walk. Send { prompt, policy? }. Returns family, aa_id, cost_per_task_usd, floor, fallback_aa_id, decisions, mock output. model is always ailerix/auto.
POST
/api/v1/systemone
Jev-compatible System One endpoint. Send state + typed questions.
POST
/api/v1/chat/completions
OpenAI-shaped chat. model must be omitted or ailerix/auto; any other slug returns 400 model_not_allowed.
GET
/api/v1/models
Returns only ailerix/auto — the sole public model id. No provider catalog.
TypeScript: routing questions (task family)
Production routing uses nine questions — one Choice over families, three Scores, five Nouls. No catalog ids in criteria.
const familyCriteria = {
  "intelligence": "Open-ended reasoning, writing, analysis. The default family.",
  "coding": "Programming, diffs, repository Q&A, stack traces.",
  "agents": "Multi-step tool use, browsing, plan-then-act workflows.",
  "vision": "Images, screenshots, or diagrams are load-bearing.",
  "factual": "Closed-book facts, citations, low hallucination tolerance.",
  "long_context": "Long documents, books, multi-file corpora.",
  "professional": "Legal, medical, finance, or regulated tone."
};

const response = await fetch("/api/v1/systemone", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    state: "Refund this double charge before payroll.",
    model: "jev-latest",
    questions: {
      task_family: {
        type: "choice",
        instructions:
          "Classify the user's request into exactly one task family.",
        criteria: familyCriteria,
      },
      quality_floor: {
        type: "score",
        instructions: "How much model quality does this task need?",
        legend: [
          "Trivial rewrite or lookup",
          "Standard production task",
          "Hard multi-step reasoning",
          "Frontier-only work",
        ],
      },
      hallucination_sensitive: {
        type: "noul",
        instructions:
          "Would a confident falsehood be expensive here?",
      },
    },
  }),
});

const { answers } = await response.json();
console.log(answers.task_family.choice, answers.task_family.confidence);
Chat completions: ailerix/auto only
const response = await fetch("/api/v1/chat/completions", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    model: "ailerix/auto",
    messages: [{ role: "user", content: "Summarize this ticket." }],
    policy: "balanced",
  }),
});

// Omitting model is also accepted.
// Any other model slug → 400 { code: "model_not_allowed" }
// Body fields models, provider, plugins, preset → 400 parameter_not_allowed

const body = await response.json();
console.log(body.model); // "ailerix/auto"
console.log(body.ailerix?.family, body.ailerix?.cost_per_task_usd);
Live Jev vs local engine

If TYPESAFE_API_KEY is set, Ailerix calls POST https://api.typesafe.ai/v1/systemone with model jev-latest.

Without a key, Ailerix uses a local System One engine that returns the same Choice / Score / Noul shapes so you can develop against the typed contract. Completions stay mocked either way until you add provider credentials.

Agents & MCP

Connect Cursor, Claude Desktop, or any MCP client to route prompts, inspect generations, and manage credits without leaving your editor.

MCP endpoint
Streamable HTTP transport with OAuth protected resources.

Base URL: https://ailerix.com/api/mcp

OAuth uses Clerk with dynamic client registration (DCR). Cursor registers automatically when you add the server. Read-only tools (discovery and analytics summaries) work without a token; routing, completions, and credit purchases require a signed-in session or bearer token from the OAuth flow.

Anonymous callers get 25 routed requests per day. Paid and signed-in usage draws from your credit balance; exhausted credits return 402 with insufficient_credits.

Tools
Six MCP tools exposed on the live server.
ToolDescription
route_previewClassify a prompt and return the frontier walk preview (family, floor, fallback) without charging a completion.
create_completionRun a routed completion for a prompt and optional policy; returns a generation id for follow-up.
get_generationFetch status and output for a prior generation by id.
analytics_summaryAggregated spend, tokens, and family breakdown for the authenticated account (optional days window).
credit_balanceCurrent USD credit balance for the signed-in user.
buy_creditsStart checkout for a credit pack (requires auth and Stripe).
Discovery & machine-readable docs

/.well-known/acp.json describes Agentic Commerce Protocol checkout so agents can purchase credit packs on your behalf after OAuth consent.

List tools (curl)
JSON-RPC over streamable HTTP — read tools work without auth on open deployments.
curl -sS -X POST https://ailerix.com/api/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Cursor plugin
Prebuilt MCP wiring and skills for the Ailerix repo.