Only from your real app
Every request is signed by your app on a real Apple device, so a copied token or request is useless.
Never put provider API keys in your iOS app. Anyone can extract them.
Keep them in App AI Gateway. Encrypted, and never shown again.
Every request is signed by your app on a real Apple device, so a copied token or request is useless.
Verified with your identity provider.
Free users never reach the paid model.
Set a monthly budget per install or user, and per app.
Set request limits per install, per minute and per day.
Block users who abuse AI usage with one click.
Scales automatically, worldwide.
Replies stream to the device token by token.
See what you spend on each provider, day by day.
Cost, tokens and requests for every model.
Cost and requests for every user and every install.
Configure it once. It handles App Attest, signs every request, keeps its token fresh, and sends again once if the token expired. You send a normal URLRequest with any HTTP client.
let gateway = AppAIGatewayClient(
appID: "my-app",
baseURL: URL(string: "https://api.appaigateway.com")!,
authMode: .appAttestInstall
)
let (data, response) = try await gateway.withAuthorizedRequest(
provider: .openai,
providerPath: "v1/responses",
body: body,
contentType: "application/json"
) { try await URLSession.shared.data(for: $0) }Same paths, same bodies, same responses as the provider. Only the host changes, and the Swift client adds the authorization.
# Before
POST https://api.openai.com/v1/responses
# After
POST https://api.appaigateway.com/v1/apps/my-app/proxy/openai/v1/responses
# Same path, same body, same response.See chat, images and voice notes go through the gateway in our open-source demo app.
Read the setup guide or give your agent these instructions. It sets everything up, with no account to create first.
Read https://docs.appaigateway.com/demo-ios-app.md and run the App AI Gateway demo app on my iPhone.
Switch the model in the console. The app you shipped keeps working, no App Store review.
If a provider is down, the request goes to the next model on your list.
Give a feature a name, like summarize. Pick its provider, model and settings in the console.
We also support server applications. Add one with an API key and it gets the same features: usage and cost, rate limits, budgets, and blocking.
When you add a provider key, it is encrypted and stored in a KMS in a separate Cloudflare account. No CI pipeline and no agent has access to that account, so the stored provider keys cannot be read out.
All the code is on GitHub under Apache 2.0, so it can be audited. Nothing about how keys are handled is hidden.
Audit the sourceAsk your agent to set up the gateway for you, the same way you would in the console. It can use the API, the CLI or the MCP server.
Give your agent these instructions. It can start using the gateway right away, before you even have an account.
Read https://docs.appaigateway.com/agents.md and set up App AI Gateway for my app.
$0per month
1,000 requests / month
No card, no expiry
$10per month
10,000 requests / month
Cancel anytime
$39per month
100,000 requests / month
Cancel anytime
$149per month
1,000,000 requests / month
Cancel anytime
You bring your own provider API keys and pay the providers directly. We do not sell or resell AI model access, tokens, or credits.
You can also self-host it. The same code, Apache 2.0, in your own Cloudflare account. You pay Cloudflare and your providers, nothing to us. Deploy to Cloudflare →
Yes, two ways. The hosted service has a free plan with 1,000 requests a month, no card and no expiry. Or you can self-host it: the code is open source under the Apache 2.0 license, and you pay only Cloudflare and your model providers.
On the hosted service, a flat monthly price for a request allowance. It covers the gateway itself: key storage, authentication, limits and usage. It is never a markup on tokens, because the provider keys and the provider bills are yours. Self-hosted, there is nothing to pay us. You pay Cloudflare for the Worker, database and Durable Objects, plus your model providers.
Only requests actually sent to a provider. Anything the gateway refuses on its own, such as a blocked user, an exhausted per-user limit or a disallowed model, costs nothing. The console warns once 80% of the allowance is used, and an exhausted allowance answers 429 with the exact time the next monthly allowance begins.
Requests get a 429 with the reset time until your next monthly allowance begins. Nothing else changes: your apps, keys and settings stay as they are. Upgrade to a paid plan whenever you want more.
Yes. It is the same code either way, so you can take your configuration to your own Cloudflare account, or the other way round.
A key inside an iOS app can be extracted. The gateway keeps the key on the server and only issues short-lived tokens to installs that pass Apple App Attest. Every request is also signed on the device, so even a copied token can't be used. Read How to protect your OpenAI API key in an iOS app.
Other mobile AI gateways, provider-managed access such as Firebase AI Logic, backend platforms and your own server each give you a different mix of security, limits and price. See the comparison of AI gateways for mobile apps.
Encrypted, in a KMS in a separate Cloudflare account that no CI pipeline or agent can reach. A key is never shown again after you add it. Self-hosted, the encryption key is one you generate and keep.
No. Requests and responses keep the provider's own format, and streaming is passed straight through. You change the host, and the Swift client adds the authorization.
Through your identity provider: Firebase, Supabase, Auth0, Clerk, Sign in with Apple, or any custom issuer. The gateway verifies the token, and any claims you require, before it proxies anything. Without sign-in, each install of your app counts as one user.
Yes. A server app authenticates with an API key and can pass a user id, so per-user limits and usage attribution still work.
Try the hosted service, or self-host it in your own Cloudflare account.