跳转到内容
打开 Castaly控制台

接入编程助手

OpenCode 接入

在 OpenCode 中把 Modelflare 配成 OpenAI 兼容供应商。

在 Modelflare 创建一个可以访问 gpt-5.6-sol 的非 default 分组 API Key。

终端窗口PowerShell
choco install opencode
opencode --version

如果安装失败,请改用下面的命令:

终端窗口bash
npm install -g opencode-ai@latest --registry=https://registry.npmmirror.com

进入你的项目目录,然后执行当前系统的命令。

终端窗口PowerShell
$config = @'
{
"$schema": "https://opencode.ai/config.json",
"model": "modelflare/gpt-5.6-sol",
"provider": {
"modelflare": {
"npm": "@ai-sdk/openai-compatible",
"name": "Modelflare",
"options": { "baseURL": "https://modelflare.dev/v1" },
"models": {
"gpt-5.6-sol": { "name": "GPT 5.6 Sol" }
}
}
}
}
'@
$utf8NoBom = New-Object System.Text.UTF8Encoding -ArgumentList $false
[System.IO.File]::WriteAllText(
(Join-Path (Get-Location) "opencode.json"),
$config,
$utf8NoBom
)

在同一个项目目录启动 OpenCode:

终端窗口bash
opencode

输入 /connect,选择 Other,把 provider id 填为 modelflare,然后粘贴你的 Modelflare API Key。

输入 /models,选择 modelflare/gpt-5.6-sol,然后发送:

Text
请用一句话向我问好。

能够正常回复,就说明配置完成。