Talk instead of typing. When an app turns on voice input, the chat composer
gets a microphone button. Press it, speak, and press it again: the recording
is turned into text and put in the message box, after anything already typed,
for you to read over and send.
Voice input belongs to the realtime feature (builtin.realtime). It is
builtin.realtime
off unless the app asks for it, so no other chat shows a microphone.
Give aiui a realtime manager that can transcribe speech. The bundled
OpenAIRealtimeManager uses OpenAI speech to text (OPENAI_API_KEY, and
OpenAIRealtimeManager
OPENAI_API_KEY
OPENAI_BASE_URL for a compatible server):
OPENAI_BASE_URL
aiui.OpenAIRealtimeManager is the same class. There is no
aiui.OpenAIRealtimeManager
praisonaiui.realtime module: import it from praisonaiui or
praisonaiui.realtime
praisonaiui
praisonaiui.features.realtime.
praisonaiui.features.realtime
Your own backend works too. Subclass RealtimeProtocol and implement
RealtimeProtocol
transcribe:
transcribe
A manager without transcribe keeps the microphone hidden.
aiui.set_realtime_manager(None) turns voice input off again.
aiui.set_realtime_manager(None)
| State | What you see |
|---|---|
| At rest | A microphone icon button before Send ("Record a voice message") |
| Recording | A red stop button and a running time; screen readers hear "Recording". Press the button again to stop and transcribe, or Escape to discard |
| Transcribing | A spinner in the button |
| Done | The text in the message box, with the caret at its end |
The browser asks for the microphone the first time. If access is blocked, a
message says how to allow it in the browser's site settings; no microphone,
or one busy in another app, gets its own message. A recording stops by itself
after two minutes.
The button is keyboard accessible (Tab to it, Enter or Space to start and
stop, Escape to discard) and has a visible focus ring. Its code is a separate
chunk that loads only for an app with voice input on.
| Endpoint | Method | Description |
|---|---|---|
| /api/realtime/voice | GET | {"enabled": bool, "max_seconds": 120, "max_bytes": 8388608}: whether the composer shows the microphone |
/api/realtime/voice
{"enabled": bool, "max_seconds": 120, "max_bytes": 8388608}
| /api/realtime/transcribe | POST | The recording as the raw body (Content-Type: audio/*). Returns {"text": "..."} |
/api/realtime/transcribe
Content-Type: audio/*
{"text": "..."}
/api/realtime/transcribe answers 404 while voice input is off, 415 for a
body that is not audio, 400 for an empty one, 413 over 8 MiB, 501 when the
manager cannot transcribe, and 502 when the speech service fails (its message
is logged by type only, never returned). Both routes need the same
credentials as every other /api route.
/api
The reply is text. Speaking it aloud (see TTS) and a hands-free,
speech-to-speech session are not part of this feature.