> ## Documentation Index
> Fetch the complete documentation index at: https://docs-vip.apigo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude 扩展参数(model_extra)示例

> Claude 专有参数透传示例。

## 适合什么场景

* 你要透传 Claude 的 thinking、tool\_choice 或 beta 能力配置
* 统一接口层不想直接暴露 Anthropic 专有字段

## 最小请求

```json theme={null}
{
  "model": "claude-sonnet-4-20250514",
  "messages": [
    { "role": "user", "content": "总结这份报告。" }
  ],
  "model_extra": {
    "thinking": { "type": "enabled", "budget_tokens": 1024 },
    "tool_choice": { "type": "auto" }
  }
}
```

## cURL 示例

```bash theme={null}
curl https://api-vip.apigo.ai/v1/chat/completions \
  -H "Authorization: Bearer $YOUR API KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-20250514",
    "messages": [
      { "role": "user", "content": "总结这份报告。" }
    ],
    "model_extra": {
      "thinking": { "type": "enabled", "budget_tokens": 1024 },
      "tool_choice": { "type": "auto" }
    }
  }'
```

## Python 示例

```python theme={null}
import requests

response = requests.post(
    "https://api-vip.apigo.ai/v1/chat/completions",
    headers={
        "Authorization": "Bearer <YOUR API KEY>",
        "Content-Type": "application/json",
    },
    json={
        "model": "claude-sonnet-4-20250514",
        "messages": [
            {"role": "user", "content": "总结这份报告。"}
        ],
        "model_extra": {
            "thinking": {"type": "enabled", "budget_tokens": 1024},
            "tool_choice": {"type": "auto"},
        },
    },
    timeout=60,
)
response.raise_for_status()

print(response.json()["choices"][0]["message"]["content"])
```

## Node.js 示例

```js theme={null}
const response = await fetch("https://api-vip.apigo.ai/v1/chat/completions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.YOUR API KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    model: "claude-sonnet-4-20250514",
    messages: [
      { role: "user", content: "总结这份报告。" }
    ],
    model_extra: {
      thinking: { type: "enabled", budget_tokens: 1024 },
      tool_choice: { type: "auto" }
    }
  })
});

const data = await response.json();
console.log(data.choices[0].message.content);
```

## 最佳实践

* beta 或 thinking 相关字段优先只在服务端开放
* 对不同模型支持差异做静态校验，不要盲透传
