Architecture / design direction
One request. Explicit trust boundaries.
The proposed Relaykit flow moves model-provider credentials off devices and puts identity, permissions and consumption controls in front of every model call. This describes the intended architecture, not a production SLA.
01 / Mobile client
Request and user session
The app obtains your product's user session and sends a model request to the gateway. Optional platform integrity assertions are sent as supporting evidence. The client must never hold a long-lived OpenAI, Anthropic or Gemini credential.
02 / Identity boundary
Authenticate, then authorize
Verify the session's signature, expiry, audience and application context. Map that identity to an app and entitlement. A recognized user can still be denied access to a model or spending tier.
03 / Integrity boundary
Verify app claims when supported
Validate App Attest or Play Integrity server-side, including challenge binding and freshness. Define a documented fallback and failure policy instead of treating every unsupported device as malicious.
04 / Policy boundary
Reserve budget before forwarding
Check per-user and app quotas, eligible models, request-size caps and account status. Reserve capacity atomically so concurrent requests cannot bypass limits. Release or reconcile reservations on failure and timeout.
05 / Provider boundary
Route with server-side credentials
Select the configured provider and model, enforce timeouts, sanitize errors, and stream or return the response. Provider credentials stay in trusted infrastructure, never in the SDK or browser.
06 / Accounting boundary
Reconcile actual cost and response
Attribute token usage and estimated cost to the authenticated user and application. Reconcile against provider billing; account for streaming cancellation, retries, cache hits and missing usage fields. Avoid storing prompt content unless explicitly required and disclosed.
Build with us
Designing mobile AI infrastructure for your app?
Join the early-access list and tell us which provider, platform and usage limits matter. No sales call required to register, and we won't claim a launch date we can't meet.
Join the early-access waitlist