Root AI
Root AI

Your First API Call

The Root AI API is fully Anthropic-compatible. Point any agent or Anthropic SDK at our base URL and you can start building immediately. Chat, reasoning modes, vision, web search, image generation, and tool calls — all through one endpoint.

Param Value
base_url https://root-ai.org/v1
api_key Your Root AI key — get it from Account Settings → API Access (rootai_...)
model root-ai-flash, root-ai-pro, or root-ai-vision

Invoke the API

curl https://root-ai.org/v1/messages \
  -H "x-api-key: rootai_YOUR_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "root-ai-flash",
    "max_tokens": 512,
    "messages": [
      { "role": "user", "content": "Hello, Root AI!" }
    ]
  }'
import anthropic

client = anthropic.Anthropic(
    base_url="https://root-ai.org",
    api_key="rootai_YOUR_API_KEY",
)

message = client.messages.create(
    model="root-ai-flash",
    max_tokens=512,
    messages=[{"role": "user", "content": "Hello, Root AI!"}],
)

print(message.content[0].text)
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  baseURL: "https://root-ai.org",
  apiKey: "rootai_YOUR_API_KEY",
});

const message = await client.messages.create({
  model: "root-ai-flash",
  max_tokens: 512,
  messages: [{ role: "user", content: "Hello, Root AI!" }],
});

console.log(message.content[0].text);

List available models

curl https://root-ai.org/v1/models \
  -H "x-api-key: rootai_YOUR_API_KEY"

Models

Every model ships with a 1M token context window. Pick a reasoning mode by appending a variant suffix, or send reasoning_effort in the request body.

Model IDDescriptionPlans
root-ai-flash Fast, lightweight chat model. Default reasoning: standard (1M ctx). Free
root-ai-flash-instant No reasoning — fastest responses. Free
root-ai-flash-medium Balanced reasoning speed/quality. Free
root-ai-flash-reasoning High-effort reasoning. Free
root-ai-flash-ultra Ultra reasoning — maximum effort. Free
root-ai-pro Best performance and reasoning. Default reasoning: standard (1M ctx). Basic
root-ai-pro-instant Pro, no reasoning — fast. Basic
root-ai-pro-medium Pro, balanced reasoning. Basic
root-ai-pro-reasoning Pro, high-effort reasoning. Basic
root-ai-pro-ultra Pro, ultra reasoning. Basic
root-ai-vision Image analysis. Accepts image blocks (base64 or URL) in user messages. Basic

Call GET /v1/models any time — the list returned is already filtered to what your plan includes.

Authentication & API Keys

Every registered account can create its own API key. Your key inherits your plan's limits automatically — upgrade or downgrade your subscription and the key's access updates live.

Getting your key

  1. Open Account Settings (click your avatar → Settings → Account tab).
  2. Under API Access, click Generate API key.
  3. Copy the key immediately — it is shown only once.
  4. Keys can be regenerated (replaces the old key instantly) or revoked at any time.

Sending the key

Use the x-api-key header — or Authorization: Bearer as a fallback.

# x-api-key header (Anthropic style)
curl https://root-ai.org/v1/messages \
  -H "x-api-key: rootai_YOUR_API_KEY" \
  -H "content-type: application/json" \
  -d '{ "model": "root-ai-flash", "max_tokens": 64, "messages": [{ "role": "user", "content": "Hi" }] }'

# Authorization header (fallback)
curl https://root-ai.org/v1/models \
  -H "Authorization: Bearer rootai_YOUR_API_KEY"

Security: keys are stored as SHA-256 hashes — Root AI never stores or displays the plaintext after generation. A revoked key stops working immediately on every request.

Rate Limits

Limits are tied to your plan and shared across the app and the API.

PlanMessages / hourWeb search / dayImages / day
Free 30 10 Not included
Basic 60 20 50
Pro 120 Unlimited 100
Business Unlimited Unlimited Unlimited

Error Codes

Errors follow the Anthropic format:

{
  "type": "error",
  "error": {
    "type": "rate_limit_error",
    "message": "Hourly request limit reached for your plan."
  }
}
HTTPerror.typeMeaning
400invalid_request_errorMalformed request — missing/invalid model, messages, or parameters.
401authentication_errorMissing, invalid, or revoked API key.
403permission_errorModel or feature (vision, image gen) not included in your plan.
404not_found_errorUnknown model id. The message lists the available Root AI models.
429rate_limit_errorHourly/daily limit reached for your plan.
500 / 502api_errorProvider-side failure. Safe to retry after a short wait.

Agent Integrations

Connect Root AI to any agent that supports an Anthropic-compatible provider.

Kilo

  1. Model provider: Anthropic-compatible.
  2. Base URL: https://root-ai.org/v1
  3. API key: your rootai_... key.
  4. Model: root-ai-flash or root-ai-pro.

Cline

  1. API Provider → Anthropic.
  2. Base URL: https://root-ai.org
  3. API Key: your rootai_... key.
  4. Model ID: root-ai-flash / root-ai-pro / root-ai-vision.

Claude Code (CLI)

export ANTHROPIC_BASE_URL=https://root-ai.org
export ANTHROPIC_AUTH_TOKEN=rootai_YOUR_API_KEY
claude --model root-ai-flash

Any Anthropic SDK

// TypeScript
const client = new Anthropic({
  baseURL: "https://root-ai.org",   // SDK appends /v1/messages
  apiKey: "rootai_YOUR_API_KEY",
});

# Python
client = anthropic.Anthropic(
    base_url="https://root-ai.org",
    api_key="rootai_YOUR_API_KEY",
)

Any tool with an Anthropic-compatible custom base URL works: set the URL to https://root-ai.org (or https://root-ai.org/v1) and use your Root AI key.

Thinking Mode

Three ways to control reasoning — pick whichever fits your client.

1. Model variant (works in any model picker)

"model": "root-ai-pro-ultra"      // Ultra Reasoning
"model": "root-ai-flash-instant"  // Instant (no reasoning)
"model": "root-ai-flash"          // Standard (1M ctx)

2. reasoning_effort field

curl https://root-ai.org/v1/messages \
  -H "x-api-key: rootai_YOUR_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "root-ai-flash",
    "reasoning_effort": "high",
    "max_tokens": 512,
    "messages": [{ "role": "user", "content": "Plan a project" }]
  }'

// accepted: instant, standard, medium, high, xhigh
// aliases:   reasoning -> high, ultra / max -> xhigh

3. Anthropic extended thinking param

{
  "model": "root-ai-pro",
  "thinking": { "type": "enabled", "budget_tokens": 4096 },
  "max_tokens": 2048,
  "messages": [{ "role": "user", "content": "Hard problem" }]
}

// budget_tokens mapping:
//   < 2048  -> medium
//   < 8192  -> high
//   >= 8192 -> ultra (max)

Multi-round Conversation

The API is stateless — send the full messages array back every turn to continue a conversation.

// Turn 2: pass the previous assistant reply back in messages
{
  "model": "root-ai-flash",
  "max_tokens": 512,
  "messages": [
    { "role": "user", "content": "What is 2 + 2?" },
    { "role": "assistant", "content": [ { "type": "text", "text": "2 + 2 is 4." } ] },
    { "role": "user", "content": "Now multiply it by 3." }
  ]
}

Assistant tool_use blocks and user tool_result blocks are also passed back for tool-calling loops — see .

JSON Output

Ask for JSON directly in your prompt and parse the reply. For structured workflows, prefer tool calls with an input schema.

{
  "model": "root-ai-flash",
  "max_tokens": 512,
  "messages": [{
    "role": "user",
    "content": "Return a JSON object with keys: name, age, city. Values: Juan, 24, Cebu. Respond with JSON only."
  }]
}

// reply
{
  "name": "Juan",
  "age": 24,
  "city": "Cebu"
}

Tool Calls

The proxy executes tools server-side and returns the result to the model, so agents get a finished answer — no extra round trips.

Web search (server tool)

Image generation (built-in custom tool)

{
  "model": "root-ai-flash",
  "max_tokens": 800,
  "tools": [{
    "type": "custom",
    "name": "image_generate",
    "description": "Generate an image from a text prompt.",
    "input_schema": {
      "type": "object",
      "properties": {
        "prompt": { "type": "string" },
        "width": { "type": "integer", "enum": [1024, 1536] },
        "height": { "type": "integer", "enum": [1024, 1536, 864] },
        "output_format": { "type": "string", "enum": ["png", "jpg"] }
      },
      "required": ["prompt"]
    }
  }],
  "messages": [ { "role": "user", "content": "Generate a logo of a pineapple surfing." } ]
}

Your own custom tools

Any custom tool with an input_schema is passed to the model for function calling. The response contains tool_use blocks with the arguments:

{
  "type": "message",
  "role": "assistant",
  "model": "root-ai-flash",
  "content": [
    {
      "type": "tool_use",
      "id": "call_abc123",
      "name": "weather_lookup",
      "input": { "city": "Cebu" }
    }
  ],
  "stop_reason": "tool_use",
  ...
}

Vision

Analyze images with root-ai-vision. Send image blocks as base64 data URIs or direct URLs in user messages (up to 8 per request, 12MB each).

{
  "model": "root-ai-vision",
  "max_tokens": 512,
  "messages": [{
    "role": "user",
    "content": [
      { "type": "text", "text": "What is in this image?" },
      {
        "type": "image",
        "source": {
          "type": "base64",
          "media_type": "image/png",
          "data": "iVBORw0KGgoAAAANS..."
        }
      }
    ]
  }]
}

// or by URL:
// { "type": "image", "source": { "type": "url", "url": "https://example.com/pic.png" } }

Image Generation

Include the image_generate tool (see ). The model calls it automatically and the reply includes the finished image URL:

Here's your image:

![Futuristic city at sunset](https://tempfile.aiquickdraw.com/workers/images/image_abc123.png)

// response also contains the tool_use block:
{
  "type": "tool_use",
  "id": "call_xyz",
  "name": "image_generate",
  "input": { "prompt": "...", "width": 1536, "height": 1024, "output_format": "png" }
}

Image generation is available on Basic+ plans with daily limits: Basic 50/day · Pro 100/day · Business unlimited.

Context Caching

Prompt caching is automatic. Repeating prefixes — system instructions and conversation history — are cached on the provider side, so long multi-round conversations get faster and cheaper with no extra config.

// usage shows cached tokens per response
"usage": {
  "input_tokens": 14210,
  "output_tokens": 512,
  "input_tokens_details": { "cached_tokens": 13880 }   // hit the cache
}

// Tips for best cache hits:
// 1. Keep system instructions stable between turns.
// 2. Re-send conversation history in the same order.
// 3. Only append new messages at the end.

Streaming

Set "stream": true for Server-Sent Events (SSE) in the standard Anthropic format.

curl -N https://root-ai.org/v1/messages \
  -H "x-api-key: rootai_YOUR_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "root-ai-flash",
    "max_tokens": 512,
    "stream": true,
    "messages": [{ "role": "user", "content": "Tell me a story" }]
  }'

Event sequence

EventPurpose
message_startResponse started (message id, model, initial usage).
content_block_startA text or tool_use block begins.
content_block_deltaIncremental content: text_delta or input_json_delta (tool arguments).
content_block_stopBlock finished.
message_deltastop_reason (end_turn / tool_use) + output tokens.
message_stopResponse complete.
pingKeep-alive during long tool execution.
errorStream failed — Anthropic error shape.

Using the Anthropic Base URL

Because the API is Anthropic-compatible, you never need Root AI-specific client libraries. Just swap the base URL and key.

What to configure

SettingValue
Base URL https://root-ai.org
or https://root-ai.org/v1 — both work. SDKs append /v1/messages themselves.
API key Your rootai_... key (x-api-key header).
Anthropic version Any — requests are version-agnostic.

Works with: Kilo, Cline, Claude Code, Anthropic SDKs (TypeScript / Python), and any tool that accepts a custom Anthropic endpoint.

Migration checklist

  • Swap the base URL → https://root-ai.org
  • Swap the API key → your rootai_... key
  • Swap model names → root-ai-flash / root-ai-pro / root-ai-vision
  • Everything else — messages, tools, streaming — stays the same.

API Reference

POST/v1/messages

Create a message. Stream with "stream": true.

FieldTypeDescription
modelstringRequired. Root AI model id (see Models).
messagesarrayRequired. Chat history: role + content blocks (text, image, tool_use, tool_result, thinking).
max_tokensintegerMax output tokens. Default 2048, max 16384.
systemstring | arraySystem prompt — string or text blocks.
toolsarrayweb_search server tool, image_generate, or custom tools with input_schema.
streambooleanSSE streaming (Anthropic events).
reasoning_effortstringinstant · standard · medium · high · xhigh
thinkingobjectAnthropic extended thinking: {"type":"enabled","budget_tokens":N}.

GET/v1/models

Lists models available on your plan (Anthropic format).

POST/v1/messages/count_tokens

Estimates input tokens: { "input_tokens": 142 }. Body: messages, system, tools.

Non-stream response shape

{
  "id": "msg_...",
  "type": "message",
  "role": "assistant",
  "model": "root-ai-flash",
  "content": [ { "type": "text", "text": "..." } ],
  "stop_reason": "end_turn",   // or "tool_use"
  "stop_sequence": null,
  "usage": { "input_tokens": 91, "output_tokens": 19 }
}

Agent App & Project Repair

Root AI can read and repair files on your own machine directly from the chat. Install the Root AI Agent desktop app, pin your project folders, and simply describe what needs fixing — the agent does the work on your computer with automatic backups.

Where to find the download

  1. Open Chat — click your avatar in the bottom-left corner of the sidebar.
  2. Click "Download Agent" in the account menu — the correct installer for your operating system (Windows or macOS) downloads automatically.

Setting up the agent

  1. Windows: open the downloaded Root AI Agent.exe (portable). If SmartScreen appears, click More info → Run anyway.
  2. macOS: unzip Root AI Agent, then in Terminal run xattr -cr "Root AI Agent.app" (removes the Gatekeeper quarantine flag — the app is not notarized yet), then open it.
  3. Sign in with your Root AI account (email + password or Continue with Google).
  4. Click Pin a project folder, choose your project folder, and set one project as Default (star).
  5. Keep the agent app running — it lives in the system tray / menu bar. Opening it again while it runs just shows the existing window.

Using it in chat

  • Keep the agent app running (it sits in the system tray).
  • Go to Chat and describe the problem — e.g. "fix the login bug in my shop project".
  • Root AI inspects, edits and verifies files on your machine. The green status dot in the agent app shows it is connected.

Safety

ProtectionWhat it does
Sensitive filesPrivate keys, certificates and credential stores can never be read or written. .env files CAN be read and edited so the agent can fix project configuration.
Project confinementFile edits stay inside the active project; browse_folders only lists folders.
Automatic backupsEvery edited file is backed up to .kilocode-backups/ inside your project first.
Command allowlistOnly safe commands (php, composer, npm, git, …) run — no chaining, piping or redirection.
Desktop onlyCoding tools appear only for desktop browsers; the agent app runs on your own machine with your own credentials.