You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: support xAI Grok TTS and STT in the AI speech/transcription routes #56041
The @opencode/ai package ships speech generation and transcription routes for six providers (OpenAI, ElevenLabs, Cartesia, Deepgram, Google, AssemblyAI), but xAI's Grok Speech APIs have no route yet. The chat side already supports xAI, and the grok-voice-* realtime engine is in flight in #55951.
xAI documents both speech APIs as first-party REST endpoints:
Text to Speech: POST https://api.x.ai/v1/tts — JSON in, raw audio out. Up to 60,000 characters, expressive voices (voice_id, default eve), language required (BCP-47 or auto), mp3/wav/pcm/mulaw/alaw output, speed 0.7–1.5, speech tags and pronunciation replacements.
Speech to Text: POST https://api.x.ai/v1/stt — multipart with file last (or url), model grok-voice-transcribe-2.0, word-level timestamps always returned, optional diarize, repeated keyterm, inverse-text-normalization via format=true, up to 500 MB / 8 channels.
xai-speech: lower SpeechRequest to voice_id, language (defaulting to auto), output_format.codec, and speed; reject instructions, timestamp requests, and codecs xAI does not produce; describe the returned audio from the codec actually sent.
xai-transcription: lower to the multipart form with file last (or a url field for URL sources); support diarize, word-timestamp answers, and repeated keyterm through provider options; map words/speakers, language, duration, and seconds usage.
Tests: lowering and rejection coverage, plus replayed cassettes for both routes.
I have a working implementation and will open a PR.
Thanks for the detailed proposal! You're asking for xAI Grok text-to-speech (/v1/tts) and speech-to-text (/v1/stt) routes in @opencode/ai, next to the existing speech and transcription providers. Right now packages/ai has xAI routes for chat, images and video, but not for speech or transcription.
Maintainers will consider it, and your PR will be reviewed with it.
Activity
opencode-agent commentedon Oct 16, 2026
Thanks for the detailed proposal! You're asking for xAI Grok text-to-speech (
/v1/tts) and speech-to-text (/v1/stt) routes in@opencode/ai, next to the existing speech and transcription providers. Right nowpackages/aihas xAI routes for chat, images and video, but not for speech or transcription.Maintainers will consider it, and your PR will be reviewed with it.
Related:
grok-voice-*realtime work)