Wiro Realtime for Kotlin: Voice AI Example for Android
Realtime voice AI for Android in Kotlin and Jetpack Compose: live conversation, speech-to-text and text-to-speech with the Wiro AI API.
Wiro Realtime for Kotlin is the official open-source example for
building realtime voice AI into an Android app with Kotlin, Jetpack
Compose and the Wiro AI API. Its three tabs stream audio over
WebSocket for a live speech-to-speech conversation with barge-in,
live speech-to-text from the microphone, and text-to-speech playback.
The auth, networking, realtime and audio layers have no Compose
dependency, so you can lift them into your own app.
What's inside
Three realtime audio flows, each a tab in the app, each backed by a
live Wiro AI model over one WebSocket protocol:
| Flow | Model | What it does |
|---|---|---|
| Conversation | openai/gpt-realtime-mini |
Full-duplex voice chat with barge-in |
| Transcription | mistralai/voxtral-mini-4b-realtime-2602 |
Live speech-to-text as you talk |
| Speech | openmoss/moss-tts-realtime or openbmb/voxcpm2 |
Streaming text-to-speech playback |
The chrome is Material 3 Expressive, all system components:
Scaffold, TopAppBar, NavigationBar, a floating toolbar for
the live call controls, a wavy progress line driven by the real
microphone level, chat-bubble transcripts, and the Expressive
loading shape while connecting. Light and dark Wiro themes follow
the system. There is no custom orb, wave, or tab bar.
Features
- Live speech-to-speech conversation with voice activity detection,
barge-in, and a noise gate - Realtime microphone transcription with streaming partial results
- Streaming text-to-speech with bounded PCM playback
- One
AudioRecord/AudioTrackgraph for capture and playback,
so the platform echo canceller (AEC) actually works - Signed REST Run requests and the full Wiro AI realtime WebSocket
protocol - Bounded capture/playback queues, safe PCM overflow shedding, audio
route and interruption handling - Cross-feature guard so two tabs never hold the microphone at once
- Automatic reconnect to the same task on socket drops, with a
bounded restart budget - Session lifecycle covered by JVM unit tests and fakes, so no
device is needed to verify the plumbing
Requirements
- JDK 17
- Android Studio (or the Android SDK) with compileSdk 37
- A physical Android phone on API 26 or later (the emulator
microphone is not a usable voice path) - A Wiro AI project and API key
Run
Copy the credential template and set the key:
cp secrets.properties.example secrets.propertiesEdit secrets.properties:
WIRO_API_KEY=YOUR_API_KEY
WIRO_API_SECRET=
WIRO_API_SECRET is only for signature-based Wiro AI projects. Leave
it empty for API-key-only projects. The secrets file is gitignored.
Then open the project in Android Studio, pick a physical phone, and
run the app configuration. Or:
./gradlew :app:installDebugAlternatively, leave secrets.properties empty and set
WIRO_API_KEY (and optionally WIRO_API_SECRET) in the process
environment when you assemble. Environment values win over the
file.
Launch fails fast when WIRO_API_KEY is missing.
Credentials warning: values from
secrets.propertiesor the
environment are compiled into the app binary viaBuildConfig, in
debug and release builds alike, and are for local runs only. Never
distribute builds containing real credentials: production apps
should authenticate through a controlled backend or a short-lived
credential flow.
Make it yours
app/src/main/java/ai/wiro/realtime/app/ConversationConfig.kt
holds the persona, the voice, and the model.
Editing that one file is the whole of turning this example into a
product.
const val PERSONA = "...who the assistant is..."
const val VOICE = "marin"Common changes:
- Give the assistant a job: rewrite
PERSONA. - Change the voice: set
VOICEto any option the model catalog
lists. - Tune the engineering parameters:
parametersoverrides the
catalog defaults for turn detection, audio formats, and rates. - Ship only the conversation: delete
app/src/main/java/ai/wiro/realtime/ui/transcription/,
app/src/main/java/ai/wiro/realtime/ui/speech/,
app/src/main/java/ai/wiro/realtime/services/transcription/,
and
app/src/main/java/ai/wiro/realtime/services/speech/
(plus theirapp/src/testmirrors), then remove the two
destinations from
app/src/main/java/ai/wiro/realtime/ui/home/RealtimeHomeView.kt.
Shared layers undermodels/,networking/,auth/,
realtime/, andaudio/are untouched.
How a conversation runs
REST: https://api.wiro.ai/v1
WebSocket: wss://socket.wiro.ai/v1
Run: POST /Run/{owner}/{model}
POST /Run/{owner}/{model}returns a task id and a task token.- A WebSocket opens and subscribes with
{ "type": "task_info", "tasktoken": "..." }. - After
task_stream_ready, 20 ms PCM chunks stream up as
UTF8(tasktoken + "|") + pcm_bytes; audio and transcripts stream
back. - The app sends
task_session_endon leave, which closes the
session. A quiet session is closed by the server after 30 seconds
without speech, and the app then receivestask_endand
task_postprocess_end.
Audio is signed 16-bit PCM, 24 kHz, mono, little-endian on both
sides.
Authentication is x-api-key alone, or x-api-key + x-nonce +
x-signature where the signature is
HMAC-SHA256(key = API_KEY, message = API_SECRET + NONCE).
Project layout
app/src/main/java/ai/wiro/realtime/
app/ entry config, ConversationConfig, theme
models/ catalog, parameters, run result
networking/ HTTP, endpoints, Run launcher
auth/ credentials, nonce, headers
realtime/ socket, session, framing
audio/ PCM, graph, session
services/ Conversation / Transcription / Speech
ui/ home / conversation / transcription / speech / shared
app/src/test/java/ai/wiro/realtime/
mirrors the app; support/ holds fakes
secrets.properties.example credential template (copy locally)
models/, networking/, auth/, realtime/, and audio/ have
no dependency on Compose or any screen service and cover the whole
Wiro AI integration, so they are the part worth lifting into your
own app.
Tests
WIRO_API_KEY=test ./gradlew spotlessApply detekt \
:app:testDebugUnitTestTests mirror ai.wiro.realtime and ship fakes for audio, network,
and the socket, so the entire session lifecycle runs without a
device. CI runs spotlessCheck, detekt, and the unit tests on
pushes to main and on pull requests.
Contributing
Read CONTRIBUTING.md before opening a pull
request. To report a security problem, follow
SECURITY.md instead of opening a public issue.
Documentation
- Realtime voice guide
- Wiro AI documentation
- Available models
- Same example on other platforms:
Swift ·
Flutter ·
React Native - Kotlin-QuickStart:
WiroKit, the Wiro AI SDK for Android
More from Wiro AI
| Repository | What it is |
|---|---|
| Wiro-MCP | Official MCP server for Wiro AI, @wiro-ai/wiro-mcp on npm |
| Wiro-LLM | Vercel AI SDK provider for chat, images, speech, transcription and video, @wiro-ai/wiro-llm on npm |
| Wiro-Chromium-Extension | Wiro AI extension for Chrome, Edge, Opera and Brave |
| Wiro-Firefox-Extension | Wiro AI add-on for Firefox |
| Wiro-Safari-Extension | Wiro AI extension for Safari on the Mac |
| Wiro-Plugin | Wiro AI plugin for Cursor, Claude Code, Gemini CLI, Devin, Antigravity and Kiro |
| Wiro-Skills | Agent skills for images, image edits, video, music, speech, transcripts, 3D and model search |
| Swift-QuickStart | WiroKit, the Wiro AI SDK for iOS |
| Kotlin-QuickStart | WiroKit, the Wiro AI SDK for Android |
| Dart-QuickStart | Wiro AI SDK for Dart and Flutter, wiro on pub.dev |
| ReactNative-QuickStart | Wiro AI SDK for React Native and Expo, @wiro-ai/wiro-react-native on npm |
| Swift-Realtime | Realtime voice AI example for iOS |
| Dart-Realtime | Realtime voice AI example for Flutter |
| ReactNative-Realtime | Realtime voice AI example for React Native |
| n8n-nodes-wiro | One Wiro AI node for n8n with a searchable model picker, @wiro-ai/n8n-nodes-wiro on npm |
| Wiro-Dify-Plugin | Wiro AI plugins for Dify: the LLM gateway as a model provider, plus image, video, speech and music tools |
| Wiro-ComfyUI | Wiro AI nodes for ComfyUI |
| Wiro-Hermes | Wiro AI plugins for Hermes Agent: image, video, audio and 3D tools, plus the LLM gateway as a model provider |
| Wiro-Zed | Wiro AI MCP server extension for Zed |
| Wiro-Action | GitHub Action for Wiro AI models and the LLM gateway, on the GitHub Marketplace |
| Wiro-Raycast | Wiro AI extension for Raycast: image and video generation, LLM chat and model search |
| Wiro-WordPress | Wiro AI plugin for WordPress: featured images, image edits, alt text, narration and SEO suggestions |
| Wiro-Obsidian | Wiro AI plugin for Obsidian: images, video, speech, music, transcription and text tools |
| Wiro-Blender | Wiro AI add-on for Blender: text to 3D, image to 3D and textures |
| Wiro-Figma | Wiro AI plugin for Figma: images, vectors, image edits and text |
| Wiro-Next-Starter | Next.js starter for Wiro AI: Playground, image, video and audio tools, and LLM chat, ready for Vercel and Railway |
| Wiro-Docs | Source of the Wiro AI API docs |
| wiroai.github.io | Every open-source project from Wiro AI on one page, with a page for each repository |


