fix(snapcompact): extended high-res frame tier to opus 5+

MODEL_VARIANTS gated the 1932px frame tier on /claude-?opus-?4[.-][7-9]/i,
so claude-opus-5 fell through to the generic /claude/i entry and rendered at
the 1568px default reserved for older lines that downscale. The 1932px tier
tracks the Anthropic 4,784 visual-token cap — a family-wide billing property
opus-5 shares with opus-4-8 — so the version bound was stale rather than a
per-version eval gap.

Widened the pattern to cover Opus 5 and later; 4.0-4.6 still keep the safe
1568px default. Documented why 1932 specifically (largest square not
downscaled under the 4,784-patch cap, kept below the 2000px per-image limit).
Added regression assertions for opus-5/opus-6 (high-res) and opus-4-6
(default).

Fixes #8256
This commit is contained in:
roboomp
2026-08-11 15:08:09 +00:00
parent d3b22a0db6
commit 913fee1d39
3 changed files with 20 additions and 4 deletions
+4
View File
@@ -2,6 +2,10 @@
## [Unreleased]
### Fixed
- Fixed `claude-opus-5` (and later Opus lines) falling back to the 1568px frame instead of the 1932px high-res tier, so snapcompact archives for the current flagship Opus now retain ~33% more history at the same per-frame bill ([#8256](https://github.com/can1357/oh-my-pi/issues/8256)).
## [17.1.5] - 2026-07-27
### Fixed
+8 -4
View File
@@ -342,11 +342,15 @@ export interface IdealShape {
* lines the mono evals measured; everything else falls back to the API
* family's winner at the standard 1568px frame. First match wins. */
const MODEL_VARIANTS: readonly (readonly [RegExp, IdealShape])[] = [
// Opus 4.7+ and Fable/Mythos read high-res natively (2576px edge under a
// 4,784 visual-token cap → 1932px square sweet spot): same recall and
// cost as 1568, a third fewer frames.
// Opus 4.7+ and Fable/Mythos read high-res natively: same recall and cost as
// 1568, a third fewer frames. 1932 is the largest *square* not downscaled
// under Anthropic's 4,784 visual-token cap ((1932/28)² = 69² = 4,761 ≤ 4,784
// 28px patches), and staying below 2000px keeps frames clear of the stricter
// ≤2000px per-image dimension limit that applies once a request carries more
// than 20 image blocks. The cap is a family-wide Anthropic billing property,
// so every Opus line from 4.7 up (5.x and later included) belongs on this tier.
[/claude.*(fable|mythos)/i, { variant: "11on16-bw", frameSize: 1932 }],
[/claude-?opus-?4[.-][7-9]/i, { variant: "11on16-bw", frameSize: 1932 }],
[/claude-?opus-?(4[.-][7-9]|[5-9])/i, { variant: "11on16-bw", frameSize: 1932 }],
// Older Claude lines downscale past 1568px — keep the safe size.
[/claude/i, { variant: "11on16-bw" }],
// Gemini 3.x bills a fixed 1,120-token budget per image regardless of
@@ -299,6 +299,14 @@ describe("shape resolution", () => {
// High-res frames are reserved for the lines that read them natively;
// older Claude lines keep the safe 1568px family default.
expect(snapcompact.resolveShape({ api: "anthropic-messages", id: "claude-opus-4-8" }).frameSize).toBe(1932);
// Opus 5+ shares the Anthropic visual-token cap, so it stays on the
// high-res tier rather than falling back to the 1568px default (#8256).
expect(snapcompact.resolveShape({ api: "anthropic-messages", id: "claude-opus-5" }).frameSize).toBe(1932);
expect(snapcompact.resolveShape({ api: "anthropic-messages", id: "claude-opus-6" }).frameSize).toBe(1932);
// Opus lines below 4.7 downscale, so they keep the safe family default.
expect(snapcompact.resolveShape({ api: "anthropic-messages", id: "claude-opus-4-6" })).toBe(
snapcompact.SHAPES.anthropic,
);
expect(snapcompact.resolveShape({ api: "anthropic-messages", id: "claude-3-5-sonnet" })).toBe(
snapcompact.SHAPES.anthropic,
);