Commit Graph
8336 Commits
Author SHA1 Message Date
feeeei 31564b2e86 fix(gemini): 刷新 Gemini 默认模型列表,移除已停用的 2.x 模型
- 账号白名单"同步最新支持模型"、/v1/models 与 /v1beta/models 的兜底列表共用的三处 Gemini 默认列表
  (前端 geminiModels、geminicli.DefaultModels、gemini.DefaultModels)统一为同一份 17 个现役模型:
  3.x 生图、3-flash、3.1-pro-preview(-customtools)、3.1/3.5 flash(-lite)、3.6/3.7/3.8-flash、4-argon;
  移除 2.0/2.5 系列与 3-pro-preview
- 连接测试默认模型由 gemini-2.0-flash 改为 gemini-3.5-flash;Google One 账号仍用其保守模型集
- 前端下拉候选总表补入 antigravity 模型并去重,antigravity 账号白名单下拉不再只显示与其他平台重叠的条目
- 生图模型识别补上 gemini-3.1-flash-lite-image
2026-10-28 16:00:21 +08:00
feeeei de44e3a0bf fix(gemini): 分组账号都声明模型映射时,/v1beta/models 列表与详情按声明的模型应答
- 原先 /v1beta/models 与 /v1beta/models/{model} 从分组中按优先级挑一个账号透传其上游列表;
  分组由多个第三方中转 Key 组成且各配 model_mapping 时,结果只反映选中账号的上游,
  与 /v1/models(合并各账号映射)不一致,下游"同步上游支持的模型"会拿到残缺或不可路由的模型
- 分组内每个可调度 Gemini 账号都有生效映射时,列表返回映射键并集(并上混合调度
  antigravity 账号的 Gemini 模型),分组白名单按 FilterForListing 与 /v1/models 同口径过滤,不再请求上游
- 详情按同一来源判断:键末尾 * 按前缀匹配,customtools 别名按请求路径的规则归一,未覆盖返回 404
- 有账号未配置映射(接受任意模型)或查询出错时,保持原选号透传逻辑
2026-10-28 16:00:21 +08:00
shaw 0a2a29b32e chore(deps): bump golang.org/x/net to v0.62.0 (GO-2026-6860)
govulncheck flags html.Parse quadratic text-node coalescing reached via
parseOllamaCloudUsageHTML. Bump x/net (and its x/* siblings pulled by go get).
2026-10-28 15:01:09 +08:00
wc4440222 1352e899ec test(channels): use checked type assertions in web search merge tests
golangci-lint (errcheck, check-type-assertions) flags single-value type
assertions; switch to the two-value form so the assertions stay explicit.
2026-10-28 14:07:46 +08:00
Wesley Liddick b2e7c60943 Merge pull request #8352 from ychy7001/fix/admin-guard-400
fix(admin): 管理员保护校验返回 400 而不是 500
2026-10-28 13:54:31 +08:00
wc4440222 9eba617367 fix(channels): preserve web_search_emulation platform dimensions on update
The admin channel editor rendered and submitted only the anthropic dimension of
features_config.web_search_emulation, while UpdateChannel replaces features_config
as a whole block. Saving a channel from the UI therefore erased the openai /
command_code / ... dimensions written via the API, silently disabling web search
emulation for those platforms until they were written again.

Backend: merge the key per platform dimension on update (request dimensions win,
missing dimensions are inherited; a missing key inherits the whole value so
clients unaware of the feature cannot wipe it; an explicit empty object still
clears). Other features_config keys keep the historical whole-block replacement.

Frontend: render and submit every platform in a whitelist that mirrors the
backend account-level whitelist, including explicit false for disabled sections,
so the stored value cannot go stale.

Tests: merge unit tests + applyUpdateInput wiring tests (backend), and a
source-contract spec for the channel editor (frontend). Reverting either side
makes the new tests fail.
2026-10-28 13:32:13 +08:00
haruka cf33006336 feat(frontend): add MCP OAuth consent and connections 2026-10-28 05:55:02 +08:00
haruka f17918ea17 feat(backend): add OAuth-authenticated management MCP 2026-10-28 05:54:56 +08:00
r266-tech 552d1ab4bb fix(apicompat): skip foreign CC Switch reasoning envelopes 2026-10-28 03:54:26 +08:00
r266-tech 090c58f663 fix(gateway): honor account error policies in compatibility paths 2026-10-28 03:45:29 +08:00
r266-tech 92d35a6947 fix(pricing): retry sync after catalog hash mismatch 2026-10-28 03:30:52 +08:00
danvilig ffd26af507 test(openai): cover native image routes and proxy deadlines 2026-10-27 16:26:45 +00:00
danvilig 1e0f56d76f fix(frontend): default Codex exports to GPT-6.1 Sol 2026-10-27 16:18:03 +00:00
danvilig 1afe5ffe35 fix(frontend): enable live web search in Codex exports 2026-10-27 15:18:34 +00:00
r266-tech 508bb9560f fix: correct Sonnet 5.5 cache read fallback pricing 2026-10-27 22:24:47 +08:00
danvilig 0d2459d986 fix(frontend): preserve Codex image configuration in key exports 2026-10-27 13:40:01 +00:00
Wesley Liddick f178e5ae32 Merge pull request #8362 from lkon2112/fix/nonstream-malformed-function-call
fix(antigravity): 非流式畸形工具调用返回错误而非空成功响应
2026-10-27 20:43:08 +08:00
Wesley Liddick 449b65a2ed Merge pull request #8348 from SipengXie2024/fix/images-upload-part-limit
fix(images): reject oversized multipart uploads instead of truncating them
2026-10-27 20:43:01 +08:00
Wesley Liddick 2c9d9760d8 Merge pull request #8303 from SipengXie2024/fix/pagination-offset-overflow
fix(pagination): keep page offsets from overflowing int
2026-10-27 20:42:55 +08:00
Wesley Liddick af4462ebae Merge pull request #8376 from fxjs/fix/opencode-deepseek-developer-role
fix(gateway): 修复 OpenCode 转发 DeepSeek 时的 developer 角色 422
2026-10-27 20:42:48 +08:00
Wesley Liddick 8e231ff5d6 Merge pull request #8354 from ychy7001/fix/deepseek-cache-hit-tokens
fix(usage): DeepSeek prompt_cache_hit_tokens 计为缓存读取
2026-10-27 20:42:41 +08:00
Wesley Liddick 98bcee7a89 Merge pull request #8366 from wx-11/fix/model-plaza-group-pricing
fix(model-plaza): 修复模型广场定价被覆盖的问题
2026-10-27 20:42:35 +08:00
Wesley Liddick 3f1ae7ee76 Merge pull request #8003 from Yukinoshita-Yukino/codex/fix-deepseek-pro-pricing
fix(billing): retain DeepSeek V4 Pro pricing after September 14
2026-10-27 20:42:28 +08:00
Wesley Liddick bb021d330e Merge pull request #8326 from r266-tech/codex/gemini-file-images
fix(gemini): count fileData image outputs for billing
2026-10-27 20:42:22 +08:00
Wesley Liddick 3bd166babc Merge pull request #8377 from StarryKira/codex/fix-cc-version-utf16
fix(claude): align cc_version suffix with JavaScript UTF-16 indexing
2026-10-27 20:42:15 +08:00
Wesley Liddick 0232cb7137 Merge pull request #8286 from coder-zhw/fix/cn-frequency-429-short-cooldown
fix(ratelimit): 国产 Coding Plan 的频率型 429 改用秒级冷却,不再冷却到 5h 窗口结束
2026-10-27 20:42:08 +08:00
danvilig cf1ba819b9 fix(openai): preserve native Codex image error statuses 2026-10-27 12:08:54 +00:00
Wesley Liddick 15701ba187 Merge pull request #8339 from aomsir/fix/grok-model-catalog-audit
fix(grok): 完善模型目录来源诊断与原始响应模型审计
2026-10-27 19:00:01 +08:00
Wesley Liddick b332f169f9 Merge pull request #8364 from wucm667/feat/issue-8363-gpt61-terra
feat(openai): support GPT-6.1 Terra
2026-10-27 18:51:29 +08:00
haruka 7bce2cfb45 fix(claude): match JavaScript UTF-16 billing fingerprint semantics 2026-10-27 18:33:06 +08:00
zhangyiyi ba5b218794 fix(gateway): 修复 OpenCode 转发 DeepSeek 的角色兼容
- 按映射后的 DeepSeek 模型和选中的 OpenCode 上游转换 developer 角色,避免 422
- 覆盖原生平台及 OpenAI 兼容接法,保留其他模型和原始重试请求
- 补充流式、非流式、模型别名及域名判定回归测试
2026-10-27 17:57:48 +08:00
feeeei b2b1bcf260 fix(models): 模型列表刷新进入 singleflight 后复查缓存,避免并发冷启动重复请求上游
- 调用方读缓存未命中后才进入 singleflight;上一轮刷新若在两者之间完成并写入缓存,
  后到的调用会再发起一次上游请求
- 刷新函数先复查缓存,已是新鲜结果则直接复用,只有缺失或过期时才请求上游
- 修复 TestPinnedOpenAIModelsListMixedAccountsShareColdCacheAcrossGroups 偶发上游调用 2 次
  (-race -count=3000 -cpu 1,2,4:修复前 34/9000 失败,修复后 0)
2026-10-27 14:30:38 +08:00
feeeei a207412375 fix(gemini): 绑定显式缓存的请求在池模式上游网关账号上按配置同账号重试
- 绑定缓存的请求收到上游网关账号的 429 / 5xx 时,原先直接按耗尽处理原样回写,pool_mode_retry_count 不生效;
  现按 pool_mode_retry_status_codes 判定可重试,在持有缓存的账号上同账号重试,用尽后仍原样回写
- 可重试的错误标为请求级瞬时故障:故障在上游网关持有缓存的账号上,重试用尽不临时封禁本账号
- 可重试时每次尝试登记 retry 类 ops 上游事件,重试成功记为恢复,不计入换号次数
- 非池模式账号或状态码不在重试列表内时行为不变
2026-10-27 12:11:54 +08:00
Jelvin 5965ac4e93 feat(settings): 系统设置保存按钮改为底部吸附浮标
各 tab 表单很长,保存按钮只在滚到最底部时可见。改为 sticky 浮标贴在视口右下角,
样式沿用已有 tab 导航条的毛玻璃胶囊语言,深色模式覆盖放在非 scoped 块内。
2026-10-27 10:35:40 +08:00
wx-11 d0afece15f fix(model-plaza): prefer group model pricing over image fallback tiers 2026-10-27 08:57:35 +08:00
lyy0709 64e6c260cc fix(billing): exempt GPT-6.1 Terra subscriptions from long-context surcharge
Codex opens GPT-6.1 Terra with a 500k default window, so subscription
requests routinely pass the 272k API long-context threshold. Apply the
existing GPT-6.1 Sol rule: OAuth and setup-token requests whose final
upstream model is Terra skip the model surcharge, while API keys keep
the published 2x input/cache and 1.5x output rates. Also label Terra's
fallback prices with their own release date.
2026-10-27 08:01:28 +08:00
lyy0709 e73f4c5e52 fix(openai): validate GPT-6.1 Terra effort and compat cache keys
GPT-6.1 Terra publishes none through max; minimal is not on its scale.
Recognize the -minimal spelling so the alias still resolves to Terra,
and reject minimal on the Chat, Messages and Responses compatibility
paths with the same 400 Sol uses for its unsupported levels. none stays
valid for Terra, and Sol keeps its stricter low-through-max checks.

Compatibility requests mapped to Terra also did not receive the derived
prompt_cache_key that other GPT-6 Responses models get, so Chat and
Messages traffic lost its stable cache identity. Include Terra there.
2026-10-27 08:01:23 +08:00
lyy0709 bea67f4124 fix(openai): use the official Codex descriptor for GPT-6.1 Terra
The generated Terra entry copied the API model page into the Codex
catalog: it offered none, omitted ultra, defaulted to medium and fell
back to a 272k window and the GPT-5.5 prompt. Codex publishes a separate
descriptor (openai/codex 126a0ee92ed2, models.json): low by default, low
through ultra, a 500k/872k window, Fast as the only extra tier and its
own instructions. A ChatGPT Plus account's live /backend-api/codex/models
response reports the same reasoning, window and tier values.

Bundle that descriptor like GPT-6.1 Sol, take Terra's base instructions
from it, and give official accounts the same route defaults: API-key
clients stay on full Responses, OAuth keeps Responses Lite and code mode.
Account-supplied manifests remain authoritative, and API requests keep
none through max. The model list now records the 2026-10-26 release
time instead of a 2024 placeholder.
2026-10-27 08:00:05 +08:00
wucm667 3423667422 feat(openai): support GPT-6.1 Terra 2026-10-27 04:36:20 +08:00
lkon 14a5fe3050 fix(antigravity): reject malformed non-streaming tool calls 2026-10-27 03:06:58 +08:00
Anderson 9c7380732d test(openai-ws): explicitly discard deferred close errors 2026-10-26 18:24:38 +08:00
Anderson 142d22cc42 fix(openai-ws): reconnect pooled OAuth sockets before search activation 2026-10-26 18:03:52 +08:00
ychy7001 390ba9905a fix(securityaudit): 审计任务入队后立即唤醒本进程 worker
异步审计 worker 每 500ms 轮询一次数据库认领任务,本进程刚入队的任务
平均要等约 250ms 才被处理。入队成功和租约回收后改为立即通知本进程的
worker 尝试认领;worker 启动时先认领一次遗留任务。500ms 轮询保留不变,
继续兜底到期重试和其他副本入队的任务。
2026-10-26 17:31:33 +08:00
ychy7001 88d9c43b3e fix(admin): 管理员保护规则返回 400 而不是 500
禁用、删除或降级最后一个管理员时,服务层返回的是普通 errors.New,
经 ErrorFrom 统一转成 500,前端只能显示通用错误。改用 BadRequest
错误码和原因,前端可以显示具体原因。
2026-10-26 17:12:35 +08:00
ychy7001 3e18e78ab1 fix(usage): DeepSeek prompt_cache_hit_tokens 计为缓存读取
DeepSeek 的 OpenAI 兼容 usage 用 prompt_cache_hit_tokens / prompt_cache_miss_tokens
表示缓存命中(prompt_tokens = hit + miss),不返回 prompt_tokens_details.cached_tokens,
OpenAI 网关解析 usage 时缓存读取恒为 0。将其作为缓存读取的兜底字段,
嵌套 cached_tokens 存在时仍以嵌套字段为准。
2026-10-26 17:12:35 +08:00
hezhaoqian1andClaude Opus 5.5 b8de5e1700 perf(keys): API 密钥列表不再等待 30 天用量统计,并为其加覆盖索引
/keys 页面要等密钥列表和每个 key 的用量统计都返回,才撤掉表格骨架屏。
用量统计(POST /usage/dashboard/api-keys-usage)按 api_key_id 汇总近 30 天的
usage_logs.actual_cost。数据量大时,要逐行回表读取几十万到上百万行,接口耗时
十几到三十几秒,甚至超时,页面就一直停在骨架屏。

- 前端:列表返回就渲染表格,用量列单独显示加载占位;统计失败时回落为 $0.0000。
- 后端:新增覆盖索引 (api_key_id, created_at) INCLUDE (actual_cost),使该统计可以
  index-only scan,不再回表。迁移采用 CONCURRENTLY 建索引;与其他 usage_logs
  索引迁移一样,重试前会先清理中断构建留下的 INVALID 索引。

Refs #5858

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 11:16:54 +08:00
SipengXie2024 cde6ddfd8f fix(images): reject oversized multipart uploads instead of truncating them
Multipart image uploads were read through io.LimitReader(part, 20MB), so any
image larger than 20MB was silently cut short. The OAuth path (and the Grok
media path) then base64-encoded the truncated bytes and sent them upstream,
which answered 400 invalid_image_file. The API key path forwards the raw
multipart body and was not affected, so the same request worked or failed
depending on which account served it.

- Raise the per-part limit to 50MB, OpenAI's documented per-image limit for
  GPT image edits, and return 400 when a part exceeds it.
- Read Grok media parts whole; the body is already bounded by the gateway
  request body limit.
- Log each upload's content type and size on the images routing line.
2026-10-26 03:10:46 +00:00
Aomsir dfc13ce7f9 fix(grok): 修复模型目录审计相关 lint 错误 2026-10-25 22:08:54 +08:00
Wesley Liddick ba81c7fd75 Merge pull request #8323 from wx-11/images-price
兼容gptimage一次性出多张图的按张计费
2026-10-25 21:48:55 +08:00
shaw 3ce09c8aff fix(billing): keep tokens for channel per-request image tiers
calculatePerRequestCost falls back to context-based tiers when the size
tier misses; dropping Tokens made those tiers never match and settled
images at $0 regardless of the image_count_billing switch.
2026-10-25 21:30:45 +08:00