FlowPrime guides
The AI gateway gives your workspace one OpenAI-compatible endpoint in front of the model providers you register (OpenAI, OpenRouter, Google, Anthropic, or any OpenAI-compatible server). Your product calls a route alias such as chat-default; the gateway picks the provider and model, falls back when one fails, and writes every call to a usage ledger with tokens, cost and latency. Use it when your product calls an LLM and you need the cost per customer or per run, or a public chat bot for a website.
| Capability | How | Status |
|---|---|---|
| Register a provider account (your own API key) | dashboard (AI > Providers) | dashboard |
| Define routes: alias to ordered provider/model targets with fallback | dashboard (AI > Routes) | dashboard |
| Try a route live | dashboard (AI > Playground) | dashboard |
| Chat completions, streamed or not | REST POST /v1/chat/completions (OpenAI shape, model = route alias) |
live |
| List the route aliases a caller may use | REST GET /v1/models |
live |
| Public website chat bot bound to one route and system prompt | dashboard (AI > Website bots) to create; REST POST /v1/bot/{slug}/chat to call |
live |
| Cost totals for a window, by route, model, client tag and day | ai_usage_summary |
live |
| The usage ledger, one row per call | ai_usage_records |
live |
Your workspace's own ffai_ gateway key |
not handed out | planned |
mock provider needs no key and answers canned replies.chat-default, with one or more targets (provider + model, priority, weight). Your code only ever names the alias, so models can change without a deploy.platform sign-in app (auth_create_oidc_app surface=platform grantTypes=client_credentials; how to get the token is in platform_guide topic=auth). It reaches chat, models, routes and usage.customer app. It reaches chat and models only, and its calls are always booked under the customer's own identity (see the client tag below).https://{org}.ai.fastflow.tech in production, https://{org}.ai.fastflowtech.ai on staging. Send X-Org-Slug: {org} as well. {org} is your workspace slug (auth_get_org).auth_create_oidc_app name="Example backend" surface=platform grantTypes=client_credentials. The client secret is shown once: store id and secret as server secrets.token_endpoint from the discovery document whose URL auth_get_org returns in endpoints.discovery.POST to it, form-encoded: grant_type=client_credentials&client_id=...&client_secret=.... The answer's access_token lasts expires_in seconds (60 minutes). Cache it and fetch a new one shortly before it ends; do not fetch one per call.GET /v1/models with Authorization: Bearer <token> and X-Org-Slug lists the aliases. Use one that exists.curl -s https://{org}.ai.fastflow.tech/v1/chat/completions \
-H "Authorization: Bearer <token>" -H "X-Org-Slug: {org}" \
-H "X-FF-Client: myapp:summary:acct_42:" -H "Content-Type: application/json" \
-d '{"model":"chat-default","messages":[{"role":"user","content":"Summarize this ..."}],"stream":false}'
With the OpenAI Python SDK:
from openai import OpenAI
client = OpenAI(base_url=f"https://{org}.ai.fastflow.tech/v1", api_key=token,
default_headers={"X-Org-Slug": org})
reply = client.chat.completions.create(
model="chat-default",
messages=[{"role": "user", "content": "Summarize this ..."}],
user=f"myapp:summary:{account_id}:") # the client tag
print(reply.choices[0].message.content, reply.usage)
The SDK sends the token as Authorization: Bearer, which is what the gateway expects."stream": true passes the provider's server-sent events through, with usage captured from the final chunk.user field, or the X-FF-Client header when user is absent. Build it as a prefix you can query later, e.g. myapp:<feature>:<customer>:<run>:. Only backend credentials (team or client-credentials tokens) set the tag. A customer's own token cannot: its user field and X-FF-Client are ignored for the ledger, which books the call as account:<account id> (its seat), else user:<sub>.ai_usage_summary days=7 clientPrefix="myapp:summary:acct_42:" answers requests, tokens, costUsd, average latency, errors, fallbacks and abandoned calls, with breakdowns by route, model, client tag and day, all narrowed to that prefix.ai_usage_records clientPrefix="myapp:summary:acct_42:" limit=50 lists the calls themselves, newest first, with total for paging.fetch("https://ai.fastflow.tech/v1/bot/<slug>/chat", {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ sessionId: "s_1", messages: [{ role: "user", content: "Do you ship to Portugal?" }] })
});
No credential: the bot is bound to your workspace, route and prompt on the server. Over the limit it answers 429 rate_limited.| Answer | Meaning | Do |
|---|---|---|
400 body.model must carry a route alias |
no model |
send a route alias |
404 Unknown route '...' |
no route with that alias | GET /v1/models, or create it in the dashboard |
409 route has no enabled targets |
every target of the route is off | enable a target in the dashboard |
403 Token org does not match target org |
X-Org-Slug names another workspace |
send your own slug |
403 customer_only |
a customer token on a team route (routes, providers, usage) | use the backend token |
429 rate_limited |
a website bot's per-visitor limit | slow down, or raise the bot's limit |
model is a route alias, not a provider model name. A name with no route answers 404 Unknown route; a route with no enabled target answers 409; no model answers 400.aborted) with its real cost. Stream when users may cancel.clientPrefix is literal and case-sensitive. End it with your separator: ...:843 also matches ...:8430, ...:843: does not.ai_usage_summary answers what the provider charged, so it reconciles with the provider's invoice. A workspace with no AI usage answers zeros, not an error.403). Connect as a member or admin.account:<id> or user:<sub>, so query those to see what customers spent directly. Tag-based billing needs backend calls.ai_usage_summary: totals and breakdowns for the last days (1 to 365, default 30), optionally narrowed by clientPrefix.ai_usage_records: ledger rows with limit/offset and filters route, client, clientPrefix.service_contract service=ff-ai.platform_guide topic=auth for tokens, platform_guide topic=observability for errors in the code that calls the gateway.platform_guide)platform_guide topic=analytics)platform_guide topic=auth)platform_guide topic=feedback)platform_guide topic=mail)platform_guide topic=marketing)platform_guide topic=marketplace)platform_guide topic=newsletter)platform_guide topic=observability)platform_guide topic=payments)platform_guide topic=pilot)platform_guide topic=reporting)platform_guide topic=storage)platform_guide topic=webhooks)