You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(pricing): make introductory rates editable in Settings
Users could edit a model's standard rates but not its time-limited
introductory (promo) rates — those were display-only, so the Sonnet 5
intro pricing could only be changed by editing seed code. Since intro
promos are not a one-off (any future model launch may ship one), make the
whole mechanism editable and generic.
Backend
- New setIntroPricing prepared statement updates ONLY the intro_* columns,
kept separate from upsertPricing so a standard-rate edit never touches
the promo and vice versa.
- PUT /api/pricing now accepts optional intro_input/output/cache_* and
intro_until. It only writes intro columns when the caller sends at least
one intro field, so older clients that PUT just the standard rates
preserve any existing promo (backward compatible). intro_until is
validated as YYYY-MM-DD; an empty value clears the promo and zeroes the
intro rates (so a re-added date can't resurrect stale values). Both
writes run in one transaction.
Frontend (Settings → Model Pricing)
- The edit/add form gains a second row: an "Introductory rates" box with a
cutoff-date field plus intro input/output/cache-read/cache-write(5m/1h)
inputs. Empty date = no promo. Client mirrors the YYYY-MM-DD validation.
- The display row now shows the intro subline on every rate column (was
input/output only) so all editable intro values are visible.
Nothing here is Sonnet-5-specific: the date-driven promo window works for
any model pattern, so a future launch promo needs no code change — just an
edit in the UI. Adds a server route test covering persist / preserve /
clear / reject-malformed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: client/src/i18n/locales/en/settings.json
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,10 @@
14
14
"title": "Model Pricing",
15
15
"description": "Rates per million tokens (USD). Use % as wildcard in patterns. Some models have a time-limited introductory rate (shown in violet); usage on or before its cutoff date is billed at that rate, and usage after it at the standard rate.",
16
16
"introNote": "Intro ${{input}}/${{output}} through {{until}}",
17
+
"introRatesTitle": "Introductory rates",
18
+
"introRatesHint": "Leave the date empty for no promo",
19
+
"introUntil": "Through (date)",
20
+
"introUntilInvalid": "Introductory cutoff must be a YYYY-MM-DD date",
17
21
"resetConfirm": "Confirm Reset",
18
22
"resetDefaults": "Reset Defaults",
19
23
"resetResult": "Reset to {{count}} default rules",
Copy file name to clipboardExpand all lines: client/src/i18n/locales/vi/settings.json
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,10 @@
14
14
"title": "Định giá mô hình",
15
15
"description": "Đơn giá theo một triệu token (USD). Dùng % làm ký tự đại diện trong mẫu. Một số mô hình có mức giá giới thiệu có thời hạn (hiển thị màu tím); usage vào hoặc trước ngày kết thúc tính theo mức đó, sau đó tính theo mức chuẩn.",
16
16
"introNote": "Ưu đãi ${{input}}/${{output}} đến {{until}}",
17
+
"introRatesTitle": "Giá giới thiệu",
18
+
"introRatesHint": "Để trống ngày nếu không có ưu đãi",
19
+
"introUntil": "Đến (ngày)",
20
+
"introUntilInvalid": "Ngày kết thúc ưu đãi phải theo định dạng YYYY-MM-DD",
17
21
"resetConfirm": "Xác nhận đặt lại",
18
22
"resetDefaults": "Khôi phục mặc định",
19
23
"resetResult": "Đã đặt lại về {{count}} quy tắc mặc định",
0 commit comments