Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (C) 2026 DevEmperor (Dictate)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*/

package dev.patrickgold.florisboard.dictate

import dev.patrickgold.florisboard.dictate.provider.ProviderRegistry
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNotNull
import kotlin.test.assertTrue

class ProviderRegistryTest {

@Test
fun cerebrasIsAvailableAsFastRewordingProvider() {
val preset = assertNotNull(ProviderRegistry.byId("cerebras"))

assertEquals("Cerebras", preset.displayName)
assertEquals("https://api.cerebras.ai/v1/", preset.baseUrl)
assertEquals("https://cloud.cerebras.ai/", preset.apiKeyUrl)
assertTrue(preset.capabilities.chat)
assertFalse(preset.capabilities.transcription)
assertTrue(preset.supportsDynamicModels)
assertEquals("gemma-4-31b", preset.defaultChatModel)
assertTrue("gemma-4-31b" in preset.curatedChatModels)
assertTrue(preset in ProviderRegistry.presets)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ import javax.net.ssl.X509TrustManager

/**
* A single client implementation that talks to any OpenAI Chat Completions / Audio Transcriptions
* compatible endpoint. This one class covers OpenAI, Groq, OpenRouter, Together, DeepInfra, Mistral,
* xAI, DeepSeek, local Ollama and arbitrary custom servers – they only differ by base URL, key and
* compatible endpoint. This one class covers OpenAI, Groq, Cerebras, OpenRouter, Together, DeepInfra,
* Mistral, xAI, DeepSeek, local Ollama and arbitrary custom servers – they only differ by base URL, key and
* a few headers (see [ProviderRegistry] and [ProviderConfig]).
*
* Google Gemini is also handled here: chat/rewording goes through its OpenAI-compatible layer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,24 @@ object ProviderRegistry {
),
)

/**
* Cerebras Inference is chat-only here. Its OpenAI-compatible API is a strong fit for
* low-latency cleanup prompts after dictation; Gemma 4 31B is the fast default suggested for
* punctuation, filler-word removal and light grammar correction.
*/
val CEREBRAS = ProviderPreset(
id = "cerebras",
displayName = "Cerebras",
baseUrl = "https://api.cerebras.ai/v1/",
capabilities = CHAT_ONLY,
supportsDynamicModels = true,
apiKeyUrl = "https://cloud.cerebras.ai/",
defaultChatModel = "gemma-4-31b",
curatedChatModels = listOf(
"gemma-4-31b", "gpt-oss-120b", "zai-glm-4.7",
),
)

val OPENROUTER = ProviderPreset(
id = "openrouter",
displayName = "OpenRouter",
Expand Down Expand Up @@ -376,7 +394,7 @@ object ProviderRegistry {

/** All built-in presets in display order. The custom option is added by the UI on top of these. */
val presets: List<ProviderPreset> = listOf(
OPENAI, GROQ, OPENROUTER, GEMINI, ANTHROPIC, TOGETHER, DEEPINFRA, MISTRAL, SONIOX,
OPENAI, GROQ, CEREBRAS, OPENROUTER, GEMINI, ANTHROPIC, TOGETHER, DEEPINFRA, MISTRAL, SONIOX,
ELEVENLABS, DEEPGRAM, ASSEMBLYAI, XAI, DEEPSEEK, OLLAMA, LOCAL,
)

Expand Down