The Roadie Android SDK is a Kotlin client for chat, embeddings, and images. It authenticates each device anonymously — no login screen and no provider key in the app — via Google Play Integrity, and calls the gateway at . Roadie holds your provider keys (BYOK), meters usage per device, and enforces free-vs-pro limits. This quickstart wires the SDK into an app, sends a chat message, and generates and edits images. For the full API — streaming, embeddings, images, and the token providers — see the Android SDK reference.

Prerequisites

In the dashboard:
  1. Create a project (its development and production environments are created for you).
  2. Connect a provider credential (BYOK) for the models you’ll call. Chat needs a chat provider such as OpenAI or Anthropic; images use gpt-image-1, so an OpenAI key. See Providers & BYOK.
  3. Create a publishable key (rd_pk_…). It ships in the app and can only mint device tokens — it cannot call model endpoints.
  4. For local development, create a secret key (rd_sk_…) or pre-mint a client token to use as a static bearer while you build.
  5. For production device auth, enable Play Integrity device attestation on the project. See Android device auth setup.

1. Install the SDK

Add the SDK to your app module’s build.gradle.kts. roadie-playintegrity brings roadie-core in transitively, so a production app needs only the one dependency:
build.gradle.kts
The SDK requires minSdk 24 and JDK 17. If your app’s minSdk is below 26, enable core library desugaring — see Requirements.

2. Configure the client

A Roadie 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 (an rd_sk_… key or a pre-minted client token). The working dev path; inject it through a BuildConfig field rather than a committed literal.
  • PlayIntegrityTokenProvider — silently mints a per-device client token via Google Play Integrity, using the publishable key. The production path; it needs a real device with Google Play Services (Play Integrity is unavailable on bare emulators).
Keep configuration out of source: inject the base URL, publishable key, and static token through BuildConfig fields (from Gradle properties or the environment), so a secret is never committed or shipped in a Release build.

3. Chat and embeddings

Chat and embeddings are the simplest calls. chat.create sends your message and returns the normalized response. The assistant’s reply is on response.text (a convenience over response.message), alongside token usage, an estimated cost, and the gateway requestId. It is a suspend function, so call it from a coroutine:
model accepts an explicit provider/model id (like openai/gpt-4o) or a project alias you configure (like smart) that fails over across providers. See Models, aliases & fallback.
To stream tokens as they arrive, collect roadie.chat.stream(...) — a cold Flow<ChatStreamEvent> — and append each ContentDelta.delta. Embed text with roadie.embeddings.create(...). See Chat in the SDK reference.

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 edited 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 a RoadieException; a cancelled coroutine surfaces CancellationException. Branch on the sealed subclass:
The SDK re-mints once on a 401 (an expired client token) and retries transient network and 5xx failures for you. A QuotaException is your cue to show the paywall — see Free → Pro entitlements.

Next steps

Android SDK reference

The full chat, embeddings, image, and token-provider API.

Android device auth setup

Configure Google Play Integrity for production device auth.

Send a message

The end-to-end tutorial for a first chat call.

Mobile device auth

How anonymous device attestation mints client tokens with no account.