feat(models): add Claude Opus 5.5, Sonnet 5.5 and Haiku 5.5 to the catalog (#4158)
These three models were missing from the catalog, so they resolved to the anthropic defaults: budget thinking (they reject budget_tokens) and temperature/top_p (they reject non-default sampling values). seed.json pins their metadata from the models overview and pricing pages: 1M context, 128K output, and base, 5m cache write, cache hit and output prices. Haiku 5.5 is priced by prompt length, and the catalog has one price per model, so it carries the prompts-up-to-100k tier. overrides.json gives all three adaptive thinking with effort (all five levels), with temperature and top_p off. Thinking off differs per model. Opus 5.5 can't turn thinking off, so off is unsupported, like Fable 5.1. Haiku 5.5 accepts "disabled". Sonnet 5.5 rejects "disabled" and turns off up-front thinking with "between_tools". The new thinking_off_type compat field carries that value. Empty keeps "disabled", and it is omitempty so the parity hashes of other entries don't change. Claude-Session: https://claude.ai/code/session_01BeNHkjF4spsH9d18UiYPiU Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>main
parent
00474f734d
commit
9efe94cc6f
|
|
@ -114,6 +114,23 @@ func TestBuildRequestBody_AdaptiveEffort(t *testing.T) {
|
|||
assert.False(t, hasEffort)
|
||||
}
|
||||
|
||||
func TestBuildRequestBody_ThinkingOffType(t *testing.T) {
|
||||
c := newClient(t, "https://api.anthropic.com/v1", func(cfg *Config) {
|
||||
cfg.Settings.ThinkingMode = api.AnthropicThinkingAdaptive
|
||||
cfg.Settings.SupportsEffort = true
|
||||
cfg.Settings.ThinkingOffType = "between_tools"
|
||||
})
|
||||
off := bodyJSON(t, c, []api.Message{{Role: "user", Content: "Hi"}},
|
||||
&api.Options{ReasoningEffort: api.ReasoningOff}, false)
|
||||
assert.Equal(t, map[string]any{"type": "between_tools"}, off["thinking"])
|
||||
_, hasEffort := off["output_config"]
|
||||
assert.False(t, hasEffort)
|
||||
|
||||
on := bodyJSON(t, c, []api.Message{{Role: "user", Content: "Hi"}},
|
||||
&api.Options{ReasoningEffort: api.ReasoningHigh}, false)
|
||||
assert.Equal(t, map[string]any{"type": "adaptive"}, on["thinking"])
|
||||
}
|
||||
|
||||
func TestBuildRequestBody_NoThinkingKeepsSampling(t *testing.T) {
|
||||
c := newClient(t, "https://api.anthropic.com/v1", nil)
|
||||
out := bodyJSON(t, c, []api.Message{{Role: "user", Content: "Hi"}},
|
||||
|
|
|
|||
|
|
@ -142,7 +142,11 @@ func (c *Client) planThinking(opts *api.Options) thinkingPlan {
|
|||
}
|
||||
if !level.Enabled() {
|
||||
if levels.Supports(api.ReasoningOff) && s.ThinkingMode == api.AnthropicThinkingAdaptive {
|
||||
return thinkingPlan{body: map[string]any{"type": "disabled"}}
|
||||
offType := s.ThinkingOffType
|
||||
if offType == "" {
|
||||
offType = "disabled"
|
||||
}
|
||||
return thinkingPlan{body: map[string]any{"type": offType}}
|
||||
}
|
||||
// Budget mode: omitting the thinking object disables it.
|
||||
return thinkingPlan{}
|
||||
|
|
|
|||
|
|
@ -204,6 +204,7 @@ const (
|
|||
// AnthropicMessagesCompat is the overlay for the Messages protocol.
|
||||
type AnthropicMessagesCompat struct {
|
||||
ThinkingMode *AnthropicThinkingMode `json:"thinking_mode,omitempty"`
|
||||
ThinkingOffType *string `json:"thinking_off_type,omitempty"`
|
||||
SupportsEffort *bool `json:"supports_effort,omitempty"`
|
||||
ThinkingBudgets map[ReasoningEffort]int `json:"thinking_budgets,omitempty"`
|
||||
DefaultMaxTokens *int `json:"default_max_tokens,omitempty"`
|
||||
|
|
@ -222,8 +223,12 @@ type AnthropicMessagesCompat struct {
|
|||
|
||||
// AnthropicMessagesSettings is the resolved Messages configuration.
|
||||
type AnthropicMessagesSettings struct {
|
||||
ThinkingMode AnthropicThinkingMode
|
||||
SupportsEffort bool
|
||||
ThinkingMode AnthropicThinkingMode
|
||||
// ThinkingOffType is the thinking.type sent to turn thinking off in
|
||||
// adaptive mode; empty means "disabled". Claude Sonnet 5.5 rejects
|
||||
// "disabled" and turns off up-front thinking with "between_tools".
|
||||
ThinkingOffType string `json:",omitempty"`
|
||||
SupportsEffort bool
|
||||
// ThinkingBudgets maps graded levels to budget_tokens for budget mode.
|
||||
ThinkingBudgets map[ReasoningEffort]int
|
||||
// DefaultMaxTokens is used when the caller set no budget (max_tokens is
|
||||
|
|
|
|||
|
|
@ -1048,6 +1048,107 @@
|
|||
"max": "max"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "claude-opus-5-5",
|
||||
"name": "Claude Opus 5.5",
|
||||
"reasoning": true,
|
||||
"input": [
|
||||
"text",
|
||||
"image"
|
||||
],
|
||||
"context_window": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"cost": {
|
||||
"input": 4,
|
||||
"output": 20,
|
||||
"cache_read": 0.2,
|
||||
"cache_write": 5
|
||||
},
|
||||
"source": "https://platform.claude.com/docs/en/models/overview",
|
||||
"api": "anthropic-messages",
|
||||
"compat": {
|
||||
"supports_temperature": false,
|
||||
"supports_top_p": false,
|
||||
"thinking_mode": "adaptive",
|
||||
"supports_effort": true
|
||||
},
|
||||
"thinking_levels": {
|
||||
"off": null,
|
||||
"minimal": "low",
|
||||
"low": "low",
|
||||
"medium": "medium",
|
||||
"high": "high",
|
||||
"xhigh": "xhigh",
|
||||
"max": "max"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "claude-sonnet-5-5",
|
||||
"name": "Claude Sonnet 5.5",
|
||||
"reasoning": true,
|
||||
"input": [
|
||||
"text",
|
||||
"image"
|
||||
],
|
||||
"context_window": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"cost": {
|
||||
"input": 2,
|
||||
"output": 10,
|
||||
"cache_read": 0.1,
|
||||
"cache_write": 2.5
|
||||
},
|
||||
"source": "https://platform.claude.com/docs/en/models/overview",
|
||||
"api": "anthropic-messages",
|
||||
"compat": {
|
||||
"supports_temperature": false,
|
||||
"supports_top_p": false,
|
||||
"thinking_mode": "adaptive",
|
||||
"supports_effort": true,
|
||||
"thinking_off_type": "between_tools"
|
||||
},
|
||||
"thinking_levels": {
|
||||
"minimal": "low",
|
||||
"low": "low",
|
||||
"medium": "medium",
|
||||
"high": "high",
|
||||
"xhigh": "xhigh",
|
||||
"max": "max"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "claude-haiku-5-5",
|
||||
"name": "Claude Haiku 5.5",
|
||||
"reasoning": true,
|
||||
"input": [
|
||||
"text",
|
||||
"image"
|
||||
],
|
||||
"context_window": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"cost": {
|
||||
"input": 0.1,
|
||||
"output": 0.5,
|
||||
"cache_read": 0.01,
|
||||
"cache_write": 0.125
|
||||
},
|
||||
"source": "https://platform.claude.com/docs/en/models/overview",
|
||||
"api": "anthropic-messages",
|
||||
"compat": {
|
||||
"supports_temperature": false,
|
||||
"supports_top_p": false,
|
||||
"thinking_mode": "adaptive",
|
||||
"supports_effort": true
|
||||
},
|
||||
"thinking_levels": {
|
||||
"minimal": "low",
|
||||
"low": "low",
|
||||
"medium": "medium",
|
||||
"high": "high",
|
||||
"xhigh": "xhigh",
|
||||
"max": "max"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "claude-opus-5",
|
||||
"name": "Claude Opus 5",
|
||||
|
|
|
|||
|
|
@ -496,6 +496,62 @@
|
|||
"max": "max"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "claude-opus-5-5",
|
||||
"api": "anthropic-messages",
|
||||
"compat": {
|
||||
"supports_temperature": false,
|
||||
"supports_top_p": false,
|
||||
"thinking_mode": "adaptive",
|
||||
"supports_effort": true
|
||||
},
|
||||
"thinking_levels": {
|
||||
"off": null,
|
||||
"minimal": "low",
|
||||
"low": "low",
|
||||
"medium": "medium",
|
||||
"high": "high",
|
||||
"xhigh": "xhigh",
|
||||
"max": "max"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "claude-sonnet-5-5",
|
||||
"api": "anthropic-messages",
|
||||
"compat": {
|
||||
"supports_temperature": false,
|
||||
"supports_top_p": false,
|
||||
"thinking_mode": "adaptive",
|
||||
"supports_effort": true,
|
||||
"thinking_off_type": "between_tools"
|
||||
},
|
||||
"thinking_levels": {
|
||||
"minimal": "low",
|
||||
"low": "low",
|
||||
"medium": "medium",
|
||||
"high": "high",
|
||||
"xhigh": "xhigh",
|
||||
"max": "max"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "claude-haiku-5-5",
|
||||
"api": "anthropic-messages",
|
||||
"compat": {
|
||||
"supports_temperature": false,
|
||||
"supports_top_p": false,
|
||||
"thinking_mode": "adaptive",
|
||||
"supports_effort": true
|
||||
},
|
||||
"thinking_levels": {
|
||||
"minimal": "low",
|
||||
"low": "low",
|
||||
"medium": "medium",
|
||||
"high": "high",
|
||||
"xhigh": "xhigh",
|
||||
"max": "max"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "claude-opus-5",
|
||||
"api": "anthropic-messages",
|
||||
|
|
|
|||
|
|
@ -739,6 +739,60 @@
|
|||
},
|
||||
"source": "https://docs.anthropic.com/en/docs/about-claude/models"
|
||||
},
|
||||
{
|
||||
"id": "claude-opus-5-5",
|
||||
"name": "Claude Opus 5.5",
|
||||
"reasoning": true,
|
||||
"input": [
|
||||
"text",
|
||||
"image"
|
||||
],
|
||||
"context_window": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"cost": {
|
||||
"input": 4,
|
||||
"output": 20,
|
||||
"cache_read": 0.2,
|
||||
"cache_write": 5
|
||||
},
|
||||
"source": "https://platform.claude.com/docs/en/models/overview"
|
||||
},
|
||||
{
|
||||
"id": "claude-sonnet-5-5",
|
||||
"name": "Claude Sonnet 5.5",
|
||||
"reasoning": true,
|
||||
"input": [
|
||||
"text",
|
||||
"image"
|
||||
],
|
||||
"context_window": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"cost": {
|
||||
"input": 2,
|
||||
"output": 10,
|
||||
"cache_read": 0.1,
|
||||
"cache_write": 2.5
|
||||
},
|
||||
"source": "https://platform.claude.com/docs/en/models/overview"
|
||||
},
|
||||
{
|
||||
"id": "claude-haiku-5-5",
|
||||
"name": "Claude Haiku 5.5",
|
||||
"reasoning": true,
|
||||
"input": [
|
||||
"text",
|
||||
"image"
|
||||
],
|
||||
"context_window": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"cost": {
|
||||
"input": 0.1,
|
||||
"output": 0.5,
|
||||
"cache_read": 0.01,
|
||||
"cache_write": 0.125
|
||||
},
|
||||
"source": "https://platform.claude.com/docs/en/models/overview"
|
||||
},
|
||||
{
|
||||
"id": "claude-opus-5",
|
||||
"name": "Claude Opus 5",
|
||||
|
|
|
|||
|
|
@ -60,16 +60,19 @@
|
|||
"anthropic/KnowledgeQA/claude-fable-5-1": "a8fd85f4d84dc59d34f6088badbfaa149c025efaeb358bdf18b829a3759a84e3",
|
||||
"anthropic/KnowledgeQA/claude-haiku-4-5": "5eb4abef41f957d98c0a15c83de48c0e6b46be48d59f761ba6006c29010487f9",
|
||||
"anthropic/KnowledgeQA/claude-haiku-4-5-20251001": "50878a87d7d212c8f295f191343f77200d71e71337b934a07a949ce04ef976f1",
|
||||
"anthropic/KnowledgeQA/claude-haiku-5-5": "e69241c875604143108531eb4614a575af80abfc12fbad496462654177331101",
|
||||
"anthropic/KnowledgeQA/claude-opus-4-5": "3536e5a1bb14f6e980eeda66cca9d7fc8bfea8c6b26937765069d93f713a673d",
|
||||
"anthropic/KnowledgeQA/claude-opus-4-5-20251101": "78bfa567c9c17acb9488ea0a7aaccb5b0e73e840db8c4955731debf1382ff8cf",
|
||||
"anthropic/KnowledgeQA/claude-opus-4-6": "96f08927c9e9df5c113102d498d38c1aab3a7280f350f14cfe8fad4dfcffe039",
|
||||
"anthropic/KnowledgeQA/claude-opus-4-7": "d5cac6382ff5bca2f303199ab6a9ccabf8c205569f6cd090ec64bbfd672b4ebe",
|
||||
"anthropic/KnowledgeQA/claude-opus-4-8": "7335b6d93baf2fc6a7776737df6bf58791e8aed08475017cbad66abcd48d573f",
|
||||
"anthropic/KnowledgeQA/claude-opus-5": "bb9cc2a045ce8d4ebd5ce65d61f8abf3f1bb19af817961eaea5faa802e0819e5",
|
||||
"anthropic/KnowledgeQA/claude-opus-5-5": "473f7e4047961c7405171ff7b53355f19604d77e3d376ff6d0cdec7fb3d12a7d",
|
||||
"anthropic/KnowledgeQA/claude-sonnet-4-5": "176ba6989053acf35be0a6acdd421c1c94c20f183358544eb0343c6e74897220",
|
||||
"anthropic/KnowledgeQA/claude-sonnet-4-5-20250929": "6757d77ed1d25cf80d04d2d35217a7f5d94e37f1b7c3545bf1613ac0494ec388",
|
||||
"anthropic/KnowledgeQA/claude-sonnet-4-6": "c00c494964632af431731f6fdf2ba4d697d42b8e58600e8a28e6a880ad6f0cda",
|
||||
"anthropic/KnowledgeQA/claude-sonnet-5": "57112aa6a5905f29ccb0030d75afa92defc8c40fe3c2923b7f6c75e73db1ccf5",
|
||||
"anthropic/KnowledgeQA/claude-sonnet-5-5": "6880da6922858ec485f07de03058393c68082059abd9c7c169adced9b5f386df",
|
||||
"azure_openai/Embedding/text-embedding-3snapshot": "0c2f547ad2206affe719f6f0775ee73574a4dda8a7993a699ee9c4e7d4983cab",
|
||||
"azure_openai/KnowledgeQA/gpt-4.1snapshot": "6b6e303e1e4ed32f972e8224ab090f835e63570543036912809fc6e2551f923c",
|
||||
"azure_openai/KnowledgeQA/gpt-4osnapshot": "69fab35e2db1fab9640c72ab3b0c7acae322a1d0758c61ade28bc39fb9f9f750",
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package providers_test
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
|
|
@ -620,3 +621,70 @@ func TestClaudeNoSamplingRequestBody(t *testing.T) {
|
|||
t.Errorf("anthropic/claude-sonnet-4-6 should still send temperature, got %v", body["temperature"])
|
||||
}
|
||||
}
|
||||
|
||||
// TestClaude55Models pins how the Claude 5.5 entries turn thinking off and
|
||||
// that none of them receives sampling parameters or budget_tokens: Opus 5.5
|
||||
// cannot turn thinking off, Sonnet 5.5 turns up-front thinking off with
|
||||
// "between_tools" (it rejects "disabled"), and Haiku 5.5 accepts "disabled".
|
||||
func TestClaude55Models(t *testing.T) {
|
||||
build := func(t *testing.T, model string, effort api.ReasoningEffort) map[string]any {
|
||||
t.Helper()
|
||||
r := resolve(t, "anthropic", model)
|
||||
c := anthropicmessages.New(anthropicmessages.Config{
|
||||
Endpoint: api.Endpoint{Model: r.RemoteModel},
|
||||
Settings: r.AnthropicMessages,
|
||||
ThinkingLevels: r.ThinkingLevels,
|
||||
Reasoning: r.Spec.Reasoning,
|
||||
})
|
||||
body, err := c.BuildRequestBody(
|
||||
[]api.Message{{Role: "user", Content: "Hi"}},
|
||||
&api.Options{Temperature: 0.3, TopP: 0.9, ReasoningEffort: effort},
|
||||
false,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("build %s: %v", model, err)
|
||||
}
|
||||
return body
|
||||
}
|
||||
|
||||
offBody := map[string]any{
|
||||
"claude-opus-5-5": nil,
|
||||
"claude-sonnet-5-5": map[string]any{"type": "between_tools"},
|
||||
"claude-haiku-5-5": map[string]any{"type": "disabled"},
|
||||
}
|
||||
for model, wantOff := range offBody {
|
||||
r := resolve(t, "anthropic", model)
|
||||
if !r.Cataloged {
|
||||
t.Fatalf("anthropic/%s should be in the catalog", model)
|
||||
}
|
||||
if r.AnthropicMessages.ThinkingMode != api.AnthropicThinkingAdaptive {
|
||||
t.Errorf("anthropic/%s should use adaptive thinking", model)
|
||||
}
|
||||
if got := r.ThinkingLevels.Supports(api.ReasoningOff); got != (wantOff != nil) {
|
||||
t.Errorf("anthropic/%s supports thinking off = %v", model, got)
|
||||
}
|
||||
for _, level := range []api.ReasoningEffort{api.ReasoningXHigh, api.ReasoningMax} {
|
||||
if !r.ThinkingLevels.Supports(level) {
|
||||
t.Errorf("anthropic/%s should support %s effort", model, level)
|
||||
}
|
||||
}
|
||||
|
||||
for _, effort := range []api.ReasoningEffort{"", api.ReasoningOff, api.ReasoningHigh} {
|
||||
body := build(t, model, effort)
|
||||
for _, field := range []string{"temperature", "top_p", "top_k"} {
|
||||
if _, ok := body[field]; ok {
|
||||
t.Errorf("anthropic/%s (reasoning %q) sent %s", model, effort, field)
|
||||
}
|
||||
}
|
||||
if thinking, ok := body["thinking"].(map[string]any); ok && thinking["type"] == "enabled" {
|
||||
t.Errorf("anthropic/%s (reasoning %q) sent budget thinking", model, effort)
|
||||
}
|
||||
}
|
||||
if wantOff != nil {
|
||||
body := build(t, model, api.ReasoningOff)
|
||||
if fmt.Sprint(body["thinking"]) != fmt.Sprint(wantOff) {
|
||||
t.Errorf("anthropic/%s thinking off sent %v, want %v", model, body["thinking"], wantOff)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,6 +150,7 @@
|
|||
| 字段 | 类型 | 协议默认 | 说明 |
|
||||
| --- | --- | --- | --- |
|
||||
| `thinking_mode` | string | `budget` | `budget` 按预算开启思考;`adaptive` 由模型自行决定,强度通过 `output_config.effort` 传递 |
|
||||
| `thinking_off_type` | string | `disabled` | `adaptive` 模式下关闭思考时发送的 `thinking.type`;Claude Sonnet 5.5 不接受 `disabled`,使用 `between_tools` |
|
||||
| `supports_effort` | bool | false | 是否发送思考强度 |
|
||||
| `thinking_budgets` | object | minimal 1024、low 2048、medium 8192、high 16384、xhigh 32768、max 63999 | 各思考强度对应的 `budget_tokens`,键为 `minimal`/`low`/`medium`/`high`/`xhigh`/`max` |
|
||||
| `default_max_tokens` | int | 4096 | 未设置输出上限时使用的 `max_tokens`(该协议必填) |
|
||||
|
|
|
|||
Loading…
Reference in New Issue