/v1 surface for chat and embeddings and the OpenAI-compatible surface at
/openai/v1 for images. Roadie holds your provider keys (BYOK), meters usage
per device, and enforces free-vs-pro limits.
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. Chat and embeddings
Chat and embeddings are the simplest calls and live on Roadie’s native/v1 surface. Send a
message and read the reply:
roadie.chat.stream(_:) (an AsyncThrowingStream of typed
events), and embed text with roadie.embeddings.create(_:). See the
RoadieKit reference for the full chat, streaming, and embeddings API, and the
Send a message tutorial for an end-to-end walkthrough.
4. Generate an image
images.generate creates an image from a prompt alone and returns the generated image’s raw PNG
bytes:
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 (when omitted, generate defaults to .opaque and edit
to .transparent); quality is .low, .medium, .high, or .auto.5. 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.
6. 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.
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.
Send a message
Set up the SDK, send a chat message through Roadie, and get a reply.
RoadieKit reference
The full chat, embeddings, and image API, plus the token providers.
Android quickstart
The same for Android, with the Kotlin SDK and Play Integrity device auth.