@genie in CHAT — flows through the AI Gateway. You never manage per-feature API keys or worry about which model an individual feature uses. Instead, the gateway handles provider routing, enforces your plan’s token budget, redacts PII before any data leaves your tenant, and writes a cost row for every request so you always know what you spent and why.
All CyberOS AI features (Genie/CUO, skill runs, KB Q&A, CHAT @genie) use the AI Gateway — there is no separate API key to manage per feature. The AI Gateway is a P0 module, currently in progress.
Model routing and providers
The gateway routes every inference request across three provider families based on your data residency setting and the capability required.Anthropic Claude
Claude models (Haiku, Sonnet, Opus) for conversational reasoning and long-context tasks. Used for chat-smart and chat-reason alias classes.
OpenAI
GPT family for chat-fast and image generation alias classes. Available in us-1 and sg-1 residencies.
AWS Bedrock
Regional Bedrock endpoints for sg-1, eu-1, us-1, and vn-1 tenants. Keeps data inside your compliance region when Bedrock is the provider in scope.
Model alias resolution
You and your agents reference models by alias, not by raw model ID. The gateway resolves aliases to the specific endpoint appropriate for your residency.Residency × provider
Your data residency setting (chosen at signup and locked thereafter) determines which provider endpoints the gateway uses, keeping data in your compliance region.Per-tenant cost controls
Monthly AI token quota
Your token budget is set by your plan tier. The gateway checks your remaining quota before every request, not after.When your monthly quota is exhausted, requests return a
402 COST_CAP_EXCEEDED error with a clear message. Requests are never silently dropped or charged — the cap is a hard block, not a soft warning.Cost cap enforcement
The gateway uses a two-step accounting model:1
Pre-call check
Before forwarding a request to the provider, the gateway checks your tenant’s cost ledger. If the estimated token cost would exceed your remaining budget, the request is refused immediately and no provider call is made.
2
Cost hold
For requests that pass the pre-check, the gateway places a 60-second cost hold on the estimated amount. This prevents concurrent requests from collectively overshooting the cap before reconciliation.
3
Post-call reconcile
After the provider responds, the gateway reconciles the actual token usage against the hold and writes a final cost row to the ledger. The hold is released and your running balance is updated.
Cost ledger
Every AI request produces a cost row you can inspect in your billing dashboard. Each row records:- Tenant and module — which CyberOS module triggered the request (e.g.
chat,skill,kb) - Agent persona — the CUO variant or skill that authored the call
- Model used — the resolved alias and provider
- Token counts — input tokens, output tokens, and total cost in USD
- Failover path — whether the request hit the primary provider or a fallback
- Cache state — whether the response was served from cache (no cost charged for cache hits)
PII redaction
The gateway automatically scans every prompt and every provider response for PII before logging, caching, or writing an audit row. Redaction happens in-process — PII never reaches the log pipeline or the LangSmith AI trace store in unredacted form.What counts as PII
- Vietnamese PII
- International PII
Usage dashboard
Open Settings → AI Usage in your CyberOS dashboard to see:Token consumption
Your running token total for the current billing cycle, how much of your quota remains, and a daily breakdown chart.
Cost by module
Token spend broken down by CyberOS module (chat, skill, kb, etc.) so you can see which features drive the most AI cost.
Cost by skill
For tenants using custom skills, a per-skill cost breakdown lets you identify expensive automation workflows.
Top consumers
A ranked list of members (or agent personas) by token consumption for the period — useful for spotting runaway agent sessions.
Viewing the cost ledger
You can query individual cost rows from the billing dashboard or via the GraphQL API:Provider failover
The gateway automatically handles provider degradation so your workflows keep running.Failover behaviour
Failover behaviour
The
failoverPath field in every cost row records whether the request used the primary provider or a fallback, so you can see the impact of provider outages in your cost ledger.