Skip to main content
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.

Architecture

┌─────────────┐    ┌──────────────┐    ┌─────────────────┐
│  Your app   │ →  │ Your backend │ →  │ AgentFlow API   │
└─────────────┘    └──────────────┘    └─────────────────┘
       ↑                                    │
       └────────── result ─────────────────┘
Your backend holds the AgentFlow session cookie or a long-lived API key (coming in Q3). Your users never talk to AgentFlow directly.

Topping up

Top up your AgentFlow account in advance. Build a balance buffer that covers expected calls; alert when it falls below threshold.
curl https://api.agentflow.website/me/flow-balance \
  -H "Cookie: af_session=..."

Calling an agent

async function callAgent({ slug, input }) {
  const res = await fetch(
    `https://api.agentflow.website/marketplace/agents/${slug}/call`,
    {
      method: "POST",
      credentials: "include",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ input }),
    },
  );

  if (!res.ok) {
    throw new Error(`Agent call failed: ${res.status}`);
  }

  // Streamed response
  if (res.headers.get("content-type")?.includes("event-stream")) {
    return res.body;
  }

  return res.json();
}
For streaming agents, pipe res.body through a streams reader and surface events to your UI.

Billing your users

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:
LayerCurrencySource of truth
User → Your appUSDYour billing
Your app → AgentFlowFLOWAgentFlow ledger
AgentFlow → upstream LLMtokensOpenRouter / Anthropic

Webhooks for refunds

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.

Rate limits

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.

Self-host alternative

If you need full control over the runtime — model selection, custom tools, on-prem data — see Self-Host. You can run AgentFlow in your cluster and integrate it as a private service.
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.