Skip to content

chore(alibaba): update Qwen model pricing per Alibaba Cloud - #3583

Closed
vicovaro wants to merge 1 commit into
theopenco:mainfrom
vicovaro:chore/alibaba-qwen-pricing
Closed

vicovaro wants to merge 1 commit into
theopenco:mainfrom
vicovaro:chore/alibaba-qwen-pricing

Conversation

@vicovaro

Copy link
Copy Markdown
Contributor

Summary

Sync Qwen model pricing with Alibaba Cloud Model Studio official list prices
(source: https://www.alibabacloud.com/help/en/model-studio/model-pricing —
"Model inference pricing", page updated 2026-08-12 03:12 UTC; region values
verified per-tab on the same page). Only permanent, lower changes applied.

Rule applied: repo price > official list price, and the change is
permanent (no "Limited-time X% off" promo). ✅ = change applied.
❌ = deliberately NOT changed (promo trap / already lower / deactivated / not in catalog).

✅ Changes applied

qwen3-max — flat top-tier → official base + tiers

Input $/1M Output $/1M
Before (repo) 3.00 15.00 ❌ stale flat
After (repo) 1.20 6.00 ✅
Tiers added 2.40 / 12.00 (32-128K), 3.00 / 15.00 (128-256K) ✅
Source Alibaba list price, qwen3-max row (≤32K tier), page 2026-08-12 ✅

qwen3-coder-plus — flat top-tier → official base + tiers

Input $/1M Output $/1M
Before (repo) 6.00 60.00 ❌ charged top tier for every request
After (repo) 1.00 5.00 ✅
Tiers added 1.80 / 9.00 (32-128K), 3.00 / 15.00 (128-256K), 6.00 / 60.00 (256K-1M) ✅
Source Alibaba list price, qwen3-coder-plus row (≤32K tier), page 2026-08-12 ✅

qwen3.7-flash — add non-SG regional overrides

Region Before $/1M (in/out) After $/1M (in/out)
Singapore 0.030 / 0.130 0.030 / 0.130 (unchanged) ✅ already correct
EU-Frankfurt 0.030 / 0.130 0.028 / 0.110 ✅
US-Virginia 0.030 / 0.130 0.028 / 0.110 ✅
CN-Beijing 0.030 / 0.130 0.028 / 0.110 ✅
Tiers (non-SG) — 0.083/0.330 (32-256K), 0.165/0.660 (256K-1M) ✅
Source Alibaba region tabs: Frankfurt/US/Beijing rows, qwen3.7-flash (Global id), page 2026-08-12 ✅

qwen3.7-plus — add missing us-virginia + cn-beijing overrides

Region Before $/1M (in/out) After $/1M (in/out)
Singapore 0.40 / 1.60 0.40 / 1.60 (unchanged) ✅ already correct
EU-Frankfurt 0.276 / 1.101 0.276 / 1.101 (unchanged) ✅ already correct
US-Virginia 0.40 / 1.60 0.276 / 1.101 ✅
CN-Beijing 0.40 / 1.60 0.276 / 1.101 ✅
Tier >256K (non-SG) — 0.826 / 3.301 ✅
Source Alibaba region tabs: US/Beijing rows, qwen3.7-plus (Global id), page 2026-08-12 ✅

qwen3.6-plus — add missing us-virginia + cn-beijing overrides

Region Before $/1M (in/out) After $/1M (in/out)
Singapore 0.50 / 3.00 0.50 / 3.00 (unchanged) ✅ already correct
EU-Frankfurt 0.276 / 1.651 0.276 / 1.651 (unchanged) ✅ already correct
US-Virginia 0.50 / 3.00 0.276 / 1.651 ✅
CN-Beijing 0.50 / 3.00 0.276 / 1.651 ✅
Tier >256K (non-SG) — 1.101 / 6.602 ✅
Source Alibaba region tabs: US/Beijing rows, qwen3.6-plus (Global id), page 2026-08-12 ✅

qwen3.6-flash — add missing eu-frankfurt override

Region Before $/1M (in/out) After $/1M (in/out)
Singapore 0.25 / 1.50 0.25 / 1.50 (unchanged) ✅ already correct
EU-Frankfurt 0.25 / 1.50 0.165 / 0.99 ✅
US-Virginia 0.165 / 0.99 0.165 / 0.99 (unchanged) ✅ already correct
CN-Beijing 0.165 / 0.99 0.165 / 0.99 (unchanged) ✅ already correct
Tier >256K (eu-frankfurt) — 0.66 / 3.961 ✅
Source Alibaba region tab: Frankfurt row, qwen3.6-flash (Global id), page 2026-08-12 ✅

All overrides carry cache prices at the repo's existing 20%/10%/125%
(cachedInput/cacheRead/cacheWrite) pattern.

❌ Not changed (deliberate)

  • qwen3.7-max / qwen3.7-plus (Singapore) — Alibaba shows "Limited-time 50%/20% off"
    promos; the gateway already carries the permanent list price. Promo prices
    intentionally NOT applied. ❌
  • qwen3.6-35b-a3b — repo $0.248/$1.485 is already BELOW official $0.375/$2.25;
    lower-only rule → no raise. ❌
  • Deactivated entries (qwen3-next-80b-a3b-, qwen3-vl-235b-a22b-, qwen-vl-plus)
    — deactivatedAt in the past, zero billing impact. ❌
  • qwen3.7-plus-us / qwen3.6-flash-us — US-pinned SKUs are separate model ids
    (still $0.40 / $0.25 in US) NOT used by the gateway; do not confuse with the
    Global ids this PR fixes. ❌
  • qwen3.5-plus — non-SG drops exist ($0.115/$0.688) but the model is not in
    the repo catalog. ❌

How regional pricing works here (DashScope multi-region)

Alibaba Cloud Model Studio is a separate OpenAI-compatible endpoint per
region
, each with its own host, list price, and API key. The gateway models
this with three layers; this PR only touches the price-data layer:

Layer File Role
Region endpoints packages/models/src/providers.ts regionConfig region ids + endpointMap (singapore → dashscope-intl.aliyuncs.com, us-virginia → dashscope-us.aliyuncs.com, cn-beijing → dashscope.aliyuncs.com, eu-frankfurt → workspace-dedicated {workspaceId}.eu-central-1.maas.aliyuncs.com with trial.eu-central-1… fallback)
Per-region prices packages/models/src/models/alibaba.ts regions[] this PR — each region entry overrides inputPrice/outputPrice/cache and may carry its own pricingTiers
Region expansion packages/models/src/region-helpers.ts expandProviderRegions regions[] → flat entries ([root, singapore, eu-frankfurt, us-virginia, cn-beijing]); externalId stays constant, region is the disambiguator
Endpoint resolution packages/actions/src/get-provider-endpoint.ts endpointMap[region] → resolveWorkspaceScopedEndpoint() fills {workspaceId} for Frankfurt → appends /compatible-mode
Cheapest-region routing apps/gateway/src/chat/chat.ts (PR #3533/#3540) prices the expanded entries, picks cheapest eligible region per provider

Concretely: with this PR's overrides in place, expandProviderRegions exposes
the lower non-Singapore list prices, cheapest-region routing sends the request
to the winning region's real DashScope host, and billing matches the served
endpoint. No endpoint, credential, or routing code changes are needed — the
machinery already exists (eu-frankfurt overrides for qwen3.7-plus/qwen3.6-plus
and us-virginia/cn-beijing for qwen3.6-flash were already present and working).

⚠️ One pre-existing operational note (not changed by this PR): eu-frankfurt
requests need a workspace id on the Alibaba credential, otherwise they fall back
to the shared trial.eu-central-1.maas.aliyuncs.com host (1000 RPM cap, no SLA).

Verifications to run for reviewers

1. Confirm the official Alibaba list prices with curl

The pricing page is server-rendered — plain curl returns the numbers. Both
commands below fetch the SAME page used for this PR (updated 2026-08-12):

# a) Raw HTML contains the model rows + USD list prices (international default = Singapore)
curl -sL "https://www.alibabacloud.com/help/en/model-studio/model-pricing" \
  -H "User-Agent: Mozilla/5.0" | grep -oE 'qwen3\.7-plus.{0,600}' | head -1
# Expect: ... List price $0.4 ... List price $1.6 ... (Singapore, 0-256K)

# b) The US/Frankfurt/Beijing region tabs are also server-rendered — grep for the dropped prices:
curl -sL "https://www.alibabacloud.com/help/en/model-studio/model-pricing" \
  -H "User-Agent: Mozilla/5.0" > /tmp/pricing.html
python3 - <<'PY'
import re
html = open("/tmp/pricing.html", encoding="utf-8", errors="replace").read()
t = re.sub(r"<[^>]+>", "|", html); t = re.sub(r"\|+", "|", t)
for model in ["qwen3.7-plus", "qwen3.6-plus", "qwen3.6-flash"]:
    i = t.find(model)
    print(model, "->", t[i:i+220].replace("|", " ")[:220])
PY
# Expect: qwen3.7-plus -> ... $0.276 ... $1.101 ... (US/Frankfurt/Beijing rows)

# c) qwen3.7-flash is JS-rendered on alibabacloud.com; use the CN-hosted page (server-rendered, CNY).
#    CNY 0.2/0.8 (≤32K) ≈ $0.028/$0.110 at the official ~7.14 CNY/USD rate.
curl -sL "https://help.aliyun.com/en/model-studio/model-pricing" \
  -H "User-Agent: Mozilla/5.0" | grep -oE 'qwen3\.7-flash.{0,300}' | head -1

Optional stronger check — run the packaged verifier (fetches + normalizes both pages):

python3 /tmp/verify-alibaba-pricing.py   # prints per-model, per-region USD prices

2. E2E the pricing through the LLMGateway stack

From a worktree on the PR branch (see Task 7 for the /tmp scratch setup):

# a) Build + unit suite (canonical invocation, per AGENTS.md)
pnpm build
pnpm test:unit        # = pnpm build:core && vitest run --no-file-parallelism
#   apps/gateway: zero failures expected. apps/api Postgres-dependent specs are
#   environmental (pre-existing), not caused by this PR.

# b) Local gateway — verify the catalogue exposes the new prices via the models API
docker compose up -d db redis      # isolated test DB per AGENTS.md
pnpm dev:gateway &                 # or the repo's documented local gateway start
curl -s "http://localhost:8787/v1/models?mapped=true" \
  -H "Authorization: Bearer test-token" | python3 - <<'PY'
import json, sys
data = json.load(sys.stdin)["data"]
for m in data:
    if m["id"].startswith("alibaba/qwen3.7-") or m["id"].startswith("alibaba/qwen3.6-"):
        p = m["pricing"]
        print(f"{m['id']:32s} prompt=${p['prompt']:.6f} completion=${p['completion']:.6f}")
PY
#   Expect: alibaba/qwen3.7-plus   prompt=0.000276 completion=0.001101
#           alibaba/qwen3.7-flash  prompt=0.000028 completion=0.000110   (region-pinned variants)
#           alibaba/qwen3.6-plus   prompt=0.000276 completion=0.001651
#           alibaba/qwen3.6-flash  prompt=0.000165 completion=0.000990

# c) E2E routing — cheapest-region smoke test (needs an Alibaba/DashScope key; skip if none)
TEST_MODELS="alibaba/qwen3.7-plus:us-virginia,alibaba/qwen3.7-flash:eu-frankfurt" \
  FULL_MODE=true pnpm test:e2e

Validation (from this PR)

  • pnpm build ✅ · pnpm test:unit ✅ · no price increased in the diff ✅
  • Every value above was captured live from the Alibaba page on 2026-08-12
    (page header: "Updated at: 2026-08-12 03:12:30").

---

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9340d534-e6fe-4672-9e88-00721ec89441

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

- qwen3-max: 3e-6/15e-6 → 1.2e-6/6e-6 base + pricing tiers (official 2026-08-12 list)
- qwen3-coder-plus: 6e-6/60e-6 → 1e-6/5e-6 base + pricing tiers (official 2026-08-12 list)
- qwen3.7-flash: add eu-frankfurt/us-virginia/cn-beijing overrides at 0.028/0.110 base
- qwen3.7-plus: add us-virginia/cn-beijing overrides at 0.276/1.101 base
- qwen3.6-plus: add us-virginia/cn-beijing overrides at 0.276/1.651 base
- qwen3.6-flash: add eu-frankfurt override at 0.165/0.99 base
- Promos (qwen3.7-max 50% off, qwen3.7-plus 20% off) intentionally NOT applied
- Deactivated entries skipped
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