Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

feat(host): pick voice models from the provider's newest

leepokai64665a534d0c
diff --git a/apps/ios/WhatsNew.md b/apps/ios/WhatsNew.md
index 2bd477ef..bda93109 100644
--- a/apps/ios/WhatsNew.md
+++ b/apps/ios/WhatsNew.md
@@ -9,8 +9,8 @@ a version without one gets a generic "Bug fixes and improvements" line. Delete o
### zh-Hant
-- 語音通話的「語音轉文字」預設改用 OpenAI 最新的 gpt-transcribe,辨識更準,也更認得 bot 的名字。
+- 語音通話預設改用各家最新的模型(例如 OpenAI 的 gpt-transcribe,辨識更準、更認得 bot 的名字),之後有新模型推出也會自動換上,不用等 app 更新。
### en-US
-- Voice calls now use OpenAI's newest speech-to-text, gpt-transcribe, by default: more accurate, and better at your bots' names.
+- Voice calls now default to each provider's newest models (such as OpenAI's gpt-transcribe: more accurate, and better at your bots' names), and move to newer ones as they come out, without an app update.
diff --git a/docs/features/voice-call.md b/docs/features/voice-call.md
index 7c2eba43..8eb5de01 100644
--- a/docs/features/voice-call.md
+++ b/docs/features/voice-call.md
@@ -95,13 +95,23 @@ Each cloud engine has two **modes**:
speech-to-text and is sent as an ordinary message; replies are read with its text-to-speech. Both
run on the computer (`voiceTranscribe`, `voiceSpeak`), so the key never leaves it; utterances stop
at 20 s and replies are spoken in clips (OpenAI 600 characters as AAC, Gemini 150 as WAV) so every
- request and answer fits one 1 MiB channel message. Defaults: `gpt-transcribe` +
- `gpt-4o-mini-tts`, `gemini-3.8-flash` + `gemini-3.8-flash-tts`. Speech-to-text gets the app's and
+ request and answer fits one 1 MiB channel message. Speech-to-text gets the app's and
the bots' names as hints (gpt-transcribe also as `keywords`). gpt-transcribe returns Chinese in
Simplified characters whatever the prompt says, so the client turns it into Traditional
(`Hans-Hant`) for a reader whose first Chinese language, or region, is Traditional. Only a
model the user picks is saved; the default isn't, so a newer default reaches everyone.
+**Default models follow the provider.** Nothing pins a model version: once a day (and whenever a
+key is saved or the model list is opened) the host reads each keyed provider's model list and
+keeps its newest model per mode (`voice::newest`, stored as `voice-defaults.<provider>`), and
+`voiceStatus` / `voiceModels` report them as `defaults`. OpenAI's list is dated, so its newest
+generation wins, full models over `mini`; Gemini's names carry the version, plain names over
+`-lite` / variants; dated snapshots and previews never become defaults. Clients remember the
+last `defaults` they saw (`callDefaults.<provider>`) and refresh them at every call. The ids
+built into the host and the app (today `gpt-realtime-2.1`, `gpt-transcribe`, `gpt-4o-mini-tts`;
+`gemini-3.8-live`, `gemini-3.8-flash`, `gemini-3.8-flash-tts`) are used only until the first
+list arrives.
+
Voice settings (`VoiceChatSettingsView`) open from the call bar's gear and from settings: on the
iPhone, **Computers & settings → Voice chat**; on the Mac, **Account → Voice chat** (this Mac's
computer) or the waveform button on a computer's card in **Computers & devices**. Keys are entered
diff --git a/host/src/main.rs b/host/src/main.rs
index 4a3dd118..1a0c5641 100644
--- a/host/src/main.rs
+++ b/host/src/main.rs
@@ -503,6 +503,7 @@ async fn serve(bind: &str, port: u16) -> Result<()> {
let hub = hub::Hub::new(store, host_id, identity, token, port);
hub.start()?;
tokio::spawn(registry::refresh_loop());
+ tokio::spawn(voice::refresh_loop(hub.clone()));
tokio::spawn(backends::refresh_sign_in());
tokio::spawn(usage::poll(hub.clone()));
tokio::spawn(update::automatic_loop(hub.clone()));
diff --git a/host/src/voice.rs b/host/src/voice.rs
index d884a8a9..c547b2da 100644
--- a/host/src/voice.rs
+++ b/host/src/voice.rs
@@ -49,12 +49,50 @@ impl Provider {
}
}
- /// Used until the user picks one from the provider's list.
- fn default_model(self) -> &'static str {
- match self {
- Self::OpenAi => "gpt-realtime-2.1",
- Self::Gemini => "gemini-3.8-live",
+ /// The defaults until this computer has seen the provider's own list (`refresh_loop`).
+ fn fallback(self) -> Defaults {
+ let (realtime, transcribe, speech) = match self {
+ Self::OpenAi => ("gpt-realtime-2.1", "gpt-transcribe", "gpt-4o-mini-tts"),
+ Self::Gemini => ("gemini-3.8-live", "gemini-3.8-flash", "gemini-3.8-flash-tts"),
+ };
+ Defaults { realtime: realtime.into(), transcribe: transcribe.into(), speech: speech.into() }
+ }
+}
+
+/// The model each voice mode uses until the user picks one: the provider's newest, worked out
+/// from its model list once a day, so a new release becomes the default without an app update.
+#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
+pub struct Defaults {
+ realtime: String,
+ transcribe: String,
+ speech: String,
+}
+
+const REFRESH_EVERY: Duration = Duration::from_secs(24 * 60 * 60);
+
+fn defaults_key(p: Provider) -> String {
+ format!("voice-defaults.{}", p.id())
+}
+
+fn defaults(store: &Store, p: Provider) -> Defaults {
+ store.kv_get(&defaults_key(p)).and_then(|s| serde_json::from_str(&s).ok()).unwrap_or_else(|| p.fallback())
+}
+
+/// Looks at each keyed provider's model list once a day and keeps its newest models as the defaults.
+pub async fn refresh_loop(hub: std::sync::Arc<crate::hub::Hub>) {
+ loop {
+ for p in Provider::ALL {
+ if load(&hub.store).is_ok_and(|keys| !keys.get(p).is_empty())
+ && let Err(e) = models(&hub.store, p).await
+ {
+ tracing::info!(
+ provider = p.id(),
+ error = format!("{e:#}"),
+ "voice model refresh failed; keeping the last defaults"
+ );
+ }
}
+ tokio::time::sleep(REFRESH_EVERY).await;
}
}
@@ -166,7 +204,10 @@ pub fn status(store: &Store) -> Result<Value> {
let keys = load(store)?;
let providers: Vec<Value> = Provider::ALL
.iter()
- .map(|&p| json!({"provider": p.id(), "configured": !keys.get(p).is_empty(), "defaultModel": p.default_model()}))
+ .map(|&p| {
+ let defaults = defaults(store, p);
+ json!({"provider": p.id(), "configured": !keys.get(p).is_empty(), "defaultModel": defaults.realtime, "defaults": defaults})
+ })
.collect();
Ok(json!({"providers": providers}))
}
@@ -179,7 +220,7 @@ pub async fn set_key(store: &Store, p: Provider, key: &str) -> Result<Value> {
Provider::OpenAi => "marin",
Provider::Gemini => "Kore",
};
- mint(p, key, p.default_model(), voice).await?;
+ mint(p, key, &defaults(store, p).realtime, voice).await?;
}
{
let _guard = store.connector_lock.lock().map_err(|_| anyhow!("credential storage is busy"))?;
@@ -187,6 +228,10 @@ pub async fn set_key(store: &Store, p: Provider, key: &str) -> Result<Value> {
keys.set(p, key.to_owned());
vault::write(store, SLOT, &serde_json::to_string(&keys)?)?;
}
+ if !key.is_empty() {
+ // A new key may see newer models; the daily refresh would only get there tomorrow.
+ let _ = models(store, p).await;
+ }
status(store)
}
@@ -207,8 +252,15 @@ pub async fn models(store: &Store, p: Provider) -> Result<Value> {
.as_array()
.into_iter()
.flatten()
- .filter_map(|m| m["id"].as_str())
- .map(|id| Model { id: id.to_owned(), live: id.contains("realtime"), generate: true })
+ .filter_map(|m| {
+ let id = m["id"].as_str()?;
+ Some(Model {
+ id: id.to_owned(),
+ live: id.contains("realtime"),
+ generate: true,
+ created: m["created"].as_i64(),
+ })
+ })
.collect()
}
Provider::Gemini => {
@@ -226,13 +278,62 @@ pub async fn models(store: &Store, p: Provider) -> Result<Value> {
id: m["name"].as_str()?.trim_start_matches("models/").to_owned(),
live: methods.iter().any(|x| x == "bidiGenerateContent"),
generate: methods.iter().any(|x| x == "generateContent"),
+ created: None,
})
})
.collect()
}
};
let (realtime, transcribe, speech) = classify(p, &entries);
- Ok(json!({"models": realtime, "transcribe": transcribe, "speech": speech}))
+ let fallback = p.fallback();
+ let defaults = Defaults {
+ realtime: newest(p, &entries, &realtime).unwrap_or(fallback.realtime),
+ transcribe: newest(p, &entries, &transcribe).unwrap_or(fallback.transcribe),
+ speech: newest(p, &entries, &speech).unwrap_or(fallback.speech),
+ };
+ store.kv_set(&defaults_key(p), &serde_json::to_string(&defaults)?)?;
+ Ok(json!({"models": realtime, "transcribe": transcribe, "speech": speech, "defaults": defaults}))
+}
+
+/// The provider's current model among `ids`, skipping dated snapshots and previews.
+/// `OpenAI` dates every model (`created`): its latest generation is whatever came out within a
+/// few months of the newest release, and in it the full model beats `mini` (`gpt-realtime-2.1`
+/// over `gpt-realtime-2.1-mini`, yet `gpt-4o-mini-tts` over the older `tts-1`). Gemini's names
+/// carry the version (`gemini-3.8-flash`); within one version the full, plain name wins
+/// (`-flash` over `-flash-lite`, `-live` over `-live-extended-thinking`).
+fn newest(p: Provider, models: &[Model], ids: &[String]) -> Option<String> {
+ const GENERATION: i64 = 120 * 24 * 60 * 60;
+ let lesser = |id: &str| ["mini", "lite"].iter().any(|w| id.contains(w));
+ let pinned = |id: &str| {
+ ["preview", "exp", "latest"].iter().any(|w| id.contains(w))
+ || id
+ .split('-')
+ .any(|part| part.len() == 4 && part.starts_with("20") && part.bytes().all(|c| c.is_ascii_digit()))
+ };
+ let version = |id: &str| -> Vec<u32> {
+ id.split('-')
+ .find(|part| {
+ part.starts_with(|c: char| c.is_ascii_digit()) && part.split('.').all(|n| n.parse::<u32>().is_ok())
+ })
+ .map(|v| v.split('.').filter_map(|n| n.parse().ok()).collect())
+ .unwrap_or_default()
+ };
+ let created = |id: &str| models.iter().find(|m| m.id == id).and_then(|m| m.created).unwrap_or(0);
+ let stable: Vec<&String> = ids.iter().filter(|id| !pinned(id)).collect();
+ let pool = if stable.is_empty() { ids.iter().collect() } else { stable };
+ match p {
+ Provider::OpenAi => {
+ let latest = pool.iter().map(|id| created(id)).max()?;
+ pool.into_iter()
+ .filter(|id| created(id) >= latest - GENERATION)
+ .max_by_key(|id| (!lesser(id), created(id)))
+ .cloned()
+ }
+ Provider::Gemini => pool
+ .into_iter()
+ .max_by(|a, b| (version(a), !lesser(a)).cmp(&(version(b), !lesser(b))).then_with(|| b.len().cmp(&a.len())))
+ .cloned(),
+ }
}
struct Model {
@@ -240,6 +341,8 @@ struct Model {
/// Holds a live conversation (`OpenAI` `realtime`, Gemini `bidiGenerateContent`).
live: bool,
generate: bool,
+ /// When `OpenAI` released it (Unix seconds); Gemini's list has no date.
+ created: Option<i64>,
}
/// Sorts a provider's model list into what each voice mode can use. Translation,
@@ -434,7 +537,7 @@ mod tests {
fn ids(p: Provider, ids: &[&str]) -> (Vec<String>, Vec<String>, Vec<String>) {
let models: Vec<Model> = ids
.iter()
- .map(|id| Model { id: (*id).to_owned(), live: id.contains("realtime"), generate: true })
+ .map(|id| Model { id: (*id).to_owned(), live: id.contains("realtime"), generate: true, created: None })
.collect();
classify(p, &models)
}
@@ -461,6 +564,61 @@ mod tests {
assert_eq!(speech, ["gpt-4o-mini-tts"]);
}
+ fn dated(id: &str, created: i64) -> Model {
+ Model { id: id.to_owned(), live: id.contains("realtime"), generate: true, created: Some(created) }
+ }
+
+ #[test]
+ fn newest_openai_models_are_the_defaults() {
+ let day = 24 * 60 * 60;
+ let models = [
+ dated("gpt-realtime", 1_756_000_000),
+ dated("gpt-realtime-2", 1_778_000_000),
+ dated("gpt-realtime-2.1", 1_786_000_000),
+ dated("gpt-realtime-2.1-mini", 1_786_000_000 + 5 * day),
+ dated("gpt-realtime-mini-2025-12-15", 1_765_000_000),
+ dated("gpt-4o-transcribe", 1_742_000_000),
+ dated("gpt-4o-mini-transcribe", 1_742_000_000),
+ dated("gpt-transcribe", 1_785_000_000),
+ dated("whisper-1", 1_677_000_000),
+ dated("tts-1-hd", 1_699_000_000),
+ dated("gpt-4o-mini-tts", 1_742_000_000),
+ dated("gpt-4o-mini-tts-2025-12-15", 1_765_000_000),
+ ];
+ let (realtime, transcribe, speech) = classify(Provider::OpenAi, &models);
+ let pick = |ids: &[String]| newest(Provider::OpenAi, &models, ids);
+ assert_eq!(pick(&realtime).as_deref(), Some("gpt-realtime-2.1"));
+ assert_eq!(pick(&transcribe).as_deref(), Some("gpt-transcribe"));
+ assert_eq!(pick(&speech).as_deref(), Some("gpt-4o-mini-tts"));
+ }
+
+ #[test]
+ fn newest_gemini_models_are_the_defaults() {
+ let pick = |ids: &[&str]| {
+ let ids: Vec<String> = ids.iter().map(|s| (*s).to_owned()).collect();
+ newest(Provider::Gemini, &[], &ids)
+ };
+ assert_eq!(
+ pick(&[
+ "gemini-3.1-flash-live-preview",
+ "gemini-3.8-live",
+ "gemini-3.8-live-extended-thinking",
+ "gemini-2.5-flash-live"
+ ])
+ .as_deref(),
+ Some("gemini-3.8-live")
+ );
+ assert_eq!(
+ pick(&["gemini-3.5-flash-lite", "gemini-3.8-flash", "gemini-3.9-flash-preview", "gemini-flash-latest"])
+ .as_deref(),
+ Some("gemini-3.8-flash")
+ );
+ assert_eq!(
+ pick(&["gemini-3.8-flash-lite-tts", "gemini-3.8-flash-tts", "gemini-3.1-flash-tts-preview"]).as_deref(),
+ Some("gemini-3.8-flash-tts")
+ );
+ }
+
#[test]
fn wav_header_matches_pcm() {
let out = wav(&[0, 0, 1, 0], 24_000);
diff --git a/kit/Sources/CodyncKit/Models/Voice.swift b/kit/Sources/CodyncKit/Models/Voice.swift
index b86cf4ea..b49033ae 100644
--- a/kit/Sources/CodyncKit/Models/Voice.swift
+++ b/kit/Sources/CodyncKit/Models/Voice.swift
@@ -28,7 +28,8 @@ public enum VoiceProvider: String, CaseIterable, Codable, Sendable {
}
}
- /// Used until the user picks one from the provider's list (the host knows the same default).
+ /// Used until the user picks one, and until the computer has said what's newest
+ /// (`VoiceDefaults`, worked out daily from the provider's list).
public var model: String {
switch self {
case .openAI: "gpt-realtime-2.1"
@@ -68,10 +69,25 @@ public enum VoiceProvider: String, CaseIterable, Codable, Sendable {
}
}
+/// The provider's newest model for each voice mode, as the computer last found them.
+public struct VoiceDefaults: Codable, Sendable, Equatable {
+ public var realtime: String
+ public var transcribe: String
+ public var speech: String
+
+ public init(realtime: String, transcribe: String, speech: String) {
+ self.realtime = realtime
+ self.transcribe = transcribe
+ self.speech = speech
+ }
+}
+
public struct VoiceStatus: Decodable, Sendable {
public struct Provider: Decodable, Sendable {
public var provider: VoiceProvider
public var configured: Bool
+ /// Missing from hosts before 2.6.3.
+ public var defaults: VoiceDefaults?
}
public var providers: [Provider]
@@ -86,11 +102,14 @@ public struct VoiceModels: Codable, Sendable {
public var models: [String]
public var transcribe: [String]
public var speech: [String]
+ /// Missing from hosts before 2.6.3.
+ public var defaults: VoiceDefaults?
- public init(models: [String], transcribe: [String], speech: [String]) {
+ public init(models: [String], transcribe: [String], speech: [String], defaults: VoiceDefaults? = nil) {
self.models = models
self.transcribe = transcribe
self.speech = speech
+ self.defaults = defaults
}
}
diff --git a/kit/Sources/CodyncUI/Call/CallView.swift b/kit/Sources/CodyncUI/Call/CallView.swift
index a7a2fb99..6c31c3c6 100644
--- a/kit/Sources/CodyncUI/Call/CallView.swift
+++ b/kit/Sources/CodyncUI/Call/CallView.swift
@@ -78,6 +78,10 @@ struct CallView: View {
speak: { try await client().voiceSpeak(provider, model: speechModel, voice: voice, text: $0) },
send: { [model, botId] in model.send($0, to: botId) }
))
+ // Picks up the computer's newest models for the next call; this one starts right away.
+ if provider != nil, let client = model.client {
+ Task { if let status = try? await client.voiceStatus() { VoiceSettings.remember(status) } }
+ }
cloudStartedAt = .now
} else if let provider {
let chosen = VoiceSettings.model(provider)
diff --git a/kit/Sources/CodyncUI/Call/VoiceChatSettingsView.swift b/kit/Sources/CodyncUI/Call/VoiceChatSettingsView.swift
index bfa50f23..774a69df 100644
--- a/kit/Sources/CodyncUI/Call/VoiceChatSettingsView.swift
+++ b/kit/Sources/CodyncUI/Call/VoiceChatSettingsView.swift
@@ -144,12 +144,12 @@ private struct ProviderVoiceSettings: View {
Color.clear.frame(height: 0)
.task { await load() }
.onChange(of: voice) { _, v in UserDefaults.standard.set(v, forKey: VoiceSettings.voiceKey(provider)) }
- .onChange(of: model) { _, m in VoiceSettings.save(m, default: provider.model, forKey: VoiceSettings.modelKey(provider)) }
+ .onChange(of: model) { _, m in VoiceSettings.save(m, default: VoiceSettings.defaults(provider).realtime, forKey: VoiceSettings.modelKey(provider)) }
.onChange(of: transcribeModel) { _, m in
- VoiceSettings.save(m, default: provider.transcribeModel, forKey: VoiceSettings.transcribeKey(provider))
+ VoiceSettings.save(m, default: VoiceSettings.defaults(provider).transcribe, forKey: VoiceSettings.transcribeKey(provider))
}
.onChange(of: speechModel) { _, m in
- VoiceSettings.save(m, default: provider.speechModel, forKey: VoiceSettings.speechKey(provider))
+ VoiceSettings.save(m, default: VoiceSettings.defaults(provider).speech, forKey: VoiceSettings.speechKey(provider))
}
}
@@ -249,7 +249,9 @@ private struct ProviderVoiceSettings: View {
return
}
do {
- saved = try await client.voiceStatus().configured(provider)
+ let status = try await client.voiceStatus()
+ VoiceSettings.remember(status)
+ saved = status.configured(provider)
} catch {
saved = false
result = (false, error.localizedDescription)
@@ -261,6 +263,11 @@ private struct ProviderVoiceSettings: View {
private func loadModels(_ client: HostClient) async {
guard let list = try? await client.voiceModels(provider) else { return }
models = list
+ // A newer default moves every choice the user hasn't made themselves.
+ VoiceSettings.remember(list.defaults, for: provider)
+ model = VoiceSettings.model(provider)
+ transcribeModel = VoiceSettings.transcribeModel(provider)
+ speechModel = VoiceSettings.speechModel(provider)
UserDefaults.standard.set(try? JSONEncoder().encode(list), forKey: VoiceSettings.modelsKey(provider))
}
diff --git a/kit/Sources/CodyncUI/Call/VoiceEngine.swift b/kit/Sources/CodyncUI/Call/VoiceEngine.swift
index 5c8990ec..8e897bbd 100644
--- a/kit/Sources/CodyncUI/Call/VoiceEngine.swift
+++ b/kit/Sources/CodyncUI/Call/VoiceEngine.swift
@@ -53,7 +53,24 @@ enum VoiceSettings {
static func modelsKey(_ provider: VoiceProvider) -> String { "callModels.\(provider.rawValue)" }
static func model(_ provider: VoiceProvider) -> String {
- UserDefaults.standard.string(forKey: modelKey(provider)) ?? provider.model
+ UserDefaults.standard.string(forKey: modelKey(provider)) ?? defaults(provider).realtime
+ }
+
+ static func defaultsKey(_ provider: VoiceProvider) -> String { "callDefaults.\(provider.rawValue)" }
+
+ /// The newest models as the computer last reported them, or the app's own until it has.
+ static func defaults(_ provider: VoiceProvider) -> VoiceDefaults {
+ UserDefaults.standard.data(forKey: defaultsKey(provider)).flatMap { try? JSONDecoder().decode(VoiceDefaults.self, from: $0) }
+ ?? VoiceDefaults(realtime: provider.model, transcribe: provider.transcribeModel, speech: provider.speechModel)
+ }
+
+ static func remember(_ defaults: VoiceDefaults?, for provider: VoiceProvider) {
+ guard let defaults, let data = try? JSONEncoder().encode(defaults) else { return }
+ UserDefaults.standard.set(data, forKey: defaultsKey(provider))
+ }
+
+ static func remember(_ status: VoiceStatus) {
+ for entry in status.providers { remember(entry.defaults, for: entry.provider) }
}
/// `realtime` (a live conversation) or `speech` (speech to text, then the reply read aloud).
@@ -67,11 +84,11 @@ enum VoiceSettings {
static func speechKey(_ provider: VoiceProvider) -> String { "callSpeechModel.\(provider.rawValue)" }
static func transcribeModel(_ provider: VoiceProvider) -> String {
- UserDefaults.standard.string(forKey: transcribeKey(provider)) ?? provider.transcribeModel
+ UserDefaults.standard.string(forKey: transcribeKey(provider)) ?? defaults(provider).transcribe
}
static func speechModel(_ provider: VoiceProvider) -> String {
- UserDefaults.standard.string(forKey: speechKey(provider)) ?? provider.speechModel
+ UserDefaults.standard.string(forKey: speechKey(provider)) ?? defaults(provider).speech
}
/// Keeps a model the user picked; the default isn't stored, so a newer default reaches them.
diff --git a/kit/Tests/CodyncUITests/VoiceSettingsTests.swift b/kit/Tests/CodyncUITests/VoiceSettingsTests.swift
new file mode 100644
index 00000000..a365ddbe
--- /dev/null
+++ b/kit/Tests/CodyncUITests/VoiceSettingsTests.swift
@@ -0,0 +1,34 @@
+import Foundation
+import Testing
+@testable import CodyncKit
+@testable import CodyncUI
+
+/// The computer's newest models become the defaults; a model the user picked stays theirs,
+/// and picking the default stores nothing, so the next newer default reaches them too.
+@Test @MainActor func voiceDefaultsFollowTheComputerUnlessPicked() throws {
+ let p = VoiceProvider.gemini
+ let keys = [VoiceSettings.defaultsKey(p), VoiceSettings.transcribeKey(p)]
+ defer { keys.forEach(UserDefaults.standard.removeObject(forKey:)) }
+ keys.forEach(UserDefaults.standard.removeObject(forKey:))
+
+ #expect(VoiceSettings.transcribeModel(p) == p.transcribeModel)
+
+ let status = try JSONDecoder().decode(VoiceStatus.self, from: Data("""
+ {"providers":[{"provider":"gemini","configured":true,"defaultModel":"gemini-9-live",
+ "defaults":{"realtime":"gemini-9-live","transcribe":"gemini-9-flash","speech":"gemini-9-flash-tts"}}]}
+ """.utf8))
+ VoiceSettings.remember(status)
+ #expect(VoiceSettings.transcribeModel(p) == "gemini-9-flash")
+
+ VoiceSettings.save("gemini-9-flash", default: VoiceSettings.defaults(p).transcribe, forKey: VoiceSettings.transcribeKey(p))
+ #expect(UserDefaults.standard.string(forKey: VoiceSettings.transcribeKey(p)) == nil)
+
+ VoiceSettings.save("gemini-1-flash", default: VoiceSettings.defaults(p).transcribe, forKey: VoiceSettings.transcribeKey(p))
+ VoiceSettings.remember(VoiceDefaults(realtime: "a", transcribe: "gemini-10-flash", speech: "b"), for: p)
+ #expect(VoiceSettings.transcribeModel(p) == "gemini-1-flash")
+
+ // A host from before 2.6.3 sends no defaults: the last known ones stay.
+ let old = try JSONDecoder().decode(VoiceStatus.self, from: Data(#"{"providers":[{"provider":"gemini","configured":true}]}"#.utf8))
+ VoiceSettings.remember(old)
+ #expect(VoiceSettings.defaults(p).transcribe == "gemini-10-flash")
+}