Menu

Referência da API · Organização

Consumo de IA

organizations · ai_usage · 2 operações

GET/v1/ai/usage

Get the organization's AI usage and credit balance for a month

organizations.ai_usage.get

LeituraIdempotenteDesde 2026-11-01

Returns how the organization used AI in a calendar month (year_month, YYYY-MM; default the current month): totals (calls, credits, tokens in and out, images, voice seconds and sessions), credits by category (chat, multimedia, voice), and the breakdown by agent, by person (team members, the CRM and Social Inbox AI Team seats, portal clients; names already resolved, each with its share of the credits), by model and by day. It also returns the credit balance of the pool the organization consumes from (balance.org_id and balance.paid_by say whose: an Account that does not pay for itself consumes its workspace's credits). Credits are spent in this order: first the month's credits, which renew with each billing cycle and do not carry over (the plan's, balance.base_plan_credits, plus those of the pool's AI tier if it has one: balance.plan_credits_included is their sum), then the pool's extra credits (balance.extra_credits), which are prepaid, do not expire and stop at a monthly cap set by the owner. For the current month the balance is live (the month's credits included, used and remaining; balance.tier, the AI tier that added credits this period and how many; balance.extra_credits, with what can be used now, the wallet balance, what this period used and the owner's monthly cap in credits; total remaining, which adds the usable extra credits; the renewal date and whether the plan follows the billing cycle or the calendar month); for a past month it is approximate (current plan, without the AI tier or extra credits) and balance.approximate is true. When balance.paid_by is workspace, balance.tier and balance.extra_credits are null: they belong to whoever pays. balance.pack_credits_remaining is deprecated: credit packs were retired on 2026-10-20 and it now carries the usable extra credits, so total_remaining is still plan_credits_remaining plus pack_credits_remaining (read balance.extra_credits instead). Read-only: it never initializes or resets the balance, and AI tiers and extra credits are bought, configured and topped up only in the app, by an owner or an admin (AI Agents > Usage). Usage is recorded under the organization whose credits pay for it, so an Account that consumes its workspace's credits shows its usage in the workspace. In agents, configured_model is the model the agent uses today; what was charged is in models. Credits charged without an agent appear as agent_id unknown ('Sin agente'); image models charge credits without a call, and totals.images counts only the images the tools record. Use organizations.ai_usage.months to know which months have data. Owners and admins of the organization or of its workspace only (403 role_required); 400 invalid_input for a malformed year_month.

Escopo
organizations:read
Permissão
Ver o módulo · Só owner, admin
Tool do MCP
organizations_ai_usage_getNa superfície completa; na compacta, mb_execute_operation com id: "organizations.ai_usage.get".

Custo declarado: até 200 leituras e 0 escritas por chamada (contam na cota diária).

Parâmetros

year_monthstringqueryopcional

The month to read, YYYY-MM (UTC calendar month). Default: the current month.

Resposta

year_monthstring

The month (YYYY-MM).

is_current_monthboolean

True for the current month (its balance is live).

has_usageboolean

False when the organization recorded no AI usage that month.

totalsobject

The month's totals.

credits_by_categoryobject

Credits by category.

agentsarray<object>

By agent, most credits first.

peoplearray<object>

By person, most credits first.

modelsarray<object>

By charged model, most credits first.

dailyarray<object>

By day of the month.

balanceobject | null

The credit balance of the pool the organization consumes from; null when there is none.

Erros

Exemplo

curl "https://api.mb-suite.com/v1/ai/usage" \
  -H "Authorization: Bearer $MB_API_KEY"

Testar com a sua API key de teste

Com uma API key de teste o pedido vai sempre para a sua organização de prática: dados de exemplo que você pode reiniciar.

curl "https://api.mb-suite.com/v1/ai/usage" \
  -H "Authorization: Bearer $MB_TEST_KEY"
GET/v1/ai/usage/months

List the months with AI usage

organizations.ai_usage.months

LeituraIdempotenteDesde 2026-11-01

Lists the calendar months (YYYY-MM, newest first, up to 120) that have AI usage recorded for the organization, to choose the year_month of organizations.ai_usage.get. An organization that never used AI returns an empty list. Owners and admins of the organization or of its workspace only (403 role_required).

Escopo
organizations:read
Permissão
Ver o módulo · Só owner, admin
Tool do MCP
organizations_ai_usage_monthsNa superfície completa; na compacta, mb_execute_operation com id: "organizations.ai_usage.months".

Custo declarado: até 120 leituras e 0 escritas por chamada (contam na cota diária).

Parâmetros

Sem parâmetros.

Resposta

dataarray<string>

Newest first.

Erros

Exemplo

curl "https://api.mb-suite.com/v1/ai/usage/months" \
  -H "Authorization: Bearer $MB_API_KEY"

Testar com a sua API key de teste

Com uma API key de teste o pedido vai sempre para a sua organização de prática: dados de exemplo que você pode reiniciar.

curl "https://api.mb-suite.com/v1/ai/usage/months" \
  -H "Authorization: Bearer $MB_TEST_KEY"