AI Costs
Every model call has an owner, in USD and BRL
Every model call that goes through the platform Gateway (Assistant, agents, flows, indexing and API) records model, tokens and cost. Monthly usage shows by model, key, person and project, in USD from the provider price list and in BRL at the organization's rate.
Limits sit on top of that record: the organization's monthly cap, each workspace's budget and, with Guard, rules per person, key, model or project that either block or only warn.
How it works
- The x-aiuby-project header tags a call with a project, for budgets and reporting.
- The organization cap applies to the sum of all workspaces; each workspace budget can go up to that cap.
- At the limit, the call is refused with 429 budget_exceeded (workspace or rule) or 429 org_budget_exceeded (organization).
- Warnings at 80% and 100% of each budget, on screen and in the audit log; the email to owners goes out once per limit per month.
- Lowering the cap also lowers any workspace that would end up above it; every budget change is recorded in the audit log, with the before and after values.
- Saved perspectives with an owner, private or shared: filters, dimension and business rules (exact value or prefix) that group AI cost into buckets such as product or customer. Whoever opens one sees only what their own access allows.
const client = new OpenAI({
apiKey: process.env.AIUBY_TOKEN,
baseURL: 'https://aiuby.com/api/gateway/v1',
defaultHeaders: { 'x-aiuby-project': 'atendimento-web' },
})What it does not do
- Calls made directly to the provider, with your own key outside AIUBY, do not show per call; total spend on OpenAI and Anthropic comes in through the cloud cost connector.
- Conversation text is not part of the usage record: only model, tokens, cost, workspace and key.
- A budget cannot be removed, only changed; zero blocks usage.
- Above the self-service cap, the amount can only be changed by the AIUBY team.