Skip to content

feat(ai): Claude Opus 5 on OpenRouter (BYOK) + correct the Opus 1M context windows#42

Merged
ndemianc merged 2 commits into
developfrom
feat/opus-5-openrouter
Jul 25, 2026
Merged

feat(ai): Claude Opus 5 on OpenRouter (BYOK) + correct the Opus 1M context windows#42
ndemianc merged 2 commits into
developfrom
feat/opus-5-openrouter

Conversation

@ndemianc

@ndemianc ndemianc commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Companion to thin.ly #390 (Opus 5 on the Pro gateway roster). Gateway users get it from the server with no editor release — this is the BYOK half, plus a context-meter correction that affects gateway users too.

Confirmed against the OpenRouter models API (2026-07-24): anthropic/claude-opus-5$5/M in · $25/M out · $0.50/M cached · 1M context (fast variant $10/$50).

Changes

file why
providers/index.js Picker row for anthropic/claude-opus-5.
providers/catalog.js CAPS rows for Opus 5 and Opus 4.8 at 1M — the claude- heuristic returns 200K, so the in-run meter warned "full" at a fifth of the real budget.
sketch/pricing.js Opus 5 ties 4.8's $5/$25 (fallback already right) — but the fast variant is $10/$50 and the fallback priced it at half. Both pinned.
sketch.js MODEL_TIERS.openrouter.powerful 4.8 → 5.

The Opus 4.8 caps row is split by route, on purpose

'claude-opus-4-8'           → 200000    direct Anthropic provider
'anthropic/claude-opus-4-8' → 1000000   OpenRouter / gateway

Two routes share one key today and I can only vouch for one. Every OpenRouter endpoint advertises 1M, but this extension sends no anthropic-beta header on the native path, so I have not confirmed the long window is reachable there — and overstating it is the worse failure, since it tells the user they have room the API will refuse. Exact-id lookup beats basename, so both coexist. If the native path does support 1M unheadered, the bare row is a one-line follow-up.

The one judgement call

Repointing the sketch powerful tier is the only behavior change beyond adding the model. Identical price, newer model — and it fixes a latent wart, since anthropic/claude-opus-4-8 was never in the OpenRouter registry, so a per-node override naming it failed validation and silently fell back. Revert that one line to pin the tier to 4.8.

Verification

Runtime, not just tests:

picker         → anthropic/claude-opus-5   Claude Opus 5
caps            {"context":1000000,"tools":true,"vision":true,"caching":true}
describeModel   1000k ctx · tools · vision
prompt caching  true   (isAnthropicFamily → cache_control breakpoints sent)

openrouter  anthropic/claude-opus-4-8   1,000,000     ← route split holds
claude      claude-opus-4-8               200,000

Full gate green — 24 suites.

Not changed

The gateway default stays Kimi K2.7 Code. Opus 5 is 6.67× per turn — opt-in pick, same call as the K3 rollout.

Gateway (LevelCode Cloud) users get Opus 5 from the server roster with no editor
release — that side is thin.ly. This is the BYOK half: the OpenRouter picker, the
local caps table, and the sketch cost meter.

- providers/index.js — a picker row for `anthropic/claude-opus-5`. Placed second,
  under the flagship, since it is the frontier pick most people reach for.

- providers/catalog.js — an explicit CAPS row, for the same reason Kimi K3 has one:
  the `claude-` heuristic reports 200K, so a 1M window would drive the in-run
  context meter to cry "full" at a fifth of the real budget.

- sketch/pricing.js — Opus 5 ties Opus 4.8's $5/$25, which the `claude-opus` family
  fallback already produced. The FAST variant does NOT: it is $10/$50, and the
  fallback was quietly pricing it at half. Both are pinned now, so the meter is
  honest whichever slug a BYOK user types.

- sketch.js — MODEL_TIERS openrouter.powerful moves 4.8 → 5. Same price, newer
  model. It also fixes a latent wart: the old id was never in the OpenRouter
  registry, so a per-node model override naming it failed validation and silently
  fell back. Revert this one line if you'd rather pin the tier to 4.8.

Prices/context confirmed against the OpenRouter models API (2026-07-24):
$5/M in · $25/M out · $0.50/M cached · 1M ctx (fast variant: $10/$50).

Verified at runtime, not just in tests: the row renders in the picker, caps
resolve to 1,000,000, tools/vision on, and isAnthropicFamily matches so explicit
prompt-cache breakpoints are sent. Full gate green (24 suites).
Copilot AI review requested due to automatic review settings July 25, 2026 14:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds OpenRouter BYOK support for Claude Opus 5 and corrects local capability/pricing metadata so LevelCode’s model picker and in-run meters (context + cost + caching gating) stay accurate when users select it.

Changes:

  • Add anthropic/claude-opus-5 to the OpenRouter picker defaults.
  • Pin Opus 5 1M context in the local caps table to avoid heuristic under-reporting in the context meter.
  • Pin Opus 5 + Opus 5 Fast pricing rows and update the Sketch “powerful” tier to Opus 5.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
extensions/levelcode-ai/providers/index.js Adds anthropic/claude-opus-5 to OpenRouter built-in picker models.
extensions/levelcode-ai/providers/catalog.js Pins Opus 5 caps (1M context + tools/vision/caching) to keep context metering correct.
extensions/levelcode-ai/sketch/pricing.js Adds explicit pricing rows for Opus 5 and Opus 5 Fast to avoid incorrect family-fallback pricing.
extensions/levelcode-ai/sketch.js Updates OpenRouter “powerful” tier default model to anthropic/claude-opus-5.
extensions/levelcode-ai/test/catalog.test.js Extends caps tests to assert Opus 5’s 1M context pin + heuristic behavior for unlisted Claude ids.
extensions/levelcode-ai/test/promptCaching.test.js Extends Anthropic-family gating test to include Opus 5 OpenRouter id.
extensions/levelcode-ai/test/sketch.test.js Adds pricing assertions for Opus 5 and Opus 5 Fast ids via OpenRouter prefix handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The CAPS row for Opus 4.8 said 200K, so the in-run context meter warned "full"
at a fifth of the real budget for anyone on the OpenRouter/gateway route. Every
OpenRouter endpoint for that model (Anthropic first-party, Bedrock, Azure,
Google) advertises 1M/128K.

Fixed under the OpenRouter slug ONLY, and deliberately not under the bare id:

  'claude-opus-4-8'           → 200000   direct Anthropic provider
  'anthropic/claude-opus-4-8' → 1000000  OpenRouter / gateway

Those are two different routes sharing one key today, and I can only vouch for
one of them. This extension sends no `anthropic-beta` header on the native path,
so I have not confirmed the long window is reachable there — and overstating it
would be the worse failure, telling the user they have room the API will refuse.
Exact-id lookup beats basename, so the rows coexist and each route reports its
own truth. If the native path does support 1M unheadered, the bare row is a
one-line follow-up.

Tests pin both sides of the split plus the unlisted-Claude heuristic default.
Full gate green (24 suites).
Copilot AI review requested due to automatic review settings July 25, 2026 14:49
@ndemianc ndemianc changed the title feat(ai): offer Claude Opus 5 on OpenRouter (BYOK) + 1M-context caps feat(ai): Claude Opus 5 on OpenRouter (BYOK) + correct the Opus 1M context windows Jul 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@ndemianc
ndemianc merged commit 8ac0aef into develop Jul 25, 2026
2 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