Skip to content

Strip the [1m] context-window suffix before routing (companion to #8)#10

Merged
OnlyTerp merged 1 commit into
OnlyTerp:mainfrom
payne0420:fix/proxy-1m-suffix
Jun 3, 2026
Merged

Strip the [1m] context-window suffix before routing (companion to #8)#10
OnlyTerp merged 1 commit into
OnlyTerp:mainfrom
payne0420:fix/proxy-1m-suffix

Conversation

@payne0420
Copy link
Copy Markdown
Contributor

Depends on #8

This is a companion to #8 and only earns its keep once that lands. Please review/merge #8 first — with #8 not merged, nothing emits the [1m] suffix, so this change is a harmless no-op on its own.

Why

#8 makes the launchers append a [1m] suffix to 1M-capable Claude model ids so Claude Code sizes its /context meter and auto-compaction to the 1M window. The suffix is a client-side convention — the 1M window itself is carried by the context-1m beta header — it is not an Anthropic model id.

The proxy resolves routes (and orchestrator/worker picks) by exact id match. So once a pick carries [1m], a configured route like claude-opus no longer matches the incoming claude-opus[1m], and the request falls through / misroutes. This matters for any Anthropic-passthrough route to a 1M-capable Claude model (the recommended pattern when you want real Opus as a distinct orchestrator/worker pick under a non-claude-opus-4-8 id).

What

Strip a trailing [1m] from the request model id at the very top of transform_messages_body, so <id>[1m] behaves exactly like <id> everywhere downstream (tier classification, orchestrator/worker selection, route lookup, upstream forwarding).

  • The 1M window is unaffected — it rides the context-1m beta header, which is left untouched.
  • The strip is universal (<id>[1m]<id>), so stock-traffic remap and the Auto Router stay consistent too.
  • ~4 lines, plus a unit test. Full suite + scripts/doctor.py pass.

🤖 Generated with Claude Code

Companion to OnlyTerp#8. That PR makes the launchers append a "[1m]" suffix to 1M-capable
Claude model ids so Claude Code sizes its context meter (and auto-compaction) to
the 1M window. The suffix is a client-side convention -- the 1M window itself is
carried by the context-1m beta header -- not an Anthropic model id.

The proxy looks up routes (and orchestrator/worker picks) by exact id, so once a
pick carries "[1m]" a configured route like "claude-opus" no longer matches
"claude-opus[1m]" and routing falls through / breaks. This strips a trailing
"[1m]" from the request model id up front, so "<id>[1m]" behaves exactly like
"<id>" everywhere downstream. The 1M window is unaffected (the beta header is left
untouched), and the strip is universal so stock-traffic remap and the Auto Router
stay consistent too.

Depends on OnlyTerp#8: with OnlyTerp#8 not merged nothing emits the suffix, so this is a no-op on
its own and only earns its keep once OnlyTerp#8 lands.

Includes a unit test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@OnlyTerp OnlyTerp merged commit 2d43ddb into OnlyTerp:main Jun 3, 2026
4 checks passed
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.

2 participants