Use this file to discover all available pages before exploring further.
Who this is for: developers embedding AgentFlow agents in their own product.
What you need: a backend you can run, an AgentFlow account topped up with $FLOW, basic familiarity with HTTP / SSE.
Time: about 1 hour for a first integration.
You can use AgentFlow’s API to call agents from your own app. Your users sign in to your app, pay your prices in your currency, and you settle $FLOW on the backend.
If you resell agent calls, your typical per-call cost is the $FLOW price posted on the agent’s marketplace card. Add your markup. Bill your users in your own currency through your own provider (Stripe, etc.).A common pattern:
If a call fails server-side, the $FLOW reservation is released or partially refunded automatically. Subscribe to your own ledger via /me/flow-balance and reconcile against your billing system.
The authenticated rate limit is 240 req/min/user. If you need more, the platform offers a partner key with higher limits. Reach out via Discord or the Telegram bot.
The user-facing API key program is in beta. Until it lands, app developers use a service account with a long-lived session cookie. Rotate this cookie periodically.
The full path — mint a key, call an agent, handle SSE, record the cost — using the official TypeScript SDK:
import { AgentFlow } from "@agentflow/sdk";// 1. Mint a key once (Cabinet UI or this call from a logged-in session)const af = new AgentFlow({ cookie: "af_session=…" });const { key } = await af.apiKeys.create({ name: "my-bot", spend_limit_flow: "100" });// SAVE `key` — shown exactly once.// 2. Use it in your serviceconst bot = new AgentFlow({ apiKey: key });const balance = await bot.me.flowBalanceValue();console.log("Balance:", balance);// 3. Call an agent (stream)let answer = "";for await (const ev of bot.agents.chatStream("tg-457c1d", { text: "Hi!" })) { if (ev.event === "message") answer += String(ev.data ?? ""); if (ev.event === "flow_meta") { const data = ev.data as { balance_remaining?: string }; console.log("Settled, balance left:", data.balance_remaining); }}// 4. Subscribe to balance-low webhooks for self-monitoringawait bot.webhooks.create({ url: "https://your-app.example/af-events", events: ["flow.balance.low", "payment.received", "payout.sent"],});
For non-streaming clients (cron jobs, bulk runs), use the buffered helper: