SIGN IN SIGN UP

MUL-6141: feat(runtimes): price Qwen/Kimi/Ark models and strip ':' provider prefixes (#6915)

* feat(runtimes): price Qwen/Kimi/Ark models and strip ':' provider prefixes

- Add USD per-MTok pricing: qwen3.6-flash, qwen3.7-plus, qwen3.8-max
  (pay-as-you-go), qwen3.8-max-preview (subscription-only, 0), kimi-k3 /
  kimi/k3, ark-code-latest (Volcengine doubao-seed-evolving, CNY->USD @7.15)
- canonicalCandidates now strips `provider:model` prefixes, not just
  `vendor/model`, so Hermes-style ids (alibaba-coding-plan:qwen3.8-max,
  custom:ark-code-latest, kimi-coding:kimi-k3, opencode-go:*) actually resolve
- Sources: models.dev (alibaba, moonshotai) + Volcengine official price sheet
  (docs.volcengine.com/docs/82379/1099320, 2026-08-12)

* feat(metrics): mirror Qwen/Kimi/Ark pricing in the server registry

- Add alibaba qwen3.6-flash / qwen3.7-plus / qwen3.8-max (pay-as-you-go)
  and qwen3.8-max-preview (subscription-only, 0), moonshotai kimi-k3, and
  volcengine ark-code-latest (CNY->USD at 7.15) to the server pricing
  registry, keeping it in sync with packages/views/runtimes/utils.ts
- Anchor qwen3.8-max and kimi-k3 aliases so preview / variant SKUs never
  borrow the GA tier; kimi-code/k3 resolves via the /k3$ form
- Add Go tests pinning the new rows and the no-false-borrowing rules,
  plus frontend regression tests for `provider:model` prefix stripping

* fix(metrics): correct Qwen international rates, unmap ark-code-latest, anchor aliases

Addresses the multica-eve review blockers on PR #6915:

- Qwen rates now match the official International (<=256K) tier from the
  alibabacloud.com model-pricing sheet and qwencloud.com model pages:
  qwen3.7-plus /bin/bash.40/.60 (cacheRead 0.04 / cacheWrite 0.50) and
  qwen3.6-flash /bin/bash.25/.50 (cacheRead 0.025 / cacheWrite 0.3125).
  qwen3.8-max stays at ///bin/bash.25/.50 with the qwencloud.com page
  cited as the primary source.
- `ark-code-latest` is a console-switchable rolling alias, not a stable
  model identity, so it is no longer mapped on either side (mirrors the
  grok-composer-* convention).
- Backend alias rules are anchored to the explicitly supported forms
  ((^|/|:)...$ / ($|\[) for the [1m] context suffix) so unknown
  suffixed variants like qwen3.7-plus-extra stay unmapped; negative
  tests added on both sides.
- Frontend stripProvider now peels nested routing prefixes iteratively
  so custom:anthropic/claude-opus-4.7 resolves to the Opus tier, with a
  regression test.

Verified: vitest utils.test.ts 88 pass, go test ./internal/metrics/...
pass, git diff --check clean.

* fix(metrics): address #6915 review — qwen3.8-max explicit cache read rate and anchored bracket aliases

- Use the official explicit-cache-read rate ($0.17/M) for qwen3.8-max in
  both the frontend pricing table and the server registry.
- Anchor the backend Qwen alias regexes to require a complete optional
  bracket tag through the end of the string, so malformed/extra-suffix
  forms like qwen3.8-max[, qwen3.8-max[1m]-extra, and
  qwen3.8-max-preview[1m]-extra stay unmapped.
- Update Go and frontend tests to pin the corrected rate and the new
  negative/positive bracket cases.

* fix(metrics): reject empty Qwen bracket tags in backend aliases

The four Qwen alias rules used * inside the optional bracket tag, so
empty tags (qwen3.7-plus[] etc.) resolved and received a price in the
backend while the frontend's \[[^\]]+\]$ stripper leaves them unmapped.
Switch to + to require at least one character and add [] negative cases
to TestPriceForModelAliasNoFalseBorrowing.

Addresses #6915 review (2026-08-25).

---------

Co-authored-by: Frank Li <265762139+frankli9986@users.noreply.github.com>
F
Frank Li committed
174c6525899ab43668ce2ead489d73b581643c74
Parent: baf1bbf
Committed by GitHub <noreply@github.com> on 8/26/2026, 4:47:28 AM