/openai/v1. Roadie holds your
OpenAI key (BYOK), meters usage per device, and enforces free-vs-pro limits.
RoadieKit is images-only today (generation and editing). For chat and embeddings on iOS,
point a third-party OpenAI-compatible Swift client at the same surface — see
chat on iOS below and the
OpenAI drop-in page.
Prerequisites
In the dashboard:- Create a project (its
developmentandproductionenvironments are created for you). - Connect an OpenAI provider credential (BYOK). Image generation uses
gpt-image-1, so an OpenAI key is required. See Providers & BYOK. - Create a publishable key (
rd_pk_…). It ships in the app and can only mint device tokens — it cannot call model endpoints. - For local development, create a secret key (
rd_sk_…) or pre-mint a client token to use as a static bearer while you build (see step 2). - For production device auth, enable device attestation on the project (Apple App Attest). See Mobile device auth.
1. Install RoadieKit
Add RoadieKit with Swift Package Manager. In Xcode, choose File → Add Package Dependencies… and enterhttps://github.com/paroaria/roadiekit.git, or add it to Package.swift:
2. Configure the client
ARoadie client needs a RoadieConfig (where the gateway lives) and a token provider (how
each request is authenticated). Swap the provider between local development and production without
changing any call site:
StaticTokenProvider— a fixed bearer read from the run scheme’sROADIE_STATIC_TOKENenvironment variable (anrd_sk_…key or a pre-minted client token). The working simulator / dev path.AppAttestTokenProvider— silently mints a per-device client token via Apple App Attest, using the publishable key. The production path; it needs a real device (App Attest is unavailable in the simulator).
3. Edit an image
images.edit takes the source PNG bytes and a prompt and returns the generated image’s raw PNG
bytes. mask is optional; when present, only the masked region is regenerated.
images.generate:
The image model defaults to
gpt-image-1 (set RoadieConfig.imageModel to change it), and n
defaults to 1. size is one of .auto, .square, .landscape, .portrait; background is
.transparent, .opaque, or .auto.4. Handle errors
Every HTTP or decoding failure is thrown as aRoadieError; task cancellation is Swift’s own
CancellationError. Branch on error.kind:
insufficientQuota error is your cue to show
the paywall — see Free → Pro with StoreKit.
Chat and embeddings on iOS
RoadieKit does not cover chat. Point any OpenAI-compatible Swift client at the same surface — the base URL and bearer token are the only changes:Next steps
Anonymous device auth
How App Attest mints per-device client tokens with no account.
Free → Pro with StoreKit
Convert the free tier to a paid subscription and flip the device’s plan.
Image enhance tutorial
A complete image-editing feature end to end.
RoadieKit reference
The full image API and token providers.