fix(cliproxy): use adaptive thinking for Claude Opus 4.7

Per Anthropic docs, Claude Opus 4.7 only supports adaptive thinking;
manual `thinking.type: "enabled"` with `budget_tokens` is rejected
with HTTP 400.

Switch the claude provider's `claude-opus-4-7` entry from
`type: 'budget'` to `type: 'levels'` with the effort tiers exposed
by the API: `low | medium | high | xhigh`. The proxy is expected to
translate these into `thinking.type: "adaptive"` with the effort
parameter.

Opus 4.6 and Sonnet 4.6 keep `type: 'budget'` for now since the
deprecated mode is still functional on those models.

Built [OnSteroids](https://onsteroids.ai)

Co-Authored-By: OnSteroids <built@onsteroids.ai>
This commit is contained in:
Sergey Galuza
2026-04-22 21:09:21 +02:00
co-authored by OnSteroids
parent c03f2ea791
commit 46920dbc08
2 changed files with 11 additions and 7 deletions
+6 -4
View File
@@ -295,11 +295,13 @@ export const MODEL_CATALOG: Partial<Record<CLIProxyProvider, ProviderCatalog>> =
name: 'Claude Opus 4.7',
description: 'Latest flagship model',
nativeImageInput: true,
// Opus 4.7 only supports adaptive thinking on the Anthropic API; manual
// thinking.type: "enabled" with budget_tokens is rejected with 400.
// Expose effort levels; the proxy translates these into adaptive effort.
thinking: {
type: 'budget',
min: 1024,
max: 128000,
zeroAllowed: false,
type: 'levels',
levels: ['low', 'medium', 'high', 'xhigh'],
maxLevel: 'xhigh',
dynamicAllowed: true,
},
extendedContext: true,
+5 -3
View File
@@ -147,9 +147,11 @@ describe('Model Catalog', () => {
const opus47 = MODEL_CATALOG.claude.models.find((m) => m.id === 'claude-opus-4-7');
assert(opus47, 'Should include Claude Opus 4.7');
assert.strictEqual(opus47.name, 'Claude Opus 4.7');
// Claude provider differs from AGY: zero thinking budget is disallowed,
// and extended (1M) context is available on the Anthropic API.
assert.strictEqual(opus47.thinking.zeroAllowed, false);
// Opus 4.7 requires adaptive thinking (type: 'levels'); manual budget_tokens
// is rejected by the Anthropic API with 400. Extended (1M) context is available.
assert.strictEqual(opus47.thinking.type, 'levels');
assert.deepStrictEqual(opus47.thinking.levels, ['low', 'medium', 'high', 'xhigh']);
assert.strictEqual(opus47.thinking.maxLevel, 'xhigh');
assert.strictEqual(opus47.extendedContext, true);
});