Apps & Tokens
Create one token per app. Your agents send it as
Authorization: Bearer <token> on POST /chat.
Admin key
Stored only in this browser (localStorage).
Create an app
Existing apps
| App | Token | Created |
|---|
Integration Guide
HTTP API that gives your agents a Claude brain (text + images). Grab a token in the Apps tab.
Base URL & Auth
Base URL : __BASE__ Auth : header Authorization: Bearer <APP_TOKEN>
Every /chat call needs the Bearer header. No valid token → 401.
POST /chat
Request body (JSON)
| Field | Type | Notes |
|---|---|---|
prompt | string required | The instruction / question. |
images | string[] | 0..N images. Each item = raw base64 or data-URI (data:image/png;base64,…). Formats: PNG, JPEG, WebP, GIF. |
system | string | System prompt (the agent's role). Optional. |
model | string | haiku (default, fast/cheap) · sonnet (balanced) · opus (max quality). |
Response (JSON)
{
"result": "Claude's reply text",
"model": "sonnet",
"cost_usd": 0.0123,
"session_id": "…"
}Examples
cURL (text)
curl -X POST __BASE__/chat \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{"prompt":"Give me 3 house styles.","model":"sonnet"}'Python (text + image)
import base64, requests
img = base64.b64encode(open("plan.jpg","rb").read()).decode()
r = requests.post("__BASE__/chat",
headers={"Authorization": "Bearer <TOKEN>"},
json={
"prompt": "Analyze this floor plan, suggest 3 improvements.",
"images": [img],
"system": "You are an expert architecture agent.",
"model": "sonnet",
})
data = r.json()
print(data["result"], "| cost $", data["cost_usd"])Node.js (fetch)
import fs from "node:fs";
const img = fs.readFileSync("plan.jpg").toString("base64");
const res = await fetch("__BASE__/chat", {
method: "POST",
headers: {
"Authorization": "Bearer <TOKEN>",
"Content-Type": "application/json",
},
body: JSON.stringify({
prompt: "Analyze this plan.",
images: [img],
system: "You are an architecture agent.",
model: "sonnet",
}),
});
const data = await res.json();
console.log(data.result, data.cost_usd);Error codes
| Code | Meaning |
|---|---|
401 | Missing or invalid token. |
400 | Model not allowed, or invalid base64 image. |
429 | Monthly budget cap reached (protects the credit). Retry after reset. |
502 | Claude engine error (timeout, etc.). |
Health / budget
GET __BASE__/health
→ {"ok":true,"apps":[…],"budget":{"month":"…","spent_usd":…,"cap_usd":…}}⚠️ Internal / test use. Runs on the Pi's subscription — switch to the
direct Anthropic SDK before any public production launch. Never share your tokens.
Status
—service
—apps
—spent this month
—monthly cap