~/.config/opencode/opencode.json(或 opencode.jsonc),不存在需手动创建。可使用默认 provider(openai/anthropic/google)或自定义 provider_id。API Key 支持直接配置或通过客户端 /connect 命令配置。示例仅供参考,模型与选项可按需调整。C:\Users\your-user-name\.config\opencode\opencode.json{
"$schema": "https://opencode.ai/config.json",
"provider": {
"openai": {
"npm": "@ai-sdk/anthropic",
"name": "openai",
"options": {
"baseURL": "https://syapi.deeprespond.cn/v1",
"apiKey": "sk-xxxxxxxxxxxxxxxxxx"
},
"models": {
"glm-5.1": {
"name": "glm-5.1",
"limit": {
"context": 12800,
"output": 12800
}
}
}
}
},
"model": "myprovider/glm-5.1"
}