feeeei
c227863d51
fix(images): 生图 url 回填下载拒绝私网目的地并只信字节嗅探
...
账户开关 images_url_to_b64_json 下载的图片 url 来自上游响应,是不可信输入。此前沿用
base_url 的 security.url_allowlist 策略,默认配置下只做格式校验,上游返回
localhost:8080 之类地址时网关会真的去请求内网。
- 下载 URL 主机为 localhost、回环、私网、链路本地、未指定地址的字面量时直接拒绝,
不受 security.url_allowlist 配置影响(urlvalidator 导出 IsBlockedHost)
- 新增 ctx 标记 WithHTTPUpstreamPublicHostsOnly:共享上游客户端对带标记的请求无视配置
校验解析后 IP,并为其克隆客户端挂 redirectChecker,重定向保持跟随但每一跳都校验
- 下载内容改为只信 http.DetectContentType 嗅探结果且限 png/jpeg/webp/gif,
响应头不再作为依据
- 下载失败仍只记日志并保留原样;超时与端口策略不变
2026-09-05 15:50:56 +08:00
feeeei
3c53ba01a7
feat(images): 账户开关将生图结果 url 下载回填为 b64_json
...
部分第三方 GPT-image 上游把 Images 响应里的 b64_json 换成 url,按官方接口实现的
客户端读不到图。账户 extra.images_url_to_b64_json 开启后,OpenAI API Key 的
Images 非流式响应里 b64_json 缺失或为空且 url 非空的项,由网关下载 url 内容并以
base64 回填 b64_json,url 与其余字段原样保留;异步生图任务复用同一路径。
- 下载经账户代理发起,沿用 base_url 的出站 URL 校验策略(validateUpstreamBaseURL
抽出 validateOutboundURL,nil cfg 按仅格式校验处理),单图上限 20MB 且须为图片
内容(响应头或字节嗅探);data: URL 直接取 base64 载荷
- 单项下载失败仅记日志并保留原样;客户端显式 response_format=url 时不回填;
流式响应不处理
- 创建/编辑账户弹窗在 OpenAI API Key 的 Responses 模式块后新增“生图结果 URL 转
base64”开关,中英文案;新增 openai_images_b64_backfill_test.go
- 只被 unit 标签测试引用的定价目录测试辅助补上 //go:build unit(admin 包整文件加标签,
service 包的 newPricingServiceFromModelPricing 搬到 pricing_stub_helpers_unit_test.go),
消除 golangci-lint 在默认标签下的 unused 报错
2026-09-05 15:17:57 +08:00
Wesley Liddick
85f431a072
Merge pull request #6620 from wucm667/fix/issue-6615-astra-messages-cache
...
fix(openai): enable Astra messages prompt caching
2026-09-05 15:04:13 +08:00
Wesley Liddick
eba6ea5639
Merge pull request #6590 from wucm667/fix/issue-6582-search-tool-capability
...
fix(codex): advertise search capability for bridged routes
2026-09-05 15:03:31 +08:00
Wesley Liddick
c4e6dcfd80
Merge pull request #6602 from ZeroClover/feat/codex-manifest-pinned-accounts
...
feat(codex): pinned-accounts Codex model manifest for OpenAI groups
2026-09-05 14:51:17 +08:00
Wesley Liddick
701f844755
Merge pull request #6555 from feeeei/feat/usage-upstream-request-id
...
feat(usage): 用量记录落库直接上游的请求 ID,并支持按账户配置响应头名
2026-09-05 14:36:07 +08:00
Wesley Liddick
91cf660377
Merge pull request #6397 from feeeei/fix/openai-ws-replay-oom-6382
...
fix(openai-ws): eliminate O(T²) replay copying and invalid_encrypted_content retry storms
2026-09-05 14:32:11 +08:00
Wesley Liddick
78e1aaedb9
Merge pull request #6535 from feeeei/feat/pricing-custom-file-hot-reload
...
feat(pricing): fallback/override 定价文件按内容哈希热重载,改动无需重启生效
2026-09-05 14:31:09 +08:00
shaw
708b85a6a4
fix: complete upstream request id handling
2026-09-05 14:18:13 +08:00
shaw
1cab4d8c22
fix: make custom pricing reload coherent
2026-09-05 14:18:13 +08:00
Wesley Liddick
d8b9a83f8c
Merge pull request #6492 from feeeei/main
...
fix(gateway): 负载感知调度补齐渠道模型限制的逐账号检查
2026-09-05 14:06:21 +08:00
wucm667
4aaf5cb73b
fix(openai): enable Astra messages prompt caching
2026-09-05 10:58:05 +08:00
Zero Clover
1e28ef5942
feat(codex): pinned-accounts Codex model manifest for OpenAI groups
2026-09-05 00:10:24 +08:00
wucm667
c7538cd256
fix(codex): advertise search capability for bridged routes
2026-09-04 16:43:15 +08:00
feeeei
de27905e88
feat(usage): 用量记录落库上游请求标识并支持按账户配置响应头名
...
- usage_logs 新增 upstream_request_id 列(迁移 232)与仅索引非空行的 CONCURRENTLY 部分索引(迁移 233,runner 登记失效索引清理)
- 账户 extra.upstream_request_id_header 指定要读取的上游响应头,只读该头;留空不记录;创建/更新/批量入口校验头名合法且不超过 64 字节
- ForwardResult/OpenAIForwardResult 携带 UpstreamHeaders,中央计费按账户解析落库,WS 轮次保持 NULL
- 管理端用量明细新增默认隐藏的"上游ID"列,带与请求ID列一致的复制按钮,并同步导出
- 创建/编辑账户弹窗新增"上游ID"输入(UpstreamRequestIdHeaderField),提示按接入类型与平台分条列出常见头名
- HelpTooltip 悬停模式下指针移入提示框时保持打开,便于选中复制提示内容
2026-09-03 18:02:15 +08:00
Wei-Shaw
abc07bb079
test(ops): satisfy errcheck and gofmt in proxy attribution tests
2026-09-03 15:23:22 +08:00
Wei-Shaw
4c1f920d58
fix(ops): close proxy attribution gaps and bound queued upstream events
...
Follow-up to the event-time proxy snapshot: every upstream attempt now
carries attribution, the direct/unknown contract is enforced everywhere,
and the queued upstream_errors array has hard bounds again.
Attribution coverage
- compact fallback retry helper and the streaming compact failover event
now stamp proxy_id/proxy_name; the non-streaming SSE compact retry
previously dropped its first attempt on `continue` and now records it
- raw chat-completions stream truncation events (new on main) attributed
- Anthropic/Bedrock transport errors get attribution inside the shared
handleUpstreamTransportError helper, so all five callers inherit it
- OpenAI first-output timeout takes attribution from the caller: HTTP
callers pass the HTTP rule, the WS passthrough relay passes the WS rule
(no managed proxy => unknown, never direct, because http.DefaultClient
may honor environment proxies)
Contract hardening
- single opsUpstreamProxyAttribution returns (id, name) from one decision;
a hydrated Proxy without a durable ID is unknown, not id=null+name
- both normalizers (struct at append time, JSON on detail reads) enforce
proxy_id==null <=> sentinel name; blank managed name => "proxy"
- detail-read normalization edits only the attribution keys via sjson, so
keys from older struct versions and stored key order are preserved
Queue bounds
- keep at most 256 attempts and ~512 KiB serialized per entry, newest
first; the oldest retained event records dropped_earlier_attempts
- attempts outside the 16-event body window trim url/message to 512 bytes
- restore the empty-event drop rule, judged before the body window clears
detail so older real attempts survive
Tests cover each site above (managed proxy, direct, WS unknown), the
normalizer invariants, key/order preservation, and the count/byte bounds.
2026-09-03 15:11:36 +08:00
wwcchh0123
e9e3c46cb7
fix(ops): snapshot proxy on upstream errors
2026-09-03 14:20:39 +08:00
feeeei
fdc2ec17e6
feat(pricing): fallback/override 定价文件按内容哈希随定时器热重载
...
PricingService 的定时器(hash_check_interval_minutes,默认 10 分钟)每轮先做
远程目录哈希同步,再比对 fallback_file/override_file 两个文件内容的联合 sha256
(customFilesHash),变化时从本地 model_pricing.json 重建叠加层,只替换内存数据
与指纹,不改远程同步锚点 localHash。只配置了自定义文件而 remote_url 为空时
调度器同样启动。
- 三条重建路径(启动加载、远程下载、热重载)统一走 buildPricingData,指纹在合并
读取之前采样,并发改文件只会落后于数据、下一轮补重建
- 删除文件视为该层清空,下一轮生效;文件存在但不可读或不是 JSON 对象时保留旧数据、
不更新指纹,每轮重试并告警
- config.example.yaml 同步生效说明;新增 pricing_service_hot_reload_test.go
2026-09-03 10:35:20 +08:00
feeeei
9ad3865690
fix(gateway): 负载感知调度补齐渠道模型限制的逐账号检查
...
渠道 billing_model_source=upstream 时,限制模型只能按账号映射后的上游模型
逐账号判定。GatewayService.SelectAccountWithLoadAwareness 的负载感知各层
(模型路由候选、路由内粘性 gate、无路由粘性 gate、负载感知候选及其兜底)
此前都没有这一判定,load_batch_enabled 默认开启,anthropic/gemini/antigravity
分组的渠道白名单实际不生效。
现在入口算一次 needsUpstreamChannelRestrictionCheck,各层共用同一判定;
候选因渠道限制筛空时记 warn 并返回带 channel pricing restriction 的
ErrNoAvailableAccounts,与预检路径一致。
2026-09-02 11:46:37 +08:00
刘佳林
77729e2723
merge: resolve conflicts with upstream/main
...
Keep model-scoped reasoning effort mappings together with the
deny-or-downgrade ceiling control that landed on main.
2026-09-02 10:01:42 +08:00
Wesley Liddick
6566039bc8
Merge pull request #6470 from aofee/codex/fix-ws-passthrough-missing-terminal
...
fix(openai-ws): reject passthrough close before terminal event
2026-09-02 09:42:13 +08:00
Wesley Liddick
e50bffb7e3
Merge pull request #6469 from wucm667/fix/issue-6465-apikey-chat-cache-identity
...
fix(openai): preserve API key chat cache identity
2026-09-02 09:25:02 +08:00
Wesley Liddick
f2804eb2c8
Merge pull request #6444 from Ritel-T/pr/group-free-openai-fast
...
Add group-level Standard billing for OpenAI Fast requests
2026-09-02 09:23:49 +08:00
Wesley Liddick
559960865a
Merge pull request #6447 from DuskLin/feat/openai-reasoning-effort-over-limit
...
feat(groups): 推理强度上限增加超限自动降档与拒绝访问
2026-09-02 09:07:53 +08:00
Wesley Liddick
a4fb58e428
Merge pull request #6443 from Ritel-T/pr/group-openai-fast
...
Add group-level OpenAI Fast enforcement
2026-09-02 09:07:05 +08:00
haruka
34b8bf1a6e
feat: support Claude Fable 5.1
2026-09-02 05:47:01 +08:00
Ritel-T
52c7d88340
chore: merge upstream v0.1.185
2026-09-02 03:29:52 +09:00
Ritel-T
9e2d97f250
chore: merge upstream v0.1.185
2026-09-02 03:28:24 +09:00
aofee
bfe0a5a873
fix(openai-ws): reject close before terminal event
2026-09-01 20:44:11 +08:00
wucm667
504919a054
fix(openai): preserve API key chat cache identity
2026-09-01 19:10:37 +08:00
Wesley Liddick
0d27f45ead
Merge pull request #6454 from alfadb/fix/anthropic-fallbacks-sanitize
...
fix(gateway): 缺 server-side-fallback beta 时剥离 Anthropic fallbacks 字段
2026-09-01 17:47:34 +08:00
刘佳林
e377c4358c
feat(kimi): forward native OpenAI Responses API
...
Moonshot pay-as-you-go and Kimi For Coding both expose native
/v1/responses. Stop converting Kimi Responses traffic to Chat
Completions, and treat Kimi like DeepSeek for protocol selection while
keeping /v1/responses URL construction.
2026-09-01 16:50:04 +08:00
alfadb
200b1406d7
fix(gateway): strip Anthropic fallbacks unless server-side-fallback beta is present
...
Clients now send body.fallbacks; upstream rejects it without
anthropic-beta: server-side-fallback-2026-07-01. Mirror the
context_management sanitize so OAuth mimic / default API-key
beta paths no longer 400 with "fallbacks: Extra inputs are not permitted".
2026-09-01 14:23:33 +08:00
刘佳林
aa7a811e66
feat(groups): add deny-or-downgrade control for reasoning effort ceiling
...
OpenAI/Composite groups can now reject requests that exceed the max
reasoning effort instead of always rewriting them down to the ceiling.
Existing groups keep the previous auto-downgrade behavior.
2026-09-01 10:15:45 +08:00
Wesley Liddick
2ac784c51a
Merge pull request #6353 from feeeei/main
...
refactor(billing): 长上下文阶梯计价改为价格目录数据驱动
2026-09-01 09:32:06 +08:00
Wesley Liddick
6b39d0b453
Merge pull request #6379 from baryon/contrib/codex-priority-service-tier
...
fix(codex): advertise Fast service tier in generated catalogs
2026-09-01 09:02:24 +08:00
Wesley Liddick
f218c8d40a
Merge pull request #6394 from qiujun8023/fix/account-stats-deepseek-peak
...
fix(billing): apply model pricing policies to account stats cost
2026-09-01 08:58:49 +08:00
Wesley Liddick
1cce2b38ee
Merge pull request #6417 from fengshao1227/fix/ws-ingress-capacity-shed-client-code
...
fix(openai): ctx_pool WS ingress 下发前改写上游容量降载错误码(Codex 会话被硬终止)
2026-09-01 08:54:00 +08:00
Wesley Liddick
064d9b74e8
Merge pull request #6432 from okbexx/fix/codex-disabled-account-capabilities
...
fix(codex): ignore persistently disabled catalog accounts
2026-09-01 08:46:42 +08:00
Wesley Liddick
e87c47c957
Merge pull request #6435 from wucm667/fix/issue-6420-apikey-responses-instructions
...
fix(openai): avoid synthesized instructions for API keys
2026-09-01 08:45:58 +08:00
Wesley Liddick
bdedd6c544
Merge pull request #6433 from swjturay/codex/upstream-stale-ws-recycle
...
fix(openai-ws): recycle stale idle pool connections without reader liveness
2026-09-01 08:45:30 +08:00
Ritel-T
9908d3ca2f
Bill free Fast requests at Standard price
2026-09-01 04:34:24 +09:00
Ritel-T
e619ca386e
Carry free Fast through auth snapshots
2026-09-01 04:34:24 +09:00
Ritel-T
8224434d21
Preserve free Fast when duplicating groups
2026-09-01 04:34:24 +09:00
Ritel-T
fd55f3248f
Manage free Fast through group lifecycle
2026-09-01 04:34:24 +09:00
Ritel-T
fb409787c6
Persist the free Fast group policy
2026-09-01 04:34:24 +09:00
Ritel-T
0681aa2566
Cover Group Fast in native Responses
2026-09-01 04:34:06 +09:00
Ritel-T
f8eae45048
Force OpenAI Fast across gateway paths
2026-09-01 04:34:06 +09:00
Ritel-T
a44a1019f8
Carry group Fast through auth snapshots
2026-09-01 04:34:06 +09:00