Skip to content

Commit 9cdbbd9

Browse files
vava-nessaclaude
andcommitted
0.1.51
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e753047 commit 9cdbbd9

3 files changed

Lines changed: 65 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
---
44

5+
## 0.1.51
6+
7+
### Fixed
8+
- **Groq/Cerebras models selected for OpenCode had no provider block**: even with the correct `groq/model-id` prefix, OpenCode couldn't use the model because no `provider.groq` block existed in `opencode.json` — now automatically creates the provider block (Groq: built-in with `apiKey: {env:GROQ_API_KEY}`; Cerebras: `@ai-sdk/openai-compatible` with baseURL) and registers the model in `provider.<key>.models`
9+
510
## 0.1.50
611

712
### Fixed

bin/free-coding-models.js

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -935,9 +935,9 @@ After installation, you can use: opencode --model ${modelRef}`
935935
})
936936
}
937937
} else {
938-
// 📖 Groq and Cerebras are built-in OpenCode providersno custom provider config needed.
939-
// 📖 OpenCode discovers them via GROQ_API_KEY / CEREBRAS_API_KEY env vars automatically.
940-
// 📖 Just set the model in config and launch with --model groq/model-id.
938+
// 📖 Groq: built-in OpenCode providerneeds provider block with apiKey in opencode.json.
939+
// 📖 Cerebras: NOT built-in — needs @ai-sdk/openai-compatible + baseURL, like NVIDIA.
940+
// 📖 Both need the model registered in provider.<key>.models so OpenCode can find it.
941941
console.log(chalk.green(` 🚀 Setting ${chalk.bold(model.label)} as default…`))
942942
console.log(chalk.dim(` Model: ${modelRef}`))
943943
console.log()
@@ -950,6 +950,34 @@ After installation, you can use: opencode --model ${modelRef}`
950950
console.log(chalk.dim(` 💾 Backup: ${backupPath}`))
951951
}
952952

953+
// 📖 Ensure the provider block exists in config — create it if missing
954+
if (!config.provider) config.provider = {}
955+
if (!config.provider[providerKey]) {
956+
if (providerKey === 'groq') {
957+
// 📖 Groq is a built-in OpenCode provider — just needs apiKey options, no npm package
958+
config.provider.groq = {
959+
options: { apiKey: '{env:GROQ_API_KEY}' },
960+
models: {}
961+
}
962+
} else if (providerKey === 'cerebras') {
963+
// 📖 Cerebras is OpenAI-compatible — needs npm package and baseURL like NVIDIA
964+
config.provider.cerebras = {
965+
npm: '@ai-sdk/openai-compatible',
966+
name: 'Cerebras',
967+
options: {
968+
baseURL: 'https://api.cerebras.ai/v1',
969+
apiKey: '{env:CEREBRAS_API_KEY}'
970+
},
971+
models: {}
972+
}
973+
}
974+
}
975+
976+
// 📖 Register the model in the provider's models section
977+
// 📖 OpenCode requires models to be explicitly listed to recognize them
978+
if (!config.provider[providerKey].models) config.provider[providerKey].models = {}
979+
config.provider[providerKey].models[model.modelId] = { name: model.label }
980+
953981
config.model = modelRef
954982
saveOpenCodeConfig(config)
955983

@@ -1092,7 +1120,9 @@ ${isWindows ? 'set NVIDIA_API_KEY=your_key_here' : 'export NVIDIA_API_KEY=your_k
10921120
console.log()
10931121
}
10941122
} else {
1095-
// 📖 Groq and Cerebras are built-in OpenCode providers — just set model and open Desktop.
1123+
// 📖 Groq: built-in OpenCode provider — needs provider block with apiKey in opencode.json.
1124+
// 📖 Cerebras: NOT built-in — needs @ai-sdk/openai-compatible + baseURL, like NVIDIA.
1125+
// 📖 Both need the model registered in provider.<key>.models so OpenCode can find it.
10961126
console.log(chalk.green(` 🖥 Setting ${chalk.bold(model.label)} as default for OpenCode Desktop…`))
10971127
console.log(chalk.dim(` Model: ${modelRef}`))
10981128
console.log()
@@ -1105,6 +1135,31 @@ ${isWindows ? 'set NVIDIA_API_KEY=your_key_here' : 'export NVIDIA_API_KEY=your_k
11051135
console.log(chalk.dim(` 💾 Backup: ${backupPath}`))
11061136
}
11071137

1138+
// 📖 Ensure the provider block exists in config — create it if missing
1139+
if (!config.provider) config.provider = {}
1140+
if (!config.provider[providerKey]) {
1141+
if (providerKey === 'groq') {
1142+
config.provider.groq = {
1143+
options: { apiKey: '{env:GROQ_API_KEY}' },
1144+
models: {}
1145+
}
1146+
} else if (providerKey === 'cerebras') {
1147+
config.provider.cerebras = {
1148+
npm: '@ai-sdk/openai-compatible',
1149+
name: 'Cerebras',
1150+
options: {
1151+
baseURL: 'https://api.cerebras.ai/v1',
1152+
apiKey: '{env:CEREBRAS_API_KEY}'
1153+
},
1154+
models: {}
1155+
}
1156+
}
1157+
}
1158+
1159+
// 📖 Register the model in the provider's models section
1160+
if (!config.provider[providerKey].models) config.provider[providerKey].models = {}
1161+
config.provider[providerKey].models[model.modelId] = { name: model.label }
1162+
11081163
config.model = modelRef
11091164
saveOpenCodeConfig(config)
11101165

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "free-coding-models",
3-
"version": "0.1.50",
3+
"version": "0.1.51",
44
"description": "Find the fastest coding LLM models in seconds — ping free models from multiple providers, pick the best one for OpenCode, Cursor, or any AI coding assistant.",
55
"keywords": [
66
"nvidia",

0 commit comments

Comments
 (0)