Repository navigation
Description
Context
content-core wants timestamped segments from transcriptions on a best-effort basis (lfnovo/content-core#119). It will read TranscriptionResponse.segments and fall back to plain text when it is None. That works today for OpenAI/Groq Whisper, Azure Whisper and Deepgram. Several other STT providers drop timing data that their endpoint can return, so callers using them get plain text even when the backend has segments.
Checked on main (2.28.0), src/esperanto/providers/stt/.
Gaps
OpenAI-compatible (openai_compatible.py)
Builds TranscriptionResponse(text=response_data["text"], ...) (lines ~282 and ~340) and sends no response_format. Whisper-based servers behind this provider (Speaches/faster-whisper-server, LocalAI, whisper.cpp server, vLLM Whisper) support verbose_json with the same segment shape as OpenAI.
Proposal: reuse _resolve_transcription_response_format(model, config.get("response_format")) and _build_transcription_response(...) from base.py, as openai.py/azure.py already do. Keep the allowlist behavior (only Whisper-named models get verbose_json, config["response_format"] overrides) so non-Whisper servers keep working.
Mistral Voxtral (mistral.py)
Already maps through _build_transcription_response, so it would fill segments if the payload had them. But _build_request_data never sends timestamp_granularities, so the API returns no segments. Proposal: request timestamp_granularities=["segment"] (verify against the current Mistral transcription API and whether it conflicts with language).
OpenRouter (openrouter.py)
Only text, language, duration and usage are mapped. Check whether the OpenRouter transcription endpoint returns segments for any model. If it does, map them. If not, document it as unsupported per "Unsupported Response Fields Stay None".
Out of scope (already decided)
- ElevenLabs: word-level only, tracked in feat(stt): add word-level timestamps (TranscriptionWord) to TranscriptionResponse #194 (
wordsonTranscriptionResponse). No pseudo-segments. - Google (Gemini
generateContent): won't fix per feat(stt): expose segments for Azure, ElevenLabs, Google STT providers #185, no structured timestamps.
Acceptance
- OpenAI-compatible with a Whisper model returns
segmentsandduration. A non-Whisper model still getsjsonandsegments=None. - Mistral returns
segmentswhen the API provides them. - OpenRouter is either mapped or documented as unsupported in its AGENTS.md.
- Unit tests with mocked payloads for each case.
Activity
lfnovo commentedon Nov 18, 2026
Checked the current provider docs (2026-11-18):
timestamp_granularities=segmentreturnssegmentswithtext/start/end; word level returns 400 ("Word-level segments are not enabled for this model").diarize=trueaddsspeaker_idper segment but requires segment timestamps. The responselanguageisnullwhen pinned;return_language=truereturns the detected one. https://docs.mistral.ai/studio/audio/speech-to-text/transcribe-files/audio/transcriptionsacceptsresponse_format=verbose_jsonandtimestamp_granularities[](segment,word). Withverbose_jsonit returnssegments(id/start/end/text, plus optionalspeaker) andwords, but the docs sayverbose_jsononly works with OpenAI-compatible upstream providers. So OpenRouter is in scope: same allowlist logic asopenai.py, keyed on the routed model. https://openrouter.ai/docs/api/api-reference/stt/create-transcription.mdGenerated by Claude Code