This commit is contained in:
Huang Qi 2025-12-23 15:42:04 +08:00 committed by GitHub
commit e78ea6339d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1360,7 +1360,7 @@ You can use any OpenAI-compatible provider with opencode. Most modern AI provide
Here's an example setting the `apiKey`, `headers`, and model `limit` options.
```json title="opencode.json" {9,11,17-20}
```json title="opencode.json"
{
"$schema": "https://opencode.ai/config.json",
"provider": {
@ -1377,6 +1377,9 @@ Here's an example setting the `apiKey`, `headers`, and model `limit` options.
"models": {
"my-model-name": {
"name": "My Model Display Name",
"options": {
"reasoningEffort": "high"
},
"limit": {
"context": 200000,
"output": 65536
@ -1388,6 +1391,35 @@ Here's an example setting the `apiKey`, `headers`, and model `limit` options.
}
```
For Anthropic-compatible providers:
```json title="opencode.json"
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"anthropic-provider": {
"npm": "@ai-sdk/anthropic",
"name": "My AI ProviderDisplay Name",
"options": {
"baseURL": "https://api.myprovider.com/v1",
"apiKey": "{env:ANTHROPIC_API_KEY}"
},
"models": {
"my-model-name": {
"name": "My Model Display Name",
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8000
}
}
}
}
}
}
}
```
Configuration details:
- **apiKey**: Set using `env` variable syntax, [learn more](/docs/config#env-vars).