OpenCode Setup
Connect OpenCode to Modelflare as an OpenAI-compatible provider and switch between supported models and model groups.
1. Create an API key
Create a Modelflare API key whose non-default group can access gpt-5.6-sol.
2. Install OpenCode
Windows PowerShell
choco install opencode
opencode --version
Linux or macOS
curl -fsSL https://opencode.ai/install | bash
opencode --version
3. Create opencode.json
Enter your project directory, then run the command for your system.
Windows 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
)
Linux or macOS
cat > opencode.json << 'EOF'
{
"$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" }
}
}
}
}
EOF
4. Connect your API key
Start OpenCode in the same project directory:
opencode
Enter /connect, choose Other, set the provider id to modelflare, and paste your Modelflare API key.
5. Select the model and test
Enter /models, select modelflare/gpt-5.6-sol, and send:
Reply with one short greeting.
A normal reply means setup is complete.