From 566442327ac113853e044672e4e894d1783945eb Mon Sep 17 00:00:00 2001 From: southseact-3d Date: Tue, 10 Feb 2026 19:51:39 +0000 Subject: [PATCH] Fix: Add Chutes and Cerebras provider config to opencode.json When models from providers like Chutes or Cerebras were added via the admin panel, they didn't work in the builder page because the opencode.json config file only included the Ollama provider configuration. This fix adds Chutes and Cerebras provider configurations to the opencode.json file when their respective API keys are available in environment variables (CHUTES_API_KEY and CEREBRAS_API_KEY). Fixes the issue where chutes/deepseek-ai/DeepSeek-V3.2-TEE and similar models would fail to load from the builder page. --- chat/server.js | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/chat/server.js b/chat/server.js index 5d1f974..1082e22 100644 --- a/chat/server.js +++ b/chat/server.js @@ -5116,6 +5116,31 @@ async function ensureOpencodeConfig(session) { providerCfg.options.apiKey = OPENCODE_OLLAMA_API_KEY; } + const providers = { + [providerName]: providerCfg + }; + + // Add Chutes provider if API key is configured + if (CHUTES_API_KEY) { + providers.chutes = { + options: { + apiKey: CHUTES_API_KEY + }, + models: {} + }; + } + + // Add Cerebras provider if API key is configured + const cerebrasKey = process.env.CEREBRAS_API_KEY; + if (cerebrasKey) { + providers.cerebras = { + options: { + apiKey: cerebrasKey + }, + models: {} + }; + } + const config = { $schema: 'https://opencode.ai/config.json', model: `${providerName}/${modelId}`, @@ -5127,10 +5152,8 @@ async function ensureOpencodeConfig(session) { [`apps/${userSegment}/${appSegment}/*`]: 'allow' } }, - provider: { - [providerName]: providerCfg - } - }; + provider: providers + }; const configPath = path.join(session.workspaceDir, 'opencode.json');