| 1 | package anthropic |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "reasonix/internal/provider" |
| 7 | ) |
| 8 | |
| 9 | func TestSharedWindowOutputBudgetCapability(t *testing.T) { |
| 10 | deepseek := &client{deepseek: true, defaultMaxTokens: 32 * 1024} |
| 11 | if !deepseek.SharesContextWindow() || deepseek.OutputBudget() != 32*1024 { |
| 12 | t.Fatalf("DeepSeek capability = shared:%v budget:%d", deepseek.SharesContextWindow(), deepseek.OutputBudget()) |
| 13 | } |
| 14 | anthropic := &client{defaultMaxTokens: 16 * 1024} |
| 15 | if anthropic.SharesContextWindow() { |
| 16 | t.Fatal("native Anthropic mode must keep its independent output ceiling") |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | func TestOfficialDeepSeekAnthropicPolicyRequires384K(t *testing.T) { |
| 21 | p, err := New(provider.Config{Name: "ds", BaseURL: "https://api.deepseek.com/anthropic", Model: "deepseek-v4-flash"}) |
| 22 | if err != nil { |
| 23 | t.Fatal(err) |
| 24 | } |
| 25 | got := p.(provider.ContextBudgetPolicyProvider).ContextBudgetPolicy() |
| 26 | if got.LimitMode != provider.OutputLimitRequired || got.AutoOutputTokens != provider.DeepSeekMaxOutputTokens { |
| 27 | t.Fatalf("DeepSeek Anthropic policy = %+v", got) |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | func TestOpenCodeGoAnthropicPolicyUsesTable(t *testing.T) { |
| 32 | p, err := New(provider.Config{Name: "og", BaseURL: "https://opencode.ai/zen/go", Model: "qwen3.7-plus"}) |
| 33 | if err != nil { |
| 34 | t.Fatal(err) |
| 35 | } |
| 36 | got := p.(provider.ContextBudgetPolicyProvider).ContextBudgetPolicy() |
| 37 | if got.WindowMode != provider.ContextWindowShared || got.MaxOutputTokens != 65_536 || got.LimitMode != provider.OutputLimitRequired { |
| 38 | t.Fatalf("OpenCode Go Anthropic policy = %+v", got) |
| 39 | } |
| 40 | } |
| 41 |