@@ -48,6 +48,16 @@ var _ = Describe("MLXImporter", func() {
4848 Expect (result ).To (BeTrue ())
4949 })
5050
51+ It ("should match when backend preference is mlx-audio" , func () {
52+ preferences := json .RawMessage (`{"backend": "mlx-audio"}` )
53+ details := importers.Details {
54+ URI : "https://example.com/model" ,
55+ Preferences : preferences ,
56+ }
57+
58+ Expect (importer .Match (details )).To (BeTrue ())
59+ })
60+
5161 It ("should not match when URI does not contain mlx-community/ and no backend preference" , func () {
5262 details := importers.Details {
5363 URI : "https://huggingface.co/other-org/test-model" ,
@@ -123,6 +133,21 @@ var _ = Describe("MLXImporter", func() {
123133 Expect (modelConfig .ConfigFile ).To (ContainSubstring ("backend: mlx-vlm" ))
124134 })
125135
136+ It ("should configure explicit mlx-audio imports for text-to-speech" , func () {
137+ preferences := json .RawMessage (`{"backend": "mlx-audio"}` )
138+ details := importers.Details {
139+ URI : "https://huggingface.co/mlx-community/Kokoro-82M-4bit" ,
140+ Preferences : preferences ,
141+ }
142+
143+ modelConfig , err := importer .Import (details )
144+
145+ Expect (err ).ToNot (HaveOccurred ())
146+ Expect (modelConfig .ConfigFile ).To (ContainSubstring ("backend: mlx-audio" ))
147+ Expect (modelConfig .ConfigFile ).To (ContainSubstring ("- tts" ))
148+ Expect (modelConfig .ConfigFile ).ToNot (ContainSubstring ("use_tokenizer_template: true" ))
149+ })
150+
126151 It ("should auto-route vision-language models to the mlx-vlm backend" , func () {
127152 // gemma-4 E4B and similar VLMs declare pipeline_tag
128153 // "image-text-to-text" on HuggingFace. The text-only mlx-lm
@@ -143,6 +168,23 @@ var _ = Describe("MLXImporter", func() {
143168 Expect (modelConfig .ConfigFile ).To (ContainSubstring ("backend: mlx-vlm" ))
144169 })
145170
171+ It ("should auto-route text-to-speech models to the mlx-audio backend" , func () {
172+ details := importers.Details {
173+ URI : "https://huggingface.co/mlx-community/Kokoro-82M-4bit" ,
174+ HuggingFace : & hfapi.ModelDetails {
175+ ModelID : "mlx-community/Kokoro-82M-4bit" ,
176+ PipelineTag : "text-to-speech" ,
177+ },
178+ }
179+
180+ modelConfig , err := importer .Import (details )
181+
182+ Expect (err ).ToNot (HaveOccurred ())
183+ Expect (modelConfig .ConfigFile ).To (ContainSubstring ("backend: mlx-audio" ))
184+ Expect (modelConfig .ConfigFile ).To (ContainSubstring ("- tts" ))
185+ Expect (modelConfig .ConfigFile ).ToNot (ContainSubstring ("use_tokenizer_template: true" ))
186+ })
187+
146188 It ("should keep text-only models on the plain mlx backend" , func () {
147189 details := importers.Details {
148190 URI : "https://huggingface.co/mlx-community/Llama-3.2-1B-Instruct-4bit" ,
0 commit comments