free-coding-models 0.1.50 β†’ 0.1.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -935,9 +935,9 @@ After installation, you can use: opencode --model ${modelRef}`
935
935
  })
936
936
  }
937
937
  } else {
938
- // πŸ“– Groq and Cerebras are built-in OpenCode providers β€” no 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 provider β€” needs 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.
941
941
  console.log(chalk.green(` πŸš€ Setting ${chalk.bold(model.label)} as default…`))
942
942
  console.log(chalk.dim(` Model: ${modelRef}`))
943
943
  console.log()
@@ -950,6 +950,34 @@ After installation, you can use: opencode --model ${modelRef}`
950
950
  console.log(chalk.dim(` πŸ’Ύ Backup: ${backupPath}`))
951
951
  }
952
952
 
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
+
953
981
  config.model = modelRef
954
982
  saveOpenCodeConfig(config)
955
983
 
@@ -1092,7 +1120,9 @@ ${isWindows ? 'set NVIDIA_API_KEY=your_key_here' : 'export NVIDIA_API_KEY=your_k
1092
1120
  console.log()
1093
1121
  }
1094
1122
  } 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.
1096
1126
  console.log(chalk.green(` πŸ–₯ Setting ${chalk.bold(model.label)} as default for OpenCode Desktop…`))
1097
1127
  console.log(chalk.dim(` Model: ${modelRef}`))
1098
1128
  console.log()
@@ -1105,6 +1135,31 @@ ${isWindows ? 'set NVIDIA_API_KEY=your_key_here' : 'export NVIDIA_API_KEY=your_k
1105
1135
  console.log(chalk.dim(` πŸ’Ύ Backup: ${backupPath}`))
1106
1136
  }
1107
1137
 
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
+
1108
1163
  config.model = modelRef
1109
1164
  saveOpenCodeConfig(config)
1110
1165
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "free-coding-models",
3
- "version": "0.1.50",
3
+ "version": "0.1.51",
4
4
  "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.",
5
5
  "keywords": [
6
6
  "nvidia",