Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(models): add Claude Opus 5.5 to the recipes and price table (#5359, #5494)
garrytana6edf1288512
diff --git a/src/core/ai/recipes/anthropic.ts b/src/core/ai/recipes/anthropic.tsindex 44c8af3cd8..a812b56aa2 100644--- a/src/core/ai/recipes/anthropic.ts+++ b/src/core/ai/recipes/anthropic.ts@@ -25,6 +25,7 @@ export const anthropic: Recipe = {models: ['claude-fable-5','claude-fable-5-1',+ 'claude-opus-5-5','claude-opus-5','claude-opus-4-8','claude-opus-4-7',@@ -38,6 +39,7 @@ export const anthropic: Recipe = {model_context_tokens: {'claude-fable-5': 1_000_000,'claude-fable-5-1': 1_000_000,+ 'claude-opus-5-5': 1_000_000,'claude-opus-5': 1_000_000,'claude-sonnet-5': 1_000_000,'claude-opus-4-8': 1_000_000,diff --git a/src/core/ai/recipes/claude-cli.ts b/src/core/ai/recipes/claude-cli.tsindex 68bfbdcb1d..4526aa8850 100644--- a/src/core/ai/recipes/claude-cli.ts+++ b/src/core/ai/recipes/claude-cli.ts@@ -55,6 +55,7 @@ export const claudeCli: Recipe = {'claude-haiku-4-5-20251001','claude-fable-5','claude-fable-5-1',+ 'claude-opus-5-5','claude-opus-5','claude-opus-4-8','claude-opus-4-7',@@ -74,6 +75,7 @@ export const claudeCli: Recipe = {models: ['claude-fable-5','claude-fable-5-1',+ 'claude-opus-5-5','claude-opus-5','claude-opus-4-8','claude-opus-4-7',diff --git a/src/core/brainstorm/judges.ts b/src/core/brainstorm/judges.tsindex 3c50c99d42..37dafb4d8d 100644--- a/src/core/brainstorm/judges.ts+++ b/src/core/brainstorm/judges.ts@@ -63,6 +63,7 @@ export const MAX_OUTPUT_TOKENS_CEIL = 32_000;export const ANTHROPIC_OUTPUT_CAPS: Record<string, number> = {'claude-fable-5': 64_000,'claude-fable-5-1': 64_000,+ 'claude-opus-5-5': 32_000,'claude-opus-5': 32_000,'claude-sonnet-5': 64_000,'claude-opus-4-8': 32_000,diff --git a/src/core/model-pricing.ts b/src/core/model-pricing.tsindex 23a4648058..8c53e7e18e 100644--- a/src/core/model-pricing.ts+++ b/src/core/model-pricing.ts@@ -80,6 +80,9 @@ function anthro(input: number, output: number, cacheReadMult = ANTHROPIC_CACHE_Rexport const ANTHROPIC_CACHE_READ_MULT_OVERRIDES: Record<string, number> = {// Fable 5.1 bills cache hits at 0.025x base input ($0.25/MTok on $10).'anthropic:claude-fable-5-1': 0.025,+ // Opus 5.5 bills cache hits at 0.05x base input ($0.20/MTok on $4),+ // verified 2026-10-01 against the published Opus 5.5 price list.+ 'anthropic:claude-opus-5-5': 0.05,};/**@@ -100,6 +103,9 @@ export const CANONICAL_PRICING: Record<string, ModelPricing> = {'anthropic:claude-fable-5-1': anthro(10.00, 50.00, ANTHROPIC_CACHE_READ_MULT_OVERRIDES['anthropic:claude-fable-5-1']),// Opus 4.x/5: $5 in / $25 out. Opus 5 (new generation) shares the same// per-token rate as 4.8 (released 2026-05-28) — closes gbrain#1819.+ // Opus 5.5 (released 2026-09-22): $4 in / $20 out, cache writes 1.25x+ // ($5). Fast mode ($8/$40) is not modeled. Closes gbrain#5359.+ 'anthropic:claude-opus-5-5': anthro( 4.00, 20.00, ANTHROPIC_CACHE_READ_MULT_OVERRIDES['anthropic:claude-opus-5-5']),'anthropic:claude-opus-5': anthro( 5.00, 25.00),'anthropic:claude-opus-4-8': anthro( 5.00, 25.00),'anthropic:claude-opus-4-7': anthro( 5.00, 25.00),diff --git a/src/core/takes-quality-eval/pricing.ts b/src/core/takes-quality-eval/pricing.tsindex 956e6ba40a..8c29b40d4c 100644--- a/src/core/takes-quality-eval/pricing.ts+++ b/src/core/takes-quality-eval/pricing.ts@@ -36,6 +36,7 @@ const SUPPORTED_MODELS = ['openai:gpt-5','openai:gpt-5.2','openai:gpt-5.5',+ 'anthropic:claude-opus-5-5','anthropic:claude-opus-5','anthropic:claude-opus-4-8','anthropic:claude-opus-4-7',diff --git a/test/ai/anthropic-model-ids.test.ts b/test/ai/anthropic-model-ids.test.tsindex d3c00f139e..426f785a4d 100644--- a/test/ai/anthropic-model-ids.test.ts+++ b/test/ai/anthropic-model-ids.test.ts@@ -47,7 +47,7 @@ describe('compareAnthropicVersions', () => {describe('newerAnthropicModel', () => {test('returns the newest priced same-family recipe id when the model is older', () => {expect(newerAnthropicModel('anthropic:claude-sonnet-4-6')?.id).toBe('claude-sonnet-5');- expect(newerAnthropicModel('anthropic:claude-opus-4-7')?.id).toBe('claude-opus-5');+ expect(newerAnthropicModel('anthropic:claude-opus-4-7')?.id).toBe('claude-opus-5-5');});test('dated and undated forms of the current version get no hint', () => {@@ -59,7 +59,8 @@ describe('newerAnthropicModel', () => {for (const id of ['anthropic:claude-sonnet-5','anthropic:claude-sonnet-6',- 'anthropic:claude-opus-5-2',+ 'anthropic:claude-opus-5-5',+ 'anthropic:claude-opus-5-6','anthropic:claude-fable-5','openai:gpt-5.6','not-a-model',diff --git a/test/models-newer-hint.serial.test.ts b/test/models-newer-hint.serial.test.tsindex 1b18f97645..07d0387fb2 100644--- a/test/models-newer-hint.serial.test.ts+++ b/test/models-newer-hint.serial.test.ts@@ -98,7 +98,7 @@ describe('gbrain models — newer-available hint', () => {const think = report.per_task.find((r) => r.key === 'models.think')!;expect(think.resolved).toBe('anthropic:claude-opus-4-7');expect(think.newer_available).toBeUndefined();- expect(report.tiers.deep.newer_available?.model).toBe('claude-opus-5');+ expect(report.tiers.deep.newer_available?.model).toBe('claude-opus-5-5');});});diff --git a/test/opus-5-5-pricing.test.ts b/test/opus-5-5-pricing.test.tsnew file mode 100644index 0000000000..8a2c890150--- /dev/null+++ b/test/opus-5-5-pricing.test.ts@@ -0,0 +1,48 @@+/**+ * #5359 / #5494: Claude Opus 5.5 (`claude-opus-5-5`) was missing from the+ * recipes and the price table, so `--max-cost` runs on it hard-failed with+ * no_pricing before the first call. Rates are Anthropic's published Opus 5.5+ * list: $4 in / $20 out, cache reads 0.05x ($0.20), 5-minute writes 1.25x.+ */++import { describe, test, expect } from 'bun:test';+import { mkdtempSync, rmSync } from 'fs';+import { join } from 'path';+import { tmpdir } from 'os';++import { BudgetTracker } from '../src/core/budget/budget-tracker.ts';+import { CANONICAL_PRICING } from '../src/core/model-pricing.ts';+import { anthropic } from '../src/core/ai/recipes/anthropic.ts';+import { claudeCli } from '../src/core/ai/recipes/claude-cli.ts';++describe('#5359 / #5494 Claude Opus 5.5', () => {+ test('priced at the published rates, with the 0.05x cache-read rate', () => {+ expect(CANONICAL_PRICING['anthropic:claude-opus-5-5']).toEqual({ input: 4, output: 20, cache_read: 0.2, cache_write: 5 });+ });++ test('listed by the anthropic and claude-cli recipes', () => {+ expect(anthropic.touchpoints.chat?.models).toContain('claude-opus-5-5');+ expect(anthropic.touchpoints.chat?.model_context_tokens?.['claude-opus-5-5']).toBe(1_000_000);+ expect(claudeCli.touchpoints.chat?.models).toContain('claude-opus-5-5');+ expect(claudeCli.touchpoints.expansion?.models).toContain('claude-opus-5-5');+ });++ test('a --max-cost reservation is estimated instead of refused with no_pricing', () => {+ const dir = mkdtempSync(join(tmpdir(), 'gbrain-opus55-'));+ try {+ const tracker = new BudgetTracker({ label: 'opus55-test', maxCostUsd: 1, auditPath: join(dir, 'audit.jsonl') });+ // 100k in + 10k out = $0.40 + $0.20 = $0.60, inside the $1 cap.+ expect(() => tracker.reserve({ modelId: 'anthropic:claude-opus-5-5', kind: 'chat', estimatedInputTokens: 100_000, maxOutputTokens: 10_000, label: 'x' })).not.toThrow();+ // A second identical reservation would reach $1.20 and is refused on cost.+ let reason: string | undefined;+ try {+ tracker.reserve({ modelId: 'anthropic:claude-opus-5-5', kind: 'chat', estimatedInputTokens: 100_000, maxOutputTokens: 10_000, label: 'y' });+ } catch (e) {+ reason = (e as { reason?: string }).reason;+ }+ expect(reason).toBe('cost');+ } finally {+ rmSync(dir, { recursive: true, force: true });+ }+ });+});