docs: enhance provider configuration documentation with Anthropic examples

Add comprehensive examples for custom Anthropic-compatible provider configuration
including thinking budget options and realistic configuration patterns.

* Add Anthropic-compatible provider example with thinking configuration
* Enhance existing custom provider example with reasoningEffort option
* Remove unnecessary code block line highlighting for cleaner examples
* Improve documentation coverage for advanced provider options
This commit is contained in:
Huang Qi 2025-12-01 17:17:54 +08:00
parent eeb0d2b8e0
commit 7883b2229e

View file

@ -1317,7 +1317,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": {
@ -1334,6 +1334,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
@ -1345,6 +1348,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).