feeeei
e2cfaa46e7
fix(pricing): 目录 cache 侧字段契约哨兵与 Gemini pro 缓存写入价修正
...
阶梯计价数据驱动后,目录条目的字段缺失或版本拼接会直接变成计费偏差,
解析层补两道数据契约哨兵,并修正出厂快照中 Gemini pro 系的缓存写入价:
- orphanCacheTierFields / warnOrphanCacheTierFields:条目带 cache 侧
above 档(含 _priority/_flex 变体与 above_1hr 形态)却没有基础价时打
WARN——cache 侧 above 档不参与计费取值,按"基础价 × 输入倍率"计,基础价
缺失即该分项按 0 计;变体缺自身基础价时沿 变体→1h→标准 回落链任一存在
即不算孤儿,与计费回落一致
- isLopsidedLongContextLadder / warnLopsidedLongContextLadders:above 档
折算出只有一侧带附加费的阶梯时打 WARN(基础价与 above 档来自不同价格
版本的形态),显式 long_context_* 字段不告警
- deriveLongContextFromAboveTierFields 注释改为陈述契约:cache above 档
须恰为基础价 × 输入倍率
- 出厂快照 6 个 Gemini pro 条目补 cache_creation_input_token_cost(= 标准
输入价,Google 对缓存写入不另收费)、above_200k 改为输入 above 价、带
priority 输入价的 4 条补 priority 孪生,与 model-price-repo 数据修正同值
测试:
- 解析层:孤儿字段 WARN(含 priority/1h 孤儿正例、1h 回落 5m 反例)、单侧
阶梯 WARN、出厂快照契约(全条目无孤儿字段、无单侧阶梯、Gemini pro 缓存
写入价 = 输入价)
- 用量契约:extractGeminiUsage 与 Antigravity 非流式/流式转换均不产生
cache_creation token(Gemini usageMetadata 无该类别)
- 计费:gemini-2.5-pro 阶梯对 cache_read / cache_creation 分项生效,阈值
计入缓存写入 token;阶梯表场景与夹具同步为现行目录值
2026-09-01 01:26:55 +08:00
feeeei
593fc93659
feat(pricing): 新增 override_file 价格目录覆盖补丁
...
新增 pricing.override_file 配置(默认关闭):稀疏补丁文件按 JSON 字段
浅合并覆盖目录/回退数据,作为最高优先级数据源,用于本地自定义官方
目录条目(如显式 long_context_input_token_threshold=0 关闭某模型阶梯)
而无需自建价格镜像:
- applyPricingOverrides 挂在 parsePricingData 解析入口,只修补已存在
条目(补丁字段覆盖同名字段,值为 null 删除字段);目录、回退与灾备
路径都经该入口,覆盖语义三处一致
- mergeOverrideOnlyModels 在回退合并后把目录/回退都没有的模型作为
独立条目并入(复用主解析路径,须自带价格字段通过有效性过滤);
不在主解析时抢先建条目,避免纯补丁挡住回退完整条目、其余分项价
静默变 0
- 最终未生效的条目(模型名拼错、纯补丁落在不存在的模型上)打 WARN
哨兵;override 文件缺失/损坏仅跳过合并,不影响目录加载
- 生效时机为重启或下次目录下载,与 fallback_file 一致;fallback_file
只补缺失模型的语义不变
2026-09-01 01:26:55 +08:00
feeeei
530fb20f25
refactor(billing): 长上下文阶梯计价改为价格目录数据驱动
...
删除 GPT/Gemini 系列写死的阶梯规则,阶梯一律由目录数据驱动:
- 解析层折算 LiteLLM 的 *_above_XXXk_tokens 绝对价字段为阈值+倍率
(阈值取自字段名,倍率 = above/基础价,cache 侧跟随输入倍率,
xAI 按 provider 用达到即进高档语义);显式 long_context_* 字段
按"字段存在"优先,显式 threshold=0 或 multiplier=1 可关闭阶梯
- 删除 OpenAI 272K 常量与 applyModelSpecificPricingPolicy 的长上下文
强补分支、fallbackPrices/静态兜底条目的 LongContext 字段、Gemini 旧
边际规则全链路(CalculateCostWithLongContext / RecordUsageWithLongContext /
阶梯表 marginal 基准);保留 fastRatio 与 GPT-5.6 cache_write 1.25x
防御分支、grok 静态兜底阶梯
- 渠道配置定价区间时完全以渠道区间为准,不再叠加目录阶梯
- 长上下文倍率 ≤0 在应用点按 1 计,防止显式字段残缺把分项乘 0 免费
- 目录重载时对比新旧数据,原有阶梯丢失打 WARN 哨兵告警
行为变化:Gemini 由边际 2x(仅 /v1beta、全模型)改为整单换档(数据
驱动、仅带 above_200k 的 pro 系),渠道平价之上叠加目录阶梯;Claude
sonnet-4/4.5 随目录数据获得 200K 整单阶梯(与官方定价一致);模型广场
官方参考价列与实付列同源展示目录阶梯。
2026-09-01 01:26:55 +08:00
Brisbanehuang
e2624fb65c
fix(codex): preserve known image input capabilities
2026-08-31 09:42:58 -04:00
shaw
0fcec63b68
test(openai): isolate visible TTFT fixture
2026-08-31 15:15:44 +08:00
shaw
c66e700f05
fix(openai): move TTFT metric mode to admin settings
2026-08-31 14:52:07 +08:00
Wesley Liddick
fdf9751c12
Merge pull request #6378 from Ritel-T/fix/codex-oauth-service-tier-billing
...
fix(openai): preserve Codex OAuth Fast billing tier
2026-08-31 13:56:00 +08:00
Wesley Liddick
0678b24d58
Merge pull request #6283 from okbexx/feat/usage-compaction-kind
...
feat(usage): track native compaction requests
2026-08-31 11:19:37 +08:00
Wesley Liddick
f34735f462
Merge pull request #6388 from alfadb/feature/ollama-usage-cn-platforms
...
feat(ollama): 用量窗口支持挂在国产三家平台下的 Ollama Cloud 账号
2026-08-31 11:16:25 +08:00
Wesley Liddick
a2d7d41185
Merge pull request #6325 from 251392463/fix/grok-responses-vision-tool-output
...
fix(grok): preserve Responses vision tool output images
2026-08-31 11:15:33 +08:00
Wesley Liddick
03ab687686
Merge pull request #5866 from wucm667/fix/issue-5863-scope-monitor-groups
...
fix: scope channel monitor groups by user access
2026-08-31 11:15:13 +08:00
Wesley Liddick
fbc69322af
Merge pull request #6254 from wucm667/fix/issue-6249-configurable-image-cooldown
...
feat(openai): configure image tool cooldown
2026-08-31 11:13:52 +08:00
Wesley Liddick
414489d152
Merge pull request #5469 from wucm667/fix/issue-5467-passthrough-http-bridge
...
fix(openai-ws): bridge oversized passthrough requests
2026-08-31 11:13:35 +08:00
Wesley Liddick
50a9dd7a64
Merge pull request #6386 from wucm667/fix/issue-6383-isolate-passthrough-ws
...
fix(openai): isolate passthrough websocket sessions
2026-08-31 11:13:16 +08:00
Wesley Liddick
a4156eea10
Merge pull request #6385 from wucm667/fix/issue-6381-preserve-quota-limits
...
fix(admin): preserve quota limits on partial group updates
2026-08-31 11:12:56 +08:00
wucm667
897faea333
fix(account): reset quota cooldown atomically
2026-08-31 09:12:09 +08:00
wucm667
d5a0124637
fix(openai): isolate passthrough websocket sessions
2026-08-30 16:49:01 +08:00
alfadb
30b29e51e8
feat(ollama): 用量窗口支持挂在国产三家平台下的 Ollama Cloud 账号
...
Ollama Cloud 用量窗口(浏览器会话、5h/7d 快照、自动刷新、同 key 组共享)此前
只认 platform ∈ {openai, anthropic} 的 apikey 账号。但网关对 kimi/zhipu/deepseek
的 apikey 账号同样按 credentials.base_url 转发,用户把 Ollama Cloud 的 key 挂在
这三个平台下跑 Ollama Cloud 托管的 glm/kimi/deepseek 模型时,请求转发正常,用量
窗口却完全不可用。
- 平台白名单放开到 {openai, anthropic, kimi, zhipu, deepseek};type='apikey'
与官方 ollama.com base_url 的限制不变
- Go 侧收敛为 isOllamaCloudUsagePlatform,SQL 侧收敛为
ollamaCloudUsagePlatformsSQL,6 处白名单只引用单一来源,并补两侧互为镜像的
漂移守卫测试
- CN 周期余额/额度探测跳过 ollama 用量账号:其探测端点由 base_url 衍生,对
ollama.com 会被出站 URL 白名单拒绝,每轮都白跑并产生噪声
- 前端账号列表 CN 分支在 eligible 时改渲染 Ollama 用量窗口,并跳过 CN 额度/
余额子单元格(同上,渲染出来只会是一行探测报错)
2026-08-30 16:38:11 +08:00
wucm667
9f1effd71c
fix(admin): preserve quota limits on partial group updates
2026-08-30 16:36:13 +08:00
Ritel-T
82105f260a
fix(billing): resolve shadow credential tier contract
2026-08-30 13:40:37 +09:00
Ritel-T
50ad6e2e50
fix(billing): narrow Codex OAuth default exception
2026-08-30 13:40:19 +09:00
Ritel-T
f323d84644
test(billing): cover Codex OAuth usage pricing
2026-08-30 13:07:33 +09:00
Ritel-T
3a9070359b
fix(billing): scope Codex OAuth tier trust
2026-08-30 13:07:21 +09:00
Ritel-T
d39fc491ec
test(openai): cover websocket tier separation
2026-08-30 13:07:07 +09:00
Ritel-T
2b8cb628b6
fix(openai): preserve tiers in messages chat fallback
2026-08-30 13:06:45 +09:00
Ritel-T
8b4b3f4a94
fix(openai): preserve tiers in responses chat fallback
2026-08-30 13:06:32 +09:00
Ritel-T
624e4eef64
fix(openai): separate outbound and observed tiers
2026-08-30 13:06:11 +09:00
wucm667
a3bbf33c05
fix(monitor): scope groups by user access
2026-08-30 09:28:40 +08:00
wucm667
7c616db07a
fix(openai-ws): bridge oversized passthrough requests
2026-08-30 08:41:08 +08:00
alfadb
b5827cfd54
fix(pricing): align DeepSeek billing with official peak/off-peak rates
...
同步 DeepSeek 官方峰谷价格与模型定价。
2026-08-29 17:30:23 +08:00
m11y
ea4291a92c
fix(anthropic): scope Fable scheduling threshold to Fable models
...
让 Fable 7d_oi 调度阈值仅限制 Fable 模型族,不暂停整个 Anthropic 账号。
2026-08-29 17:30:18 +08:00
101Harry
32ac921f24
fix(anthropic): avoid Fable OAuth system prompt refusal
...
修复 Fable OAuth 请求因系统提示词形态导致空响应的问题。
2026-08-29 17:29:30 +08:00
Ryan Chou
eb4237a2b0
fix(billing): 渠道定价对带后缀的模型名不再被官方兜底价覆盖
...
修复带后缀模型无法命中渠道自定义定价的问题。
2026-08-29 17:29:21 +08:00
shaw
804679d996
fix(openai): preserve model scope on stream failover
2026-08-29 15:25:10 +08:00
shaw
571d1e1d9b
fix(openai): isolate websocket semantic rate limits
2026-08-29 11:14:54 +08:00
shaw
3c22e78af0
fix(openai): preserve Spark quota reset semantics
2026-08-29 11:08:01 +08:00
shaw
5d9c7abed5
fix(openai): scope Spark quota 429 to model
2026-08-29 09:57:08 +08:00
Wesley Liddick
ac18c588c8
Merge PR #6165
...
修复上游倍率探测导致账号列表整页刷新的问题
2026-08-29 09:12:05 +08:00
Wesley Liddick
b83284071a
Merge PR #5348
...
fix(subscription): 周/月窗口展示的重置时间与实际推进锚点对齐
2026-08-29 09:10:07 +08:00
Wesley Liddick
fd13c72e95
Merge PR #6330
...
feat(zhipu): support team GLM Coding Plan usage query
2026-08-29 09:08:42 +08:00
Wesley Liddick
3c2e9a43b9
Merge PR #5860
...
fix(antigravity): preserve mixed built-in chat tools
2026-08-29 09:07:27 +08:00
Wesley Liddick
ca319d09f2
Merge PR #6280
...
fix(update): strip hyphenated pre-release/custom suffix in version comparison
2026-08-29 09:06:10 +08:00
Wesley Liddick
46598dd491
Merge PR #6306
...
fix(openai): emit pre-output SSE keepalive on the /v1/responses passthrough path
2026-08-29 09:04:46 +08:00
Wesley Liddick
3045b3ade1
Merge PR #6316
...
fix(openai): honor Claude Code session id for messages sticky routing
2026-08-29 09:03:14 +08:00
Wesley Liddick
25dc5742ea
Merge PR #6332
...
fix(monitor): 配额抓取在 singleflight 执行体内重查缓存,消除重复上游查询
2026-08-29 09:01:15 +08:00
Wesley Liddick
6506c0ea68
Merge PR #6343
...
fix(gateway): preserve Anthropic tool arguments
2026-08-29 09:00:56 +08:00
RayWangX
5688bcba91
fix(openai): honor Claude Code session for messages sticky routing
2026-08-29 08:31:15 +08:00
Jarl
1cc6999ada
feat(usage): track native compaction requests
2026-08-28 23:32:11 +08:00
风起
88cb79d8b3
fix(grok): honor client prompt_cache_key over X-Grok-Conv-Id for cache identity
...
grok-build CLI recap-style side-calls (turn-summary / title-refresh) send
a fresh per-call X-Grok-Conv-Id label but set body prompt_cache_key to
the parent session id, so a direct xAI connection shares the main turn's
server-side prompt cache prefix.
sub2api's explicitGrokCacheSeed preferred X-Grok-Conv-Id over the body
key, which fragmented the cache identity on every side-call and forced a
full-price replay of the whole conversation (~300K+ tokens each, ~2.3%
cache hit rate observed over 44 side-calls / 4.9M input tokens in 7
days — about a third of all grok-4.6 input).
Priority is now: CC session > generic session headers > body
prompt_cache_key > X-Grok-Conv-Id > explicitKey > previous_response_id.
IDE header-stability tests updated; new regression test locks in the
side-call/parent key-sharing contract.
2026-08-28 21:56:22 +08:00
Ryan Chou and Claude Opus 5
32ad1dcdce
fix(subscription): 周/月窗口展示的重置时间与实际推进锚点对齐
...
订阅首窗初始化在开通日零点时,automaticWindowStartAt 会把实际推进锚点修正为
StartsAt,但展示层(calculateProgress / WeeklyResetTime / MonthlyResetTime)
仍按窗口起点+周期计算,导致仪表盘显示的重置时间早于实际重置时间(差值 =
StartsAt 的时分秒)。用户在显示的重置时间过后请求仍会收到 429
WEEKLY_LIMIT_EXCEEDED。
抽出 windowResetAnchor 供推进与展示共用,保证两者恒一致。非 legacy 锚点
(手动重置或已推进过的窗口)保持权威,不做修正。
日窗口不在本 PR 范围内:#5380 已把日额度改为按日历日对齐(DailyResetTime =
窗口起点所在日的次日 0 点),与周/月的期限对齐滚动窗口语义不同,不共用本修正。
附一个守护用例钉死这条边界。
Fixes #5348
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com >
2026-08-28 21:46:44 +08:00