Skip to content

feat: 默认 Opus 模型从 4.8 升级到 Opus 5 - #275

Open
lishuceo wants to merge 1 commit into
mainfrom
feat/upgrade-opus-5
Open

feat: 默认 Opus 模型从 4.8 升级到 Opus 5#275
lishuceo wants to merge 1 commit into
mainfrom
feat/upgrade-opus-5

Conversation

@lishuceo

Copy link
Copy Markdown
Owner

背景

将 anycode 的默认 Opus 模型从 claude-opus-4-8 升级到 claude-opus-5(2026-05 GA,$5/$25 per MTok,1M 上下文,同价位替换)。

改动

  • src/config.tsCLAUDE_MODEL 默认值 claude-opus-4-8claude-opus-5(仅在 agent 未显式指定模型时作为兜底)
  • src/claude/executor.tsMODEL_PRICING 新增 claude-opus-5 定价条目(input 5 / output 25 / cacheWrite 6.25 / cacheRead 0.50,与 Opus 4.8 一致);保留 claude-opus-4-8 条目,确保 resume 历史会话的成本计算仍准确

注:运行中 bot 的实际模型由部署侧 config/agents.json(未纳入 git、按部署隔离)控制,已在部署环境同步改为 Opus 5 并热重载生效。本 PR 只固化仓库内的默认值与定价表。

测试

  • npm run typecheck
  • npx vitest run:1776 passed,唯一失败项 memory/quality.test.ts > 当前工作重点 为向量检索质量的既有 flaky 项(已验证在未含本改动的干净基线上同样失败),与本次改动无关
  • 纯配置值与定价常量变更,无新增逻辑分支,未新增单测

🤖 Generated with Claude Code

- config.ts: CLAUDE_MODEL 默认值 claude-opus-4-8 → claude-opus-5
- executor.ts: MODEL_PRICING 新增 claude-opus-5 条目($5/$25 per MTok,
  与 Opus 4.8 同价),保留 4.8 条目以兼容 resume 的历史会话成本计算

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Claude finished @lishuceo's task in 2m 36s —— View job


Code Review — feat: 默认 Opus 模型从 4.8 升级到 Opus 5

  • Check for previous Claude inline comments on this PR (none found)
  • Read PR intent + diff (git diff origin/main...HEAD)
  • Review src/config.ts (default model change)
  • Review src/claude/executor.ts (pricing table entry + lookup path)
  • Sweep repo for other hardcoded model references / model-name-based branching
  • Check existing tests for assertions on the old default
  • Run npm run typecheck / npx vitest run — blocked, see note below

✅ Approved

No blocking issues. 3-line constant change, correct in both files, and I couldn't find anything it breaks.

What I verified:

  1. No test breakage from the default change. No test asserts 'claude-opus-4-8'; the test fixtures all pin claude-opus-4-6 explicitly in their own config objects (src/claude/__tests__/executor.test.ts:15, src/__tests__/config-loader.test.ts, etc.), so they're unaffected by the config.claude.model fallback.

  2. No model-name-based feature gating anywhere. Grepped for model.startsWith(...) / model.includes(...) / regexes over claude-opus-* across src/ — zero hits. So claude-opus-5 won't fall on the wrong side of any version check. src/session/model-override.ts only handles the claude-fable-5 / [1m] path and is orthogonal.

  3. Pricing lookup is safe even on a key miss. MODEL_PRICING[model] (src/claude/executor.ts:77) is an exact-match lookup against SDK modelUsage keys. If the SDK ever reports a dated ID (e.g. claude-opus-5-20260501) rather than the alias, the entry misses and falls through to DEFAULT_PRICING — which is claude-opus-4-6 at the same 5 / 25 / 6.25 / 0.50, so the computed cost is still correct. Keeping the claude-opus-4-8 row for resumed sessions is the right call.

Optional (non-blocking) follow-ups:

  • 🟡 src/claude/executor.ts:41DEFAULT_PRICING = MODEL_PRICING['claude-opus-4-6']! now anchors the fallback to a legacy alias while the default model is Opus 5. Numerically identical today, so no behavior change, but repointing it to 'claude-opus-5' keeps the fallback tracking the actual default and avoids a silent drift if Opus-tier pricing ever diverges. Fix this →
  • Docs/examples still advertise claude-opus-4-6: README.md:142, config/agents.example.json:22 and :41. Pre-existing staleness (not introduced here), but since deployment config/agents.json is now on Opus 5, refreshing the tracked example would keep first-time setup aligned.
  • CLAUDE.md's testing policy asks each feat commit to carry a test. A one-line assertion that MODEL_PRICING['claude-opus-5'] exists with input 5 / output 25 would satisfy it cheaply — though I agree a pure constant change is a reasonable exception, and the PR body states this explicitly.

Verification I could not run: npx tsc --noEmit and npx vitest run both require approval in this sandbox, so I'm relying on the PR body's reported results (typecheck ✅, 1776 passed, one pre-existing flaky memory/quality.test.ts case verified against a clean baseline). Static risk here is nil — one added Record entry plus a changed string literal.

One thing worth confirming outside my reach: I have no network access in this run, so I could not check claude-opus-5's published rates against docs.anthropic.com. The 5 / 25 / 6.25 / 0.50 row is internally consistent (cacheWrite = 1.25× input, cacheRead = 0.1× input, matching every other Opus row), so if the $5/$25 base is right the derived values are right too.

--- • Branch: feat/upgrade-opus-5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant