App core: billing, relay usage and Teams
The Billing and Relay usage rows in Settings, the out-of-credit and relay allowance notices, and the Teams section.
The Billing and Relay usage rows in Settings, the out-of-credit and relay allowance notices, and the Teams section.
These APIs are part of the Cua Spaces app export for building Spaces UIs. They are source-available under FSL-1.1-MIT and ship for Swift only (import CuaSpacesFFI); the Rust tab shows the cua-spaces-ffi crate they come from. The open source SDK packages for Python, TypeScript and Kotlin do not include them.
The apps take no payment details: the website handles credit and cards. app_billing_status turns Fleet.billing_status into the core's AppBillingStatus, which Settings shows as the credit left and "Manage billing" (the website billing page). A cloud Space that Fleet refuses for want of credit (CuaError::CloudCreditExhausted) shows AppCreditNotice: one line and "Add credit", which opens the same page. Local Spaces never depend on it. app_relay_usage reads the account's relay allowance this month from the relay (GET /v1/usage, as cua usage does); app_relay_usage_view derives the Settings row and, past the allowance, AppRelayAllowanceNotice: one line with Upgrade. Nothing stops at the limit. app_teams turns the account's AppTeamsInput into the Teams rows of Settings: the signed-in state, each team with its people and the role of each.
AppCreditNotice record#| Field | Type | Default | Description |
|---|---|---|---|
text | String | OUT_OF_CREDIT. | |
button | String | ADD_CREDIT. | |
url | String | The website billing page. |
AppBillingCard record#| Field | Type | Default | Description |
|---|---|---|---|
brand | String | visa, mastercard, ... | |
last4 | String | Last four digits. |
AppBillingCredit record#| Field | Type | Default | Description |
|---|---|---|---|
balance_usd_cents / balanceUsdCents | i64 | What is left, US cents. |
AppBillingStatus record#Returned by app_billing_status.
| Field | Type | Default | Description |
|---|---|---|---|
billing_enabled / billingEnabled | bool | Billing is on for this account (off: Settings shows no Billing row). | |
card | Option<AppBillingCard> | The saved default card. | |
credit | Option<AppBillingCredit> | The account's credit, when it has any. | |
billing_url / billingUrl | Option<String> | The website billing page (credit, cards, plans). |
AppRelayAllowanceNotice record#| Field | Type | Default | Description |
|---|---|---|---|
text | String | "You've used your free relay allowance for this month. ..." | |
upgrade | String | UPGRADE. | |
upgrade_url / upgradeUrl | Option<String> | What Upgrade opens; none: no Upgrade button. | |
dismiss | String | DISMISS. | |
dismiss_key / dismissKey | String | What a dismissal remembers: the month and the reasons. A new month, or another limit reached, shows the notice again. |
AppRelayUsage record#Returned by app_relay_usage.
| Field | Type | Default | Description |
|---|---|---|---|
metered | bool | The relay meters this account (false: no allowance applies). | |
period | String | The month counted (2026-10). | |
plan | String | free, pro, team, ... | |
team | Option<AppRelayUsageTeam> | The team whose allowance is pooled. | |
live_sessions / liveSessions | u32 | Live sessions now. | |
live_sessions_limit / liveSessionsLimit | Option<u32> | Live sessions allowed at once (none: no limit). | |
hours_used / hoursUsed | f64 | Relay hours used this month (the team's, when pooled). | |
hours_limit / hoursLimit | Option<f64> | Relay hours allowed this month (none: no limit). | |
my_hours_used / myHoursUsed | f64 | This account's own relay hours this month. | |
soft_limit_reached / softLimitReached | bool | Past the allowance (sessions keep working). | |
reasons | Vec<String> | What is past it: sessions and/or hours. | |
upgrade_url / upgradeUrl | Option<String> | Where to get more (https only; see checked). |
AppRelayUsageTeam record#| Field | Type | Default | Description |
|---|---|---|---|
id | String | Team id. | |
seats | u32 | Seats sharing the allowance. |
AppRelayUsageView record#Returned by app_relay_usage_view.
| Field | Type | Default | Description |
|---|---|---|---|
label | String | ROW_LABEL. | |
line | String | "Live sessions 1 of 2 · Relay hours 6.5 of 20 this month", then the team pool when there is one. | |
plan | String | "Free plan" (empty when the relay names none). | |
notice | Option<AppRelayAllowanceNotice> | Past the allowance. |
AppTeamInput record#| Field | Type | Default | Description |
|---|---|---|---|
id | String | ||
alias | String | The org's slug. | |
name | String | Its display name (empty: use the alias). | |
role | String | The account's role in it. | |
plan | String | free, teams, ... | |
seats | i64 | Paid seats. | |
members | Vec<AppTeamPersonInput> | ||
invites | Vec<String> | Pending invites' emails (only owners and admins can read them). |
AppTeamPersonInput record#| Field | Type | Default | Description |
|---|---|---|---|
email | String | ||
role | String | owner, admin or member. |
AppTeamsInput record#Returned by app_teams.
| Field | Type | Default | Description |
|---|---|---|---|
account_app_url / accountAppUrl | String | The account app for this environment (https://app.cua.ai, or https://app.staging.cua.ai under CUA_ENV=staging). | |
state | AppTeamsState | ||
current_team_id / currentTeamId | Option<String> | The saved current team (AppSettings::current_team_id). |
AppTeamsState enum#.signedOut
.unread
.loading
.failed(message: String)
.ready(teams: [AppTeamInput])| Variant | Description |
|---|---|
SignedOut | Not signed in. |
Unread | Signed in, but this host does not read teams: only the links. |
Loading | Being read. |
Failed | The read failed. Fields: message: String |
Ready | The account's teams (maybe none). Fields: teams: Vec<AppTeamInput> |
app_billing_status#The SDK's billing status as the app core takes it (Settings' Billing row).
func appBillingStatus(status: FleetBillingStatus) -> AppBillingStatus| Parameter | Type | Default |
|---|---|---|
status | FleetBillingStatus | required |
Returns AppBillingStatus
app_relay_usage#The account's relay allowance this month (GET /v1/usage on the relay
devices uses, as cua usage reads it) with account_token; none
from a relay that meters nothing. Both Spaces apps read it here.
func appRelayUsage(devices: Devices, accountToken: String) async throws -> AppRelayUsage?| Parameter | Type | Default |
|---|---|---|
devices | Devices | required |
account_token | String | required |
Returns Option<AppRelayUsage> · Async · Raises CuaError
app_relay_usage_view#Settings' "Relay usage" row and the notice past the allowance; none when the relay meters nothing.
func appRelayUsageView(usage: AppRelayUsage) -> AppRelayUsageView?| Parameter | Type | Default |
|---|---|---|
usage | AppRelayUsage | required |
Returns Option<AppRelayUsageView>
app_teams#The account's Teams (the organizations of GET /v1/me on the Spaces
API for this environment, api.cua.ai or api.staging.cua.ai), each
with its members and pending invites, read with account_token.
Both Spaces apps read Teams here; Settings words them
(app_settings_page's teams).
func appTeams(accountToken: String) async throws -> AppTeamsInput| Parameter | Type | Default |
|---|---|---|
account_token | String | required |
Returns AppTeamsInput · Async · Raises CuaError
16 items, across this page and its subpages, grouped by page (each item's section is on its page). Methods are listed on their object.
App core: billing, relay usage and Teams: app_billing_status, app_relay_usage, app_relay_usage_view, app_teams, AppBillingCard, AppBillingCredit, AppBillingStatus, AppCreditNotice, AppRelayAllowanceNotice, AppRelayUsage, AppRelayUsageTeam, AppRelayUsageView, AppTeamInput, AppTeamPersonInput, AppTeamsInput, AppTeamsState