我的配置
opencode.jsonc
位于 ~/.config/opencode/opencode.jsonc。
配置中包含中转站的连接字段。
对于官方 chagpt,实际上不需要在文件中特殊配置。我添加 openai 并修改部分字段是为了控制超时时间和上下文。其余字段不用管,opencode 会自动使用默认值。
{
"$schema": "https://opencode.ai/config.json",
"autoupdate": false,
"websearch": {
"provider": "exa"
},
"permissions": [
{
"action": "*",
"resource": "*",
"effect": "allow"
}
],
"provider": {
"openai": {
"options": {
"headerTimeout": 120000,
"chunkTimeout": 300000
},
"models": {
"gpt-6-astra": {
"limit": {
"context": 422000,
"input": 294000,
"output": 128000
}
},
"gpt-6.1-sol": {
"limit": {
"context": 500000,
"input": 372000,
"output": 128000
}
},
"gpt-6-astra-fast": {
"limit": {
"context": 422000,
"input": 294000,
"output": 128000
}
},
"gpt-6.1-sol-fast": {
"limit": {
"context": 500000,
"input": 372000,
"output": 128000
}
}
}
},
"deepseek": {
"npm": "@ai-sdk/anthropic",
"name": "DeepSeek",
"options": {
"baseURL": "https://api.deepseek.com/anthropic/v1",
"apiKey": "xxxx",
"headerTimeout": 120000,
"chunkTimeout": 300000
},
"models": {
"deepseek-flash": {
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8000
},
"effort": "high"
},
"variants": {
"high": {
"thinking": {
"type": "enabled",
"budgetTokens": 8000
},
"effort": "high"
},
"max": {
"thinking": {
"type": "enabled",
"budgetTokens": 8000
},
"effort": "max"
}
}
},
"deepseek-v4-pro": {
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8000
},
"effort": "high"
},
"variants": {
"high": {
"thinking": {
"type": "enabled",
"budgetTokens": 8000
},
"effort": "high"
},
"max": {
"thinking": {
"type": "enabled",
"budgetTokens": 8000
},
"effort": "max"
}
}
}
}
},
"torchai-gpt": {
"npm": "@ai-sdk/openai",
"name": "torchai-gpt",
"options": {
"setCacheKey": true,
"headerTimeout": 120000,
"chunkTimeout": 300000,
"baseURL": "https://ugq.ai/v1",
"apiKey": "xxxx"
},
"models": {
"gpt-6-astra": {
"name": "GPT-6 Astra",
"tool_call": true,
"cost": {
"input": 2.5,
"output": 12.5,
"cache_read": 3.125,
"cache_write": 0.25
},
"limit": {
"context": 372000,
"output": 128000
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"options": {
"store": false,
"reasoningEffort": "high",
"reasoningSummary": "auto"
},
"variants": {
"low": {
"reasoningEffort": "low",
"reasoningSummary": "auto"
},
"medium": {
"reasoningEffort": "medium",
"reasoningSummary": "auto"
},
"high": {
"reasoningEffort": "high",
"reasoningSummary": "auto"
},
"xhigh": {
"reasoningEffort": "xhigh",
"reasoningSummary": "auto"
},
"max": {
"reasoningEffort": "max",
"reasoningSummary": "auto"
}
}
},
"gpt-6.1-sol": {
"name": "GPT-6.1 Sol",
"tool_call": true,
"cost": {
"input": 0.5,
"output": 2.5,
"cache_read": 0.05,
"context_over_200k": {
"input": 1,
"output": 5,
"cache_read": 0.1
}
},
"limit": {
"context": 1050000,
"input": 922000,
"output": 128000
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"options": {
"store": false,
"reasoningEffort": "high",
"textVerbosity": "low",
"reasoningSummary": "auto"
},
"variants": {
"max": {
"reasoningEffort": "max"
},
"xhigh": {
"reasoningEffort": "xhigh"
},
"high": {
"reasoningEffort": "high"
},
"medium": {
"reasoningEffort": "medium"
},
"low": {
"reasoningEffort": "low"
},
"none": {
"reasoningEffort": "none"
}
}
},
"gpt-6-sol": {
"name": "GPT-6 Sol",
"tool_call": true,
"cost": {
"input": 0.5,
"output": 2.5,
"cache_read": 0.05,
"context_over_200k": {
"input": 1,
"output": 5,
"cache_read": 0.1
}
},
"limit": {
"context": 1050000,
"input": 922000,
"output": 128000
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"options": {
"store": false,
"reasoningEffort": "high",
"textVerbosity": "low",
"reasoningSummary": "auto"
},
"variants": {
"max": {
"reasoningEffort": "max"
},
"xhigh": {
"reasoningEffort": "xhigh"
},
"high": {
"reasoningEffort": "high"
},
"medium": {
"reasoningEffort": "medium"
},
"low": {
"reasoningEffort": "low"
},
"none": {
"reasoningEffort": "none"
}
}
},
"gpt-6-luna": {
"name": "GPT-6 Luna",
"tool_call": true,
"cost": {
"input": 0.025,
"output": 0.125,
"cache_read": 0.025,
"context_over_200k": {
"input": 0.05,
"output": 0.25,
"cache_read": 0.05
}
},
"limit": {
"context": 1050000,
"input": 922000,
"output": 128000
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"options": {
"serviceTier": "priority",
"store": false,
"reasoningEffort": "medium",
"textVerbosity": "low",
"reasoningSummary": "auto"
},
"variants": {
"max": {
"reasoningEffort": "max"
},
"xhigh": {
"reasoningEffort": "xhigh"
},
"high": {
"reasoningEffort": "high"
},
"medium": {
"reasoningEffort": "medium"
},
"low": {
"reasoningEffort": "low"
},
"none": {
"reasoningEffort": "none"
}
}
}
}
},
"micu-grok": {
"npm": "@ai-sdk/openai",
"name": "micu-grok",
"options": {
"headerTimeout": 120000,
"chunkTimeout": 300000,
"baseURL": "https://www.micuapi.ai/v1",
"apiKey": "xxxx"
},
"models": {
"grok-4.7": {
"name": "Grok 4.7",
"tool_call": true,
"headers": {
"x-grok-conv-id": "opencode-stable-user",
"x-session-id": "opencode-stable-user",
"conversation_id": "opencode-stable-user",
"session_id": "opencode-stable-user"
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 500000,
"output": 128000
},
"cost": {
"input": 0.32,
"output": 0.96,
"cache_read": 0.08,
"cache_write": 0.08
},
"options": {
"store": false,
"reasoningEffort": "high"
},
"variants": {
"low": {
"reasoningEffort": "low"
},
"medium": {
"reasoningEffort": "medium"
},
"high": {
"reasoningEffort": "high"
},
"xhigh": {
"reasoningEffort": "xhigh"
}
}
},
"grok-4.6": {
"name": "Grok 4.6",
"tool_call": true,
"headers": {
"x-grok-conv-id": "opencode-stable-user",
"x-session-id": "opencode-stable-user",
"conversation_id": "opencode-stable-user",
"session_id": "opencode-stable-user"
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 500000,
"output": 128000
},
"cost": {
"input": 0.6,
"output": 1.8,
"cache_read": 0.15,
"context_over_200k": {
"input": 1.2,
"output": 3.6,
"cache_read": 0.3
}
},
"options": {
"store": false,
"reasoningEffort": "high"
},
"variants": {
"low": {
"reasoningEffort": "low"
},
"medium": {
"reasoningEffort": "medium"
},
"high": {
"reasoningEffort": "high"
},
"xhigh": {
"reasoningEffort": "xhigh"
}
}
}
}
},
"huanling-grok": {
"npm": "@ai-sdk/openai",
"name": "huanling-grok",
"options": {
"headerTimeout": 120000,
"chunkTimeout": 300000,
"baseURL": "https://api.huanling.icu",
"apiKey": "xxxx"
},
"models": {
"grok-4.7": {
"name": "Grok 4.7",
"tool_call": true,
"headers": {
"x-grok-conv-id": "opencode-stable-user",
"x-session-id": "opencode-stable-user",
"conversation_id": "opencode-stable-user",
"session_id": "opencode-stable-user"
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 500000,
"output": 128000
},
"cost": {
"input": 0.32,
"output": 0.96,
"cache_read": 0.08,
"cache_write": 0.08
},
"options": {
"store": false,
"reasoningEffort": "high"
},
"variants": {
"low": {
"reasoningEffort": "low"
},
"medium": {
"reasoningEffort": "medium"
},
"high": {
"reasoningEffort": "high"
},
"xhigh": {
"reasoningEffort": "xhigh"
}
}
},
"grok-4.6": {
"name": "Grok 4.6",
"tool_call": true,
"headers": {
"x-grok-conv-id": "opencode-stable-user",
"x-session-id": "opencode-stable-user",
"conversation_id": "opencode-stable-user",
"session_id": "opencode-stable-user"
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
},
"limit": {
"context": 500000,
"output": 128000
},
"cost": {
"input": 0.32,
"output": 0.96,
"cache_read": 0.08,
"cache_write": 0.08
},
"options": {
"store": false,
"reasoningEffort": "high"
},
"variants": {
"low": {
"reasoningEffort": "low"
},
"medium": {
"reasoningEffort": "medium"
},
"high": {
"reasoningEffort": "high"
},
"xhigh": {
"reasoningEffort": "xhigh"
}
}
}
}
}
},
"mcp": {
"servers": {
"browser-mcp": {
"type": "local",
"command": [
"npx",
"-y",
"@agent360/browser-mcp@latest"
],
"disabled": false
}
}
},
"experimental": {
"todo": true
},
"lsp": true,插件等配置不用手动写入,在插件安装后会自动修改配置。
cli.json
位于 ~/.config/opencode/cli.json,是 opencode 界面相关配置。
{
"$schema": "https://opencode.ai/v2/cli.json",
"keybinds": {
"terminal.suspend": "none",
"input.undo": "ctrl+z,f6",
"input.redo": "ctrl+y,f7"
},
"theme": {
"name": "opencode"
},
"diffs": {
"wrap": "word",
"single": false
},
"session": {
"sidebar": "auto",
"scrollbar": true,
"thinking": "show",
"verbosity": "medium",
"permissions": "autoaccept"
},
"animations": true,
"tabs": {
"mode": "auto",
"layout": "horizontal"
},
"prompt": {
"paste": "full"
},
"attention": {
"notifications": true
},
"mini": {
"thinking": "show",
"tools": "show",
"shell_output": "show",
"turn_summary": "show",
"footer": "show",
"work_spinner": "crosshatch"
}
}