Skip to content

Documentation navigation

Billing & Usage

Read your Team's plan, usage-vs-limits, and the Team -> project -> API-key usage breakdown via Client.get_usage().

#Billing models

The SDK exports billing and plan-limit read models so applications can validate usage payloads obtained from an authorized application integration:

ModelFields
BillingUsageOne organization's snapshot for a billing period: organization_id, period_start, period_end (strings), optional plan, usage and breakdown.
BillingPlanThe current plan: name, display_name and tier.
BillingCurrentUsageCurrent-period counters and limits: tokens_used, tokens_used_raw, tokens_limit, requests_used, requests_limit, storage_used and storage_limit, each defaulting to 0.
BillingUsageBreakdownThe organization, project and API-key breakdown for the period: organization_id, period_start, period_end, totals and projects.
BillingUsageTotalsPeriod totals: billed_tokens, raw_tokens and requests.
BillingUsageProjectOne project's project_id (optional), project_name, billed_tokens, raw_tokens, requests and its api_keys.
BillingUsageApiKeyOne API key's api_key_id (optional), api_key_name, billed_tokens, raw_tokens and requests.

All of them ignore unknown fields, so a payload with extra keys still validates.

These are data models, not a billing client. The public Client does not expose get_usage() or another billing-fetch method. Obtain billing data through a documented application integration, then validate it explicitly. For the provider-reported token counts of a single run or session, see Client.session_usage() in Usage and Cost.

Python
from maivn import BillingUsage

payload: dict[str, object] = {
    "organization_id": "org-123",
    "period_start": "2026-08-01T00:00:00Z",
    "period_end": "2026-09-01T00:00:00Z",
    "usage": {},
    "breakdown": {
        "organization_id": "org-123",
        "period_start": "2026-08-01T00:00:00Z",
        "period_end": "2026-09-01T00:00:00Z",
    },
}

usage = BillingUsage.model_validate(payload)
print(usage.organization_id)
print(usage.breakdown.totals.billed_tokens)

Treat these models as the schema for a payload, not proof that every declared limit is enforced in every environment. The service that supplies the payload remains authoritative for current plan availability, prices, allowances and enforcement.

#Automatic reload

Automatic reload is a per-organization Portal setting. It is off by default and requires an eligible plan, a saved payment method, and an environment where billing is enabled. The Portal hides the control while hosted billing is disabled.

When available, the setting includes:

FieldMeaning
enabledWhether future reload attempts are allowed.
reload_dollarsWhole US dollars requested for each reload, within the limits returned by the service.
triggerA remaining-percent or remaining-units threshold.
period_cap_centsOptional maximum automatic-reload spend for one billing period.

The readout returns whether reload is available, the current quote for the chosen amount, payment-method readiness, period status, and any paused reason. Use that readout rather than copying plan amounts or rates into application code. Catalog, plan and price values can change independently of the SDK.

A saved payment method needs a United States billing address. A card without one is not saved, and nothing is charged to it.

Saving a setting is not a charge. When billing is enabled, each reload attempt has an idempotent identity so a transport retry refers to the same charge. A failed charge grants no allowance and can pause the setting. Retry timing and notifications, along with allowances and plan eligibility, remain service behavior and must be confirmed in the environment where billing is enabled.

The public SDK does not expose an automatic-reload client. Use the Developer Portal or another documented application integration rather than guessing private service routes.