Skip to content

The agent that grows with you

feat(stt): pin xAI transcription to grok-voice-transcribe-2.0

Julien Talbot56b0f3cb55f3
diff --git a/apps/desktop/src/lib/voice-client-direct.test.ts b/apps/desktop/src/lib/voice-client-direct.test.ts
index 19cb91580ff..19ac1e52bdb 100644
--- a/apps/desktop/src/lib/voice-client-direct.test.ts
+++ b/apps/desktop/src/lib/voice-client-direct.test.ts
@@ -248,7 +248,13 @@ describe('transcribeAudioClientDirect', () => {
it('speaks the xai wire shape', async () => {
mockDesktopApi({
ok: true,
- stt: { ...directStt, wire: 'xai-stt', provider: 'xai', base_url: 'https://api.x.ai/v1', model: null },
+ stt: {
+ ...directStt,
+ wire: 'xai-stt',
+ provider: 'xai',
+ base_url: 'https://api.x.ai/v1',
+ model: 'grok-voice-transcribe-2.0'
+ },
tts: relay
})
@@ -260,6 +266,7 @@ describe('transcribeAudioClientDirect', () => {
const [url, init] = fetchMock.mock.calls[0] as unknown as [string, RequestInit]
expect(url).toBe('https://api.x.ai/v1/stt')
expect((init.body as FormData).get('format')).toBe('true')
+ expect((init.body as FormData).get('model')).toBe('grok-voice-transcribe-2.0')
})
it('speaks the elevenlabs wire shape with xi-api-key auth', async () => {
diff --git a/apps/desktop/src/lib/voice-client-direct.ts b/apps/desktop/src/lib/voice-client-direct.ts
index 2b751faa82c..784317ffd94 100644
--- a/apps/desktop/src/lib/voice-client-direct.ts
+++ b/apps/desktop/src/lib/voice-client-direct.ts
@@ -319,6 +319,10 @@ export async function transcribeAudioClientDirect(audio: Blob, owner?: ResolvedO
form.set('file', audio, sttFileName(audio))
form.set('format', 'true')
+ if (stt.model) {
+ form.set('model', stt.model)
+ }
+
if (stt.language) {
form.set('language', stt.language)
}
diff --git a/cli-config.yaml.example b/cli-config.yaml.example
index 8d02c25bd41..c5529f22025 100644
--- a/cli-config.yaml.example
+++ b/cli-config.yaml.example
@@ -1705,6 +1705,11 @@ stt:
max_retries: 1 # OpenAI SDK transport retries; set 0 to disable
# mistral:
# model: "voxtral-mini-latest" # voxtral-mini-latest | voxtral-mini-2602
+ # xai:
+ # # Sent as the multipart ``model`` field. Omitting it leaves xAI on
+ # # grok-voice-transcribe-1.0 until that server default flips.
+ # model: "grok-voice-transcribe-2.0" # or grok-voice-transcribe-1.0
+ # # language: "" # blank = stt.language > HERMES_LOCAL_STT_LANGUAGE > auto-detect
# deepinfra:
# # Model id is discovered live from the DeepInfra catalog filtered
# # by the `stt` surface tag — leave `model` blank to take the first
diff --git a/hermes_cli/config_defaults.py b/hermes_cli/config_defaults.py
index fa682523a13..3620713944a 100644
--- a/hermes_cli/config_defaults.py
+++ b/hermes_cli/config_defaults.py
@@ -1160,7 +1160,7 @@ DEFAULT_CONFIG = {
"echo_transcripts": True,
# No seeded "provider": a stored value counts as an explicit user pick; unset = autodetect
# ladder. Valid: "local" (faster-whisper) | "groq" | "openai" | "mistral" | "elevenlabs" |
- # "deepinfra". Global language hint unless a per-provider language overrides it. "en"
+ # "deepinfra" | "xai". Global language hint unless a per-provider language overrides it. "en"
# because Whisper auto-detect misreads short/accented clips; "" = auto; or "es", "zh", ...
"language": "en",
# Client-side ffmpeg silence trim before cloud upload (local whisper uses VAD): silence
@@ -1198,6 +1198,9 @@ DEFAULT_CONFIG = {
"language": "", # auto-detect; set "en", "es", ... to force
},
"xai": {
+ # grok-voice-transcribe-2.0 | grok-voice-transcribe-1.0. Sent as the multipart
+ # ``model`` field; omitting it leaves xAI on 1.0 until that server default flips.
+ "model": "grok-voice-transcribe-2.0",
"language": "", # auto-detect; set "en", "es", ... to force
},
"elevenlabs": {
diff --git a/hermes_cli/tools_config.py b/hermes_cli/tools_config.py
index d98734f42be..67ba2353b3a 100644
--- a/hermes_cli/tools_config.py
+++ b/hermes_cli/tools_config.py
@@ -258,7 +258,7 @@ TOOL_CATEGORIES = {
_row("OpenAI", "paid", "whisper-1, gpt-4o-transcribe, gpt-transcribe", [_OPENAI_VOICE_KEY], stt_provider="openai"),
_row("Groq", "free tier", "Whisper large-v3 family — very fast",
[_key("GROQ_API_KEY", "Groq API key", "https://console.groq.com/keys")], stt_provider="groq"),
- _row("xAI", tag="grok-stt — uses xAI Grok OAuth or XAI_API_KEY", stt_provider="xai", post_setup="xai_grok"),
+ _row("xAI", tag="Grok Voice Transcribe — uses xAI Grok OAuth or XAI_API_KEY", stt_provider="xai", post_setup="xai_grok"),
_row("ElevenLabs Scribe", "paid", "scribe_v2 — diarization + audio-event tagging", [_ELEVENLABS_KEY],
stt_provider="elevenlabs"),
# Mistral Voxtral STT intentionally omitted — mistralai PyPI package quarantined (malicious 2.4.6
diff --git a/tests/tools/test_transcription_tools.py b/tests/tools/test_transcription_tools.py
index b7fb0b5c754..03a06a09670 100644
--- a/tests/tools/test_transcription_tools.py
+++ b/tests/tools/test_transcription_tools.py
@@ -933,6 +933,24 @@ class TestTranscribeXAI:
data = call_kwargs.kwargs.get("data", call_kwargs[1].get("data", {}))
assert data.get("language") == "fr"
assert data.get("format") == "true"
+ assert data.get("model") == "grok-stt"
+
+ def test_omitted_model_pins_transcribe_2(self, monkeypatch, sample_ogg, mock_xai_http_module):
+ """xAI still defaults an omitted model to transcribe-1.0. Always send one."""
+ monkeypatch.setenv("XAI_API_KEY", "xai-test-key")
+ monkeypatch.delenv("STT_XAI_MODEL", raising=False)
+
+ mock_response = MagicMock()
+ mock_response.status_code = 200
+ mock_response.json.return_value = {"text": "test", "language": "en", "duration": 1.0}
+
+ with patch("tools.transcription_tools._load_stt_config", return_value={}), \
+ patch("requests.post", return_value=mock_response) as mock_post:
+ from tools.transcription_tools import _transcribe_xai
+ _transcribe_xai(sample_ogg, "")
+
+ data = mock_post.call_args.kwargs["data"]
+ assert data.get("model") == "grok-voice-transcribe-2.0"
def test_oauth_credentials_ignore_stt_base_url_override(
self,
@@ -991,6 +1009,28 @@ class TestGetProviderXAI:
# transcribe_audio — xAI dispatch
# ============================================================================
+class TestTranscribeAudioXAIDispatch:
+ def test_model_default_is_voice_transcribe_2(self, sample_ogg, monkeypatch):
+ monkeypatch.delenv("STT_XAI_MODEL", raising=False)
+ with patch("tools.transcription_tools._load_stt_config", return_value={"provider": "xai"}), \
+ patch("tools.transcription_tools._get_provider", return_value="xai"), \
+ patch("tools.transcription_tools._transcribe_xai",
+ return_value={"success": True, "transcript": "hi"}) as mock_xai:
+ from tools.transcription_tools import transcribe_audio
+ transcribe_audio(sample_ogg, model=None)
+
+ assert mock_xai.call_args[0][1] == "grok-voice-transcribe-2.0"
+
+ def test_config_model_overrides_default(self, sample_ogg):
+ config = {"provider": "xai", "xai": {"model": "grok-voice-transcribe-1.0"}}
+ with patch("tools.transcription_tools._load_stt_config", return_value=config), \
+ patch("tools.transcription_tools._get_provider", return_value="xai"), \
+ patch("tools.transcription_tools._transcribe_xai",
+ return_value={"success": True, "transcript": "hi"}) as mock_xai:
+ from tools.transcription_tools import transcribe_audio
+ transcribe_audio(sample_ogg, model=None)
+
+ assert mock_xai.call_args[0][1] == "grok-voice-transcribe-1.0"
# ============================================================================
# _transcribe_elevenlabs
diff --git a/tests/tools/test_voice_client_config.py b/tests/tools/test_voice_client_config.py
index 438a1963843..cf58f126685 100644
--- a/tests/tools/test_voice_client_config.py
+++ b/tests/tools/test_voice_client_config.py
@@ -186,10 +186,18 @@ def test_xai_oauth_without_api_key_relays(voice_home):
def test_xai_env_key_goes_direct(voice_home, monkeypatch):
voice_home({"stt": {"provider": "xai"}})
monkeypatch.setenv("XAI_API_KEY", "xai_key1")
+ monkeypatch.delenv("STT_XAI_MODEL", raising=False)
stt = _resolve()["stt"]
assert stt["mode"] == "direct"
assert stt["wire"] == "xai-stt"
assert stt["api_key"] == "xai_key1"
+ assert stt["model"] == "grok-voice-transcribe-2.0"
+
+
+def test_xai_config_model_reaches_client(voice_home, monkeypatch):
+ voice_home({"stt": {"provider": "xai", "xai": {"model": "grok-voice-transcribe-1.0"}}})
+ monkeypatch.setenv("XAI_API_KEY", "xai_key1")
+ assert _resolve()["stt"]["model"] == "grok-voice-transcribe-1.0"
def test_direct_stt_carries_the_gateway_transcription_timeout(voice_home, monkeypatch):
diff --git a/tools/transcription_cloud.py b/tools/transcription_cloud.py
index 7c14eebf029..80fef1d614f 100644
--- a/tools/transcription_cloud.py
+++ b/tools/transcription_cloud.py
@@ -19,9 +19,9 @@ from urllib.parse import urljoin
from utils import is_truthy_value
from tools.transcription_audio import _transcode_audio_for_stt
from tools.transcription_common import (
- DEFAULT_GROQ_STT_MODEL, DEFAULT_STT_MODEL, ELEVENLABS_STT_BASE_URL, GROQ_BASE_URL, GROQ_MODELS,
- OPENAI_BASE_URL, OPENAI_MODELS, STTResponseError, XAI_STT_BASE_URL, _error_result, _get_stt_section,
- _lazy_ensure_quietly, _log_prompt_unsupported, _ok_result)
+ DEFAULT_GROQ_STT_MODEL, DEFAULT_STT_MODEL, DEFAULT_XAI_STT_MODEL, ELEVENLABS_STT_BASE_URL,
+ GROQ_BASE_URL, GROQ_MODELS, OPENAI_BASE_URL, OPENAI_MODELS, STTResponseError, XAI_STT_BASE_URL,
+ _error_result, _get_stt_section, _lazy_ensure_quietly, _log_prompt_unsupported, _ok_result)
# Log-record parity with the origin module.
logger = logging.getLogger("tools.transcription_tools")
@@ -280,7 +280,11 @@ def _transcribe_xai(
def _post() -> Any:
from tools.xai_http import hermes_xai_user_agent
- data: Dict[str, str] = {"language": language} if language else {}
+ # Omit ``model`` and xAI serves grok-voice-transcribe-1.0 until it flips the default.
+ resolved_model = str(model_name or "").strip() or DEFAULT_XAI_STT_MODEL
+ data: Dict[str, str] = {"model": resolved_model}
+ if language:
+ data["language"] = language
data.update({flag: "true" for flag, default in (("format", True), ("diarize", False))
if is_truthy_value(xai_config.get(flag, default))})
diff --git a/tools/transcription_common.py b/tools/transcription_common.py
index 038e10fe9f0..a4f300b6495 100644
--- a/tools/transcription_common.py
+++ b/tools/transcription_common.py
@@ -22,6 +22,10 @@ DEFAULT_ELEVENLABS_STT_MODEL = os.getenv("STT_ELEVENLABS_MODEL", "scribe_v2")
# Seconds for one STT HTTP request; shared by the OpenAI-SDK path and the QQ adapter so a
# self-hosted model's cold start is not cut off at the old fixed 30s (#112939).
DEFAULT_STT_TIMEOUT = 60.0
+# xAI's /v1/stt still defaults to grok-voice-transcribe-1.0 when ``model`` is omitted.
+# Pin 2.0 so Hermes doesn't stay on 1.0 until xAI flips the server default, then
+# break when 1.0 is removed. Override with STT_XAI_MODEL or stt.xai.model.
+DEFAULT_XAI_STT_MODEL = os.getenv("STT_XAI_MODEL", "grok-voice-transcribe-2.0")
LOCAL_STT_COMMAND_ENV = "HERMES_LOCAL_STT_COMMAND"
LOCAL_STT_LANGUAGE_ENV = "HERMES_LOCAL_STT_LANGUAGE"
COMMON_LOCAL_BIN_DIRS = ("/opt/homebrew/bin", "/usr/local/bin")
diff --git a/tools/transcription_tools.py b/tools/transcription_tools.py
index 65bc9673175..6f44385df3f 100644
--- a/tools/transcription_tools.py
+++ b/tools/transcription_tools.py
@@ -25,8 +25,8 @@ from utils import is_truthy_value
from tools.transcription_common import (
BUILTIN_STT_PROVIDERS, CLOUD_STT_PROVIDERS, DEFAULT_ELEVENLABS_STT_MODEL,
DEFAULT_GROQ_STT_MODEL, DEFAULT_LOCAL_MODEL, DEFAULT_MISTRAL_STT_MODEL, DEFAULT_PROVIDER,
- DEFAULT_STT_MODEL, LOCAL_STT_COMMAND_ENV, LOCAL_STT_LANGUAGE_ENV, _error_result,
- _get_stt_section, _ok_result)
+ DEFAULT_STT_MODEL, DEFAULT_XAI_STT_MODEL, LOCAL_STT_COMMAND_ENV, LOCAL_STT_LANGUAGE_ENV,
+ _error_result, _get_stt_section, _ok_result)
from tools.transcription_audio import (
_convert_caf_to_wav, _prepare_audio_for_transcription, _trim_silence_for_cloud_stt,
_validate_audio_file, _validate_audio_file_size, _validate_audio_source_file)
@@ -466,13 +466,14 @@ def _transcribe_prepared_audio(
# Built-in provider -> (stt section, config key, default, treat-empty-as-missing). "local_command"
-# shares ``stt.local``; xAI takes no model (logging-only); deepinfra uses the live catalog when empty.
+# shares ``stt.local``; deepinfra uses the live catalog when empty.
_BUILTIN_MODEL_KEYS = {
"local": ("local", "model", DEFAULT_LOCAL_MODEL, False),
"local_command": ("local", "model", DEFAULT_LOCAL_MODEL, False),
"groq": ("groq", "model", DEFAULT_GROQ_STT_MODEL, True),
"openai": ("openai", "model", DEFAULT_STT_MODEL, False),
"mistral": ("mistral", "model", DEFAULT_MISTRAL_STT_MODEL, False),
+ "xai": ("xai", "model", DEFAULT_XAI_STT_MODEL, True),
"elevenlabs": ("elevenlabs", "model_id", DEFAULT_ELEVENLABS_STT_MODEL, False),
"deepinfra": ("deepinfra", "model", "", True)}
@@ -481,8 +482,6 @@ def _builtin_model_name(provider: str, stt_config: Dict[str, Any], model: Option
"""Resolve the model for a built-in provider: caller override > ``stt.<provider>`` config > default."""
if model:
return model
- if provider == "xai":
- return "grok-stt"
section, key, default, empty_is_missing = _BUILTIN_MODEL_KEYS[provider]
cfg = _get_stt_section(stt_config, section)
return (cfg.get(key) or default) if empty_is_missing else cfg.get(key, default)
diff --git a/tools/voice_client_config.py b/tools/voice_client_config.py
index 5467982ceef..c5ba8f50257 100644
--- a/tools/voice_client_config.py
+++ b/tools/voice_client_config.py
@@ -19,7 +19,7 @@ logger = logging.getLogger(__name__)
# Wire shapes the desktop knows how to speak. Anything else → relay.
# openai-multipart : POST {base_url}/audio/transcriptions (multipart, Bearer)
-# xai-stt : POST {base_url}/stt (multipart, Bearer, format=true)
+# xai-stt : POST {base_url}/stt (multipart, Bearer, model, format=true)
# elevenlabs-stt : POST {base_url}/speech-to-text (multipart, xi-api-key)
# openai-speech : POST {base_url}/audio/speech (JSON, Bearer) → audio bytes
# elevenlabs-tts : POST {base_url}/text-to-speech/{voice_id} (JSON, xi-api-key)
@@ -145,7 +145,8 @@ def _resolve_stt_client_config() -> Dict[str, Any]:
api_key = str(get_env_value("XAI_API_KEY") or "").strip()
if not api_key:
return _relay("xai oauth (server-managed) or no credentials")
- return direct(STT_WIRE_XAI, env_base_url("XAI_STT_BASE_URL", tc.XAI_STT_BASE_URL), api_key, None)
+ return direct(STT_WIRE_XAI, env_base_url("XAI_STT_BASE_URL", tc.XAI_STT_BASE_URL), api_key,
+ section.get("model") or tc.DEFAULT_XAI_STT_MODEL)
if provider == "elevenlabs":
api_key = tt._resolve_provider_key("ELEVENLABS_API_KEY", "elevenlabs")
if not api_key:
diff --git a/website/docs/user-guide/configuration.md b/website/docs/user-guide/configuration.md
index f6abb7aca02..255caa41c42 100644
--- a/website/docs/user-guide/configuration.md
+++ b/website/docs/user-guide/configuration.md
@@ -2453,6 +2453,9 @@ stt:
language: "" # per-provider override of stt.language
timeout: 60 # seconds per transcription request; raise for self-hosted model cold starts
max_retries: 1 # SDK transport retries (connection errors, 408/409/429/5xx); 0 = single attempt
+ xai:
+ model: "grok-voice-transcribe-2.0" # or grok-voice-transcribe-1.0; sent on every request
+ language: "" # per-provider override of stt.language
# model: "whisper-1" # Legacy fallback key still respected
```
@@ -2477,6 +2480,7 @@ Groq and OpenAI model overrides are environment-driven:
```bash
STT_GROQ_MODEL=whisper-large-v3-turbo
STT_OPENAI_MODEL=whisper-1
+STT_XAI_MODEL=grok-voice-transcribe-2.0
GROQ_BASE_URL=https://api.groq.com/openai/v1
STT_OPENAI_BASE_URL=https://api.openai.com/v1
```
diff --git a/website/docs/user-guide/features/tts.md b/website/docs/user-guide/features/tts.md
index 9536836ea94..64c01ed029a 100644
--- a/website/docs/user-guide/features/tts.md
+++ b/website/docs/user-guide/features/tts.md
@@ -506,7 +506,7 @@ stt:
mistral:
model: "voxtral-mini-latest" # voxtral-mini-latest, voxtral-mini-2602
xai:
- model: "grok-stt" # xAI Grok STT
+ model: "grok-voice-transcribe-2.0" # or grok-voice-transcribe-1.0
language: "" # optional ISO-639-1 hint; blank = use HERMES_LOCAL_STT_LANGUAGE if set, else "en"
```
@@ -537,7 +537,7 @@ HF_HUB_DISABLE_XET=1
**Mistral API (Voxtral Transcribe)** — Requires `MISTRAL_API_KEY`. Uses Mistral's [Voxtral Transcribe](https://docs.mistral.ai/capabilities/audio/speech_to_text/) models. Supports 13 languages, speaker diarization, and word-level timestamps. Install with `cd ~/.hermes/hermes-agent && python -c "import pm; pm.sync_venv(['mistral'], explicit=True)"`.
-**xAI Grok STT** — Requires `XAI_API_KEY`. Posts to `https://api.x.ai/v1/stt` as multipart/form-data. Good choice if you're already using xAI for chat or TTS and want one API key for everything. Auto-detection order puts it after Groq — explicitly set `stt.provider: xai` to force it.
+**xAI Grok STT** — Requires `XAI_API_KEY` (or xAI OAuth). Posts to `https://api.x.ai/v1/stt` as multipart/form-data and sends `model` (default `grok-voice-transcribe-2.0`; pin `grok-voice-transcribe-1.0` with `stt.xai.model` or `STT_XAI_MODEL`). Omitting the field leaves the API on 1.0 until xAI changes that server default. Good choice if you're already using xAI for chat or TTS and want one API key for everything. Auto-detection order puts it after Mistral — explicitly set `stt.provider: xai` to force it.
**Custom local CLI fallback** — Set `HERMES_LOCAL_STT_COMMAND` if you want Hermes to call a local transcription command directly. The command template supports `{input_path}`, `{output_dir}`, `{language}`, and `{model}` placeholders. Hermes tokenizes the rendered template into an argument list and executes it without a shell, so operators such as `|`, `>`, `&&`, and `;` are passed as literal arguments. Your command must write a `.txt` transcript somewhere under `{output_dir}`.
diff --git a/website/docs/user-guide/features/voice-mode.md b/website/docs/user-guide/features/voice-mode.md
index e6adb381658..7a13d23367c 100644
--- a/website/docs/user-guide/features/voice-mode.md
+++ b/website/docs/user-guide/features/voice-mode.md
@@ -538,7 +538,7 @@ DISCORD_ALLOWED_USERS=...
| **OpenAI** | `gpt-4o-transcribe` | Medium (~2s) | Best | Paid | Yes |
| **OpenAI** | `gpt-transcribe` | Fast | Best | Paid ($0.0045/min) | Yes |
| **Mistral** | `voxtral-mini-latest` | Fast | Good | Paid | Yes |
-| **xAI** | `grok-stt` | Fast | Good | Paid | Yes |
+| **xAI** | `grok-voice-transcribe-2.0` | Fast | Best | Paid ($0.10/hr batch) | Yes |
Provider priority (automatic fallback): **local** > **groq** > **openai**
diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/features/tts.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/features/tts.md
index 18abb29aa7c..934d96e701e 100644
--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/features/tts.md
+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/features/tts.md
@@ -411,7 +411,7 @@ stt:
mistral:
model: "voxtral-mini-latest" # voxtral-mini-latest, voxtral-mini-2602
xai:
- model: "grok-stt" # xAI Grok STT
+ model: "grok-voice-transcribe-2.0" # 或 grok-voice-transcribe-1.0
```
### 提供商详情