AppAIGatewayDocs

Quickstart

Add a provider key, create an app, and send your first AI request in a few minutes, from a server with curl or from an iOS app.

This page takes you from an empty console to a working request. It uses a server application, because that is the shortest path: one key, one curl command. The last section shows the same thing for an iOS app.

Sign up at console.appaigateway.com. The sidebar shows the same three steps as this guide until your first request goes through.

Self-hosting

Open your own console and replace https://api.appaigateway.com in the examples with your gateway's API address. If you have not deployed yet, follow Self-hosting first.

Prefer a terminal or coding agent? Follow the CLI guide or Use with AI agents. Sign in to your existing account before creating resources so they appear in the same console.

1. Add a provider key

Open Providers and click Add provider.

  • Name is how the provider is listed, for example Prod OpenAI.
  • Provider is the service the key belongs to. This guide uses OpenAI.
  • Authentication stays on API key. Paste the key you got from the provider.

Click Test provider if you want the gateway to confirm the key works, then Add provider. The key is encrypted on arrival and never shown again. The list shows only its last characters so you can tell keys apart.

The first provider of each type gets a short name, its slug, that your app uses in URLs. The first OpenAI key is openai, the first Anthropic key is anthropic, and so on. See Add a provider key for several keys of one type.

2. Create an app

Open Apps and click New app.

  1. Application name: anything you like. The gateway builds the app's ID from it, for example example-app-a1b2c3.
  2. Application type: choose Server.
  3. User authentication: choose No user identity for now. You can turn on per-user identity later on the app's Auth policy page.
  4. Click Create app.

A dialog titled Your application is ready shows the app's API key. It is shown once, so copy it now and keep it somewhere safe. The dialog also shows the Base URL your app will call:

https://api.appaigateway.com/v1/apps/example-app-a1b2c3/proxy/{provider}/{provider_path}

{provider} is the provider slug from step 1, and {provider_path} is the provider's own API path.

3. Send a request

Put the key in an environment variable and call OpenAI's Responses API through the gateway. Replace the app ID with yours.

export APP_AI_GATEWAY_KEY="agw_…"

curl --fail-with-body https://api.appaigateway.com/v1/apps/example-app-a1b2c3/proxy/openai/v1/responses \
  -H "Authorization: Bearer $APP_AI_GATEWAY_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"model":"gpt-5.6-sol","input":"Say hello."}'

The response is OpenAI's own, unchanged. Everything after /proxy/openai/ is the path OpenAI documents, and the body is the body OpenAI documents. The gateway added your provider key on the way out and recorded the request on the way back.

If you use an SDK instead of curl, point it at the gateway and keep everything else:

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["APP_AI_GATEWAY_KEY"],
    base_url="https://api.appaigateway.com/v1/apps/example-app-a1b2c3/proxy/openai/v1",
)

4. See it in the console

Open the app and go to Usage. The request is in Recent events with its model, tokens, cost and latency, and the chart above it shows the day's spend. The Apps page now shows month-to-date spend and requests across all your apps.

If something failed

ResponseWhat it means
502 provider_not_configuredNo provider has the slug in the URL. Check the Providers page.
400 pricing_not_configuredThe model is not in the price catalog. Add a price under the provider's Pricing action, or use a catalogued model.
401 auth_requiredThe key is missing or wrong, or the app was created as an iOS app.
403 path_not_allowed or model_not_allowedThe app's Provider access restricts paths or models. New apps allow inference endpoints and priced models.

The full list is in Errors and limits.

The same for an iOS app

An iOS app has no key to ship. Instead the app proves it is a real install of your app with Apple App Attest, and the gateway gives it a short-lived token.

  1. New app, type iOS application. Enter your Apple Team ID and Bundle ID from your Apple Developer account and Xcode.
  2. User authentication: choose Unauthenticated users to start. Each install then counts as one user, with the default limits of 100 requests a minute and 10,000 a day.
  3. Add the AppAIGateway Swift package to your project and send a request:
import AppAIGateway

let gateway = AppAIGatewayClient(
    appID: "example-app-a1b2c3",
    baseURL: URL(string: "https://api.appaigateway.com")!,
    authMode: .appAttestInstall
)

let (data, _) = try await gateway.withAuthorizedRequest(
    provider: .openai,
    providerPath: "v1/responses",
    body: Data(#"{"model":"gpt-5.6-sol","input":"Say hello."}"#.utf8),
    contentType: "application/json"
) { try await URLSession.shared.data(for: $0) }
print(String(decoding: data, as: UTF8.self))

App Attest needs a real device. It is not available in the Simulator. The Apps page generates this snippet for your own app once it exists, and iOS with the Swift package covers sign-in, token refresh and error handling.

To see a complete app first, run the demo app on your iPhone: it chats, generates images and transcribes voice notes through a gateway app of your own.

Next steps

  • Limits to cap what a user and an app may spend.
  • User authentication to tie requests to signed-in users from Firebase, Supabase, Auth0, Clerk or your own issuer.
  • Custom endpoints to keep the model and parameters on the gateway, so you can change them without an app release.
  • Automation and agents to hand the setup to a script or an AI agent.

On this page