Developer Documentation

Run hosted AI scenarios from your own code. Build a flow visually in the portal, publish it, and call it from anywhere.

What you can build

Every scenario you build in the LetBe.ai portal can be published and then executed from your own software through the public API. The same API powers LetBe.ai's own products, including Truth, Talk, and Automate. Your integration gets hosted AI workflows with models, guardrails, retrieval from your documents, speech-to-text, and text-to-speech already wired in, so your code only sends input and reads the reply.

Quickstart

Working with an AI coding agent? Point it at the machine-readable guide: portal.letbe.ai/developer-agent.md. A Postman export is available from the in-portal docs.

Authentication

Run a published scenario

POST https://letbe.ai/api/v1/chat/next with a JSON body of flowId, state, and userInput. Start with an empty state; every response returns a new opaque state that you send back on the next call. The response also tells you whether the scenario expects more user input (expectingUserInput), what kind (expectingInputType), and whether the run is finished (done).

Send audio

POST https://letbe.ai/api/v1/chat/next/audio as multipart/form-data with flowId, optional state, optional windowSeconds, and the audio file field. Use it when a scenario step expects spoken input; the platform transcribes and continues the flow in one call.

Knowledge and retrieval

Scenarios can answer from your own documents. Manage retrieval collections and files through the /api/v1/rag endpoints or in the portal, then reference the collection from a scenario block. Uploads support common document formats, including scanned files.

Billing

API calls run on the same prepaid wallet as everything else on LetBe.ai: usage is billed to the account that owns the API key, with per-use pricing by model and processing type. When a wallet runs out, the API responds with a clear out-of-funds error instead of failing silently. See pricing for how credits work.

Publish and earn

When other users run a scenario you have published, a share of that usage comes back to your wallet as credits. It is a way to offset your own usage by sharing useful flows, not a cash payout.

Errors and rate limits

Every error is JSON with the same envelope: { "code", "message", "hint", "docs" }. code is stable and safe to branch on; message is for people; hint says what to do next when the platform can tell. Unknown API routes answer HTTP 404 in this shape, never an HTML page. A wallet that cannot cover the step answers HTTP 402 with walletLimit: true; top up in the portal and retry the same call with the same state.

Upload and delete endpoints are throttled per client IP. They carry the IETF RateLimit and RateLimit-Policy headers on every response and answer HTTP 429 with a Retry-After value in seconds when the window is spent. Other endpoints are limited by the prepaid wallet, not by request rate. Traffic that looks abusive may also be answered at the edge with 429 or 403; honor Retry-After whenever it is present.

Machine-readable discovery

Useful links