See Your AI

App talk API (v1) — contract

A small HTTP API that lets a separate application server on the same machine put its users in conversation with specific bots, by text and by voice. The app owns its own users, profiles and PINs; the harness knows none of that. The harness trusts exactly one thing: the bearer token.

Implementation: src/commands/app-api.ts (keep this file in step with it). Tokens: src/lib/app-tokens.ts. Envelope math: src/lib/wav-envelope.ts.

Where it listens

Tokens

seeyourai app create <name> --bots <bot>[,<bot>…]   # prints the token ONCE
seeyourai app list                                    # names, dates, bots — never tokens
seeyourai app revoke <name>                           # stops working on the next request

Errors

Every error is JSON: { "error": "<human text>", "code": "<machine code>" }, with Cache-Control: no-store. Codes below; a Retry-After header (seconds) accompanies every 503 and 429.

Routes

Base: http://127.0.0.1:4302/api/app/v1. <bot> is a local bot name in the token’s list.

GET /health

The token’s bots only, never the whole fleet.

{
  "bots": {
    "alphabot": { "awake": true,  "busy": false, "running": true,  "waking": false, "state": "awake" },
    "betabot":  { "awake": false, "busy": false, "running": true,  "waking": false, "state": "asleep" },
    "ghostbot": { "awake": false, "busy": false, "running": false, "waking": false, "state": "stopped", "exists": false }
  },
  "features": ["early-transcribe"],  // absent on an older host; ignore names you do not know
  "talk_sdk": "2026.12.1",           // this host's version (its release tag), which is its talk SDK's (docs/talk-sdk.md); absent on an older host
  "talk_sdk_sources": "a0db…"        // the sha256 of its talk SDK sources; null if it cannot say, absent on an older host
}
field meaning
awake ready to take a message right now
busy mid-turn (it is thinking/working); a message still queues behind the turn
running its session exists at all (an idle-stopped bot keeps its session: asleep is not down)
waking being woken; ready in seconds
state awake · sleeping · asleep · waking · stopped (no session)
exists: false in the token’s list but no such bot on this host
talk_sdk (top level) the host’s version: its release tag without the “v” (2026.12.1, 2026.12.2-beta.1), or <last tag>-dev+<sha> off a release. The @seeyourai/talk-sdk it ships is that version: talk-sdk check warns when it is newer than the app’s
talk_sdk_sources (top level) the sha256 of the host’s talk SDK sources (what a build’s dist/build.json calls sources): talk-sdk check fails an app whose tarball of the same version was built from other sources

While any of the token’s bots is waking, /health answers 503 with Retry-After: 5 — and the same per-bot body, so a client watching several bots can see which one is not ready.

Sleep state comes from an idle-stop watchdog’s record, <BOT_DIR>/.watchdog/idle-state.json ({"state": "awake"|"sleeping"|"asleep"|"waking", …}). A missing, unreadable or unknown record means awake — hosts without idle-stop behave exactly as before.

POST /bots/<bot>/messages

// request (Content-Type: application/json, body ≤ 64 KiB)
{ "text": "what's on today?", "idempotency_key": "client-generated-uuid" }
outcome status body
delivered (or queued behind a busy turn) 200 { "id": "<line id>", "busy": false }
bot asleep / falling asleep — accepted, and the line wakes it 202 { "id": "…", "busy": false, "waking": true }
repeat of an idempotency_key with the same text 200 { "id": "<the original id>", "busy": …, "duplicate": true }
same key, different text 409 idempotency_conflict
bot waking 503 + Retry-After: 5 bot_waking — retry with the same key
bot not running 503 + Retry-After: 30 bot_not_running — an operator has to start it
empty / not a string / bad key / bad JSON 400 bad_request
a line that is an [attached …: …] marker 400 attachment_marker (no images in v1; it would name a host file)
text over 4000 characters 413 too_large

GET /bots/<bot>/messages

Long-poll, not SSE.

query behaviour
(no after) the last 30 lines of the app thread, oldest first
after=<id> every line after that id (at most 200; page forward with the last id)
after=<id>&waitMs=<n> held until a bot line lands after <id>, or n ms pass (capped at 25000); a timeout is 200 { "lines": [] }, not an error
{
  "lines": [
    { "id": "…", "role": "user", "text": "what's on today?", "ts": "2026-…Z" },
    { "id": "…", "role": "bot",  "text": "Here is **the** plan: https://…",
      "speech": "Here is the plan: a link", "ts": "…",
      "attachments": [{ "kind": "image", "name": "abc123.png" }] }
  ]
}

POST /bots/<bot>/transcribe

Raw audio in the body; Content-Type one of audio/webm, audio/ogg, audio/wav (audio/x-wav, audio/wave), audio/mp4 (audio/m4a, audio/x-m4a); parameters such as ;codecs=opus are fine. Max 12 MiB.

{ "text": "what's on today", "empty": false }
{ "text": "", "empty": true, "reason": "silence" }   // or "nothing-heard", "too-short"

The host’s local speech-to-text. It does not need the bot to be awake, and nothing but the caller’s own context (below) is put in front of the decoder: no bot name, no host roster and no SEEYOURAI_VOICE_PROMPT. (The dashboard’s own voice input still uses those.) Errors: 415 unsupported_media_type, 413 too_large, 400 bad_context, 429 voice_busy, 503 voice_unavailable, 502 voice_failed, 504 voice_timeout.

?early=1: the clip so far, at a pause that may not be the end (see docs/live-talk.md). Refused with 429 while anyone is being transcribed, given up with 429 as soon as an ordinary clip comes, and stopped when the request is aborted. It never delays anybody; on any error send the finished clip without it. Only send it when /health lists early-transcribe: an older host ignores the parameter and would put the clip in the queue in front of the finished one.

X-Speech-Context (optional): words the speaker may use

POST /api/app/v1/bots/alphabot/transcribe HTTP/1.1
Host: 127.0.0.1:4302
Authorization: Bearer bhapp_…
Content-Type: audio/webm;codecs=opus
X-Speech-Context: teapot%2C%20spout%2C%20handle%2C%20lid

<raw audio bytes>

Which model hears a bot

Two per host: the normal one (SEEYOURAI_WHISPER_MODEL) and an optional alternate, normally larger and slower (SEEYOURAI_WHISPER_MODEL_ALT in the daemon’s environment). A bot uses the alternate when its declaration (<harness home>/bots/<bot>.env) says:

SPEECH_MODEL=alt     # or `default`; nothing else is accepted, and never a path

It is read per request (no restart), applies to the dashboard’s voice input too, and changes the model choice only: no network access, permission or tool depends on it. An unknown value means default and is logged. No alternate configured, or its file missing, means the normal model. For a provisioned bot:

seeyourai provision add    --app <app> --external-id <uuid> --template <file> --speech-model alt …
seeyourai provision update --app <app> --external-id <uuid> --speech-model default|alt [--dry-run]

update changes that one key in the bot’s .env (atomic rename, mode 0600) and refuses any bot provision add did not make.

POST /bots/<bot>/speak

{ "text": "Good morning", "voice": "optional-installed-voice-id", "engine": "piper" }   // voice, engine: optional

Sooner: a reply in pieces

The host renders a whole text before it answers, so a long reply is a long silence. Split the line’s speech yourself and ask for one piece at a time; every piece is an ordinary /speak (with ?envelope=1 too: the envelope is normalized per piece). Two files do it, and import nothing, so copy them:

const left = await playPieces(splitSpeech(line.speech), {
  async render(text, { engine, signal }) {
    const r = await speakViaYourServer({ text, engine: engine ?? undefined }, signal)
    return { clip: r, engine: r.engine, fellBack: r.fellBack }  // X-Voice-Engine; is X-Voice-Fallback there?
  },
  play: clip => yourPlayer.play(clip),  // resolves when it has ENDED; stop the sound yourself on abort
  onStart() {},                         // the first sound of the reply, once
}, abort.signal)
if (left.length) sayAnotherWay(left.join(' '))   // [] = all said, or aborted

Provisioned bots: one locked-down bot per app user

An app can ask the operator for one bot per user. What such a bot is for is the app’s business: the app supplies its CLAUDE.md. The harness names the bot, locks it down and registers it.

seeyourai provision add    --app <app> --external-id <uuid> --template <CLAUDE.md template>
                             [--prefix <p>] [--name "<display name>"] [--about <text> | --about-file <path>|-]
                             [--approver-bot <bot>] [--speech-model default|alt]
                             [--talk-journal THREADS|off] [--talk-journal-guidance PATH]
                             [--otel-endpoint URL] [--json] [--dry-run] [--no-start]
seeyourai provision update --app <app> --external-id <uuid> [--name …] [--about … | --about-file …]
                             [--speech-model …] [--talk-journal …] [--talk-journal-guidance …] [--json] [--dry-run]
seeyourai provision list   [--app <app>] [--json]
seeyourai provision remove (--bot <bot> | --app <app> --external-id <uuid>) [--json] [--dry-run]
seeyourai app add-bot <app> <bot>        # widen an app's bot list (token unchanged, never reprinted)
seeyourai app remove-bot <app> <bot>     # narrow it

Provisioning requests (app → host)

The harness does not listen for these. The app sends them to whoever operates the host (for example as a message to an operator bot), and the operator runs the matching command. The message format is between the app and the operator. Every field is untrusted: check its shape, and that the external id is a UUID v4, before running anything, and report anything off-shape instead of running it.

The app’s user was Command
added provision add --app <app> --external-id <uuid> --template <file> --name <display name> [--about-file <file holding the about>] --json
changed provision update --app <app> --external-id <uuid> --about-file <file holding the about>
removed provision remove --app <app> --external-id <uuid>

What v1 deliberately does not do

v2 / future