Repository navigation
feat(stt): add Soniox as an opt-in streaming provider - #12295
Merged
Merged
Conversation
Streaming only: the batch path has no Soniox client and PTT dispatches Parakeet and Modulate alone. Absent from DEFAULT_MODELS_BY_SURFACE, so a deployment must name it in STT_SERVICE_MODELS to select it.
Soniox streams token deltas rather than utterances: tokens flip is_final once committed and non-final ones are revised in place, so only finals are forwarded and consecutive finals from one speaker coalesce into a segment. Diarization and language identification are both requested, so auto-detect sessions need no declared language -- the token carries its own speaker and language. A declared language is passed as a hint instead.
Live tokens arrive with duration_ms null, so the previous arithmetic collapsed every segment's end onto its start. Verified against the live service with a 26s speech sample: 98 final tokens, all with duration_ms null.
streaming.py was already over the product line-count ratchet before this branch; adding a provider inline pushed it further. The Soniox protocol is self-contained, so it lives in utils/stt/soniox.py and streaming.py re-exports it for existing import sites. Imports flow one way, so there is no cycle. Also drops a redundant isinstance on a typed dict that pyright rejected, and annotates JSON-sourced tokens as Any so the remaining runtime guard is real.
mdmohsin7
added a commit
that referenced
this pull request
Aug 27, 2026
## Why `main` is currently undeployable. #12295 added the `SONIOX_API_KEY` helm binding to both backend-listen values files but did not register it in the classification ledger, so `deployment-secret-boundary` fails: ``` - backend/charts/backend-listen/prod_omi_backend_listen_values.yaml: helm_secret binding SONIOX_API_KEY is unclassified - backend/charts/backend-listen/dev_omi_backend_listen_values.yaml: helm_secret binding SONIOX_API_KEY is unclassified ``` Release Eligibility failed on `a700baa559` as a result, which blocks **all** backend deploys, not only the Soniox feature. ## What changed One line: `SONIOX_API_KEY` added to `kinds.secret` in `config/deployment-setting-classification.json`, next to `MODULATE_API_KEY` and `DEEPGRAM_API_KEY`. It is a provider credential, so `secret` is the correct classification — it must not be a `config` value or reach a public build. ## Testing `python3 .github/scripts/check_deployment_secret_boundary.py --base origin/main` → `deployment secret-boundary check passed` ## How this got missed The check runs in the shared PR preflight. On #12295 that preflight failed first on the line-count ratchet, so the secret-boundary failure was never surfaced; the PR was merged before the corrected run completed. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/12296?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
pull Bot
pushed a commit
to Mu-L/omi
that referenced
this pull request
Aug 27, 2026
PR BasedHardware#12295 added the SONIOX_API_KEY helm binding without registering it, so deployment-secret-boundary rejects main's tip and Release Eligibility fails -- blocking every backend deploy, not just this feature.
mdmohsin7
added a commit
that referenced
this pull request
Aug 30, 2026
## Why `SONIOX_API_KEY` exists in Secret Manager (org-level key, created 2025-05-17) and #12295 wired backend-listen to consume it, but the ExternalSecret enumerates its keys explicitly and Soniox was not among the 34 listed. The key therefore never reaches the cluster secret, so the binding resolves to nothing and Soniox can never be selected. ## What changed Adds the `SONIOX_API_KEY` → `SONIOX_API_KEY` mapping to the prod and dev backend secret charts, next to `MODULATE_API_KEY` and `DEEPGRAM_API_KEY`. ## Verification The org-level key was tested against the live Soniox service before this change: authenticated, transcribed, and returned two distinct speakers on a two-speaker sample. It is current, not stale. The backend-listen binding is `optional: true`, so pods start fine whether or not the key is present; this change is what makes the provider actually usable. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/12298?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Modulate's multilingual streaming endpoint is failing for our account (~90% of
streams), and both Deepgram accounts we can reach are normal-tier with concurrency
ceilings around 5 pods' worth each. There is currently no provider that can carry our
auto-detect traffic reliably.
Soniox is the only vendor I could find that does speaker diarization and automatic
language identification together in real time:
uk, pl, zh-TW, all of which appear in our traffic.
identification is documented as batch-only, and 82% of our sessions arrive as
multiwith no declared language.needs no language specified.
What changed
Adds Soniox as a selectable streaming provider. Nothing changes unless a deployment
opts in — it is absent from
DEFAULT_MODELS_BY_SURFACE, so it is only reachable bynaming
sonioxinSTT_SERVICE_MODELS.config/stt_provider_policy.py— newSONIOX_PROVIDER, streaming surface only(the batch path has no Soniox client, and PTT dispatches Parakeet/Modulate alone).
utils/stt/streaming.py—SafeSonioxSocket+process_audio_soniox, a newSTTService.soniox, and its own circuit breaker.routers/listen/receiver.py— a Soniox primary falls back through Modulate thenDeepgram, the same chain a Modulate primary uses.
SONIOX_API_KEYpassed to backend-listen,optional: trueso thedeployment is unaffected until the secret exists.
Protocol notes
Soniox streams token deltas, not utterances. Tokens flip
is_finalonce committedand non-final ones are revised in place, so forwarding them would emit text the model
later retracts. The socket forwards only finals, and coalesces consecutive finals from
one speaker into a segment shaped like the other providers'.
enable_speaker_diarizationandenable_language_identificationare both on, so eachtoken carries its own
speakerandlanguage. Auto-detect sessions send nolanguage_hints; a declared language is passed as a hint rather than a constraint.Testing
test_soniox_streaming.py— 9 cases: final-only forwarding, speaker coalescing,speaker changes, missing speaker field, error propagation,
presecondstrimming,hint behaviour for
multivs declared language, and that Soniox stays out of thedefaults.
failure (13), death monitor (4), runtime env validator (85).
tests/unitrun segfaults in a native extension on my machine; thatreproduces on unmodified
main, so files were run individually.Not verified
No end-to-end transcription test. The provided key authenticates and the protocol
handshake works, but the account returns:
So token assembly, diarization quality and language identification are all exercised
against a fake server only. Before enabling this in production, the account needs
funding and a real two-speaker sample should be run through it.
Soniox's own docs also warn that real-time diarization has higher attribution error
than async, and that endpoint detection reduces diarization accuracy — relevant since
our VAD gate finalizes aggressively.
Line-count ratchet
Line-Count-Exception: backend/utils/stt/streaming.py | 1692 -> 1707 | The Soniox client (230 lines) lives in its own module, utils/stt/soniox.py; the 15 lines remaining here are the irreducible wiring a provider needs in the shared module — the STTService member, its get_model_name mapping, its circuit breaker and the _circuit_for_primary branch, the selection branch, and the re-export import.