Wesley Liddick
b73d8c3efe
Merge pull request #4009 from heathermhuang/codex/fix-recent-grok-issues
...
fix: expand Grok API, CLI, billing, and setup support
2026-07-13 10:36:11 +08:00
shaw
e5af699d0f
test(contract): groups/available 契约夹具补 web_search_price_per_call 字段
2026-07-13 10:21:44 +08:00
Heatherm Huang
f73031f436
test(grok): align scheduling reasons with upstream
2026-07-13 10:21:34 +08:00
shaw
64a2a31729
fix(billing): 修复复审发现的三处按次计费问题
...
- HIGH: GetByKeyForAuth 的 WithGroup 显式 Select 补 web_search_price_per_call 列,
否则 auth 快照里分组覆盖价恒为 nil,覆盖价/免费配置在实际计费中静默失效
- MEDIUM: 按次搜索倍率改用不含高峰因子的基础倍率(与 image/video 按次不变式
及分组表单价格预览承诺一致),calculateOpenAIRecordUsageCost 新增独立倍率参数
- LOW: 计费门槛从 <400 收紧为严格 2xx,1xx/3xx 透传不计费
2026-07-13 10:14:53 +08:00
Heatherm Huang
8a22dc7347
fix(grok): diagnose unavailable models by platform
2026-07-13 10:11:34 +08:00
Heatherm Huang
aeb34d2003
fix(grok): sanitize composer reasoning parameters
2026-07-13 10:11:33 +08:00
Heatherm Huang
c4ff604e93
test(grok): cover OAuth chat permission identity
2026-07-13 10:11:33 +08:00
Heatherm Huang
ce3f12bbff
test(grok): cover CLI identity at transport boundary
2026-07-13 10:11:33 +08:00
Heatherm Huang
f187f08ae3
fix(grok): harden OAuth routing and CLI version guard
2026-07-13 10:11:33 +08:00
Heatherm Huang
3375b4ed2b
fix(grok): route OAuth subscriptions through CLI proxy
2026-07-13 10:11:33 +08:00
Heatherm Huang
d9e466ad3a
feat(grok): support xAI API key accounts
...
Allow Grok API-key accounts in Responses forwarding and connection tests, expose creation and edit defaults in the dashboard, and document the supported setup.
2026-07-13 10:11:33 +08:00
Heatherm Huang
038b25c0b1
fix(grok): resolve recent integration issues
2026-07-13 10:09:53 +08:00
shaw
7cbb36f278
feat(billing): Codex alpha/search 网页搜索按次计费
...
- alpha/search 成功请求(上游 2xx)按次计费落 usage_logs(billing_mode=per_request),
上游错误透传/failover 不计费;使用 mandatory 池提交,池满同步兜底不丢扣费
- 单价默认 0.01 USD/次(官方 $10/1000 次),分组新增 web_search_price_per_call
覆盖价(0=免费,负数/留空=默认价),实际扣费叠加分组费率倍数(与 token 口径一致)
- 分组字段全链路:ent schema + 迁移 174 + 端口快照 v15 + admin 创建/更新 + DTO
- 前端分组表单(openai 平台)新增单次价格配置,实时预览应用当前倍率后的单次价格
- 该端点鉴权维持仅 OpenAI 分组(非 OpenAI 分组 404)
2026-07-13 09:54:51 +08:00
shaw
8d51364c3d
Merge remote-tracking branch 'origin/main' into feat/grok-prompt-cache-identity
...
# Conflicts:
# backend/internal/handler/endpoint.go
# backend/internal/service/openai_gateway_grok_test.go
2026-07-13 09:12:44 +08:00
Wesley Liddick
33b1d772f7
Merge pull request #4063 from yardbirds0/fix/codex-alpha-search
...
fix: 转发 Codex alpha/search 独立搜索端点
2026-07-13 08:58:01 +08:00
Wesley Liddick
1c214eaca4
Merge pull request #4059 from visa2/fix/openai-messages-codex-identity
...
fix(openai): restore Codex identity headers for OAuth Messages
2026-07-13 08:56:21 +08:00
Wesley Liddick
841481e051
Merge pull request #3971 from yardbirds0/codex/fix-remote-compaction-v2
...
fix: 保留 remote_compaction_v2 原生 Responses 请求链路
2026-07-13 08:54:53 +08:00
Wesley Liddick
2f4478fd32
Merge pull request #4019 from wucm667/fix/compact-keepalive-writer-nil-guard
...
fix(service): 补齐 compact keepalive writer nil 守卫
2026-07-13 08:54:31 +08:00
Wesley Liddick
877bee84a1
Merge pull request #4072 from jianjianai/codex/fix-upstream-review
...
修复 tool_search 参数解析与 compact writer 生命周期
2026-07-13 08:54:15 +08:00
superman2003
7050070aa3
fix(grok): route cacheable chat requests via responses
2026-07-12 11:50:56 +08:00
jjaw
f57d06d959
合并 compact writer 修复
2026-07-12 04:53:55 +08:00
jjaw
06af8115f7
修复 compact 心跳 writer 生命周期
2026-07-12 04:53:41 +08:00
jjaw
5015b7a1c1
修复 tool_search 参数对象反序列化
2026-07-12 04:53:34 +08:00
visa2
d5b47c2142
fix(openai): restore Codex identity for OAuth Messages
2026-07-11 20:47:52 +08:00
superman2003
1dedb2097d
fix(grok): persist quota exhaustion as rate limit
2026-07-11 20:41:32 +08:00
Tian Lee
52071d391b
fix(openai): 转发 Codex alpha/search 独立搜索端点
2026-07-11 20:31:33 +08:00
superman2003
0478fd3668
feat(grok): enable free OAuth prompt caching
2026-07-11 19:34:01 +08:00
Tian Lee
84bb7d0709
fix: 保留 remote_compaction_v2 原生 Responses 链路
2026-07-11 12:51:53 +08:00
wucm667
6e2bb31281
fix(service): guard compact keepalive writer delegates
2026-07-11 08:52:46 +08:00
wucm667 and Claude Opus 4.8
4d4ba64bf7
fix(codex): 剥离续链 message item 的非法 item_* id
...
OpenAI OAuth 转发续链请求时,type=message 的 item 的 id 被客户端以
item_* 形式回放,但上游要求以 msg 开头,返回 400
"Expected an ID that begins with 'msg'",sub2api 随后向客户端返回 502。
客户端自动重试会不断重放同一份坏上下文,导致连续失败。
filterCodexInputWithOptions 在 PreserveReferences=true 路径下为
type=message 增加与 #3785 (fd64d07e6 ) 平行的 id 前缀检查:非 msg 开头
即删除。合法的 msg* id 原样保留,不改写 item_* 为 msg_*,因为改写出的
id 未必对应真实上游对象。
原 TestFilterCodexInput_NonToolCallItemKeepsID 以 message + item_msg_001
断言"保留 id",该行为已被上游拒绝,改用 web_search_call 覆盖同一意图。
Fixes #3981
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com >
2026-07-10 23:32:34 +08:00
Wesley Liddick
e316ebf528
Merge pull request #3989 from xlplbo/fix/codex-mcp-tools-bridge
...
fix(apicompat): 补齐 Codex 0.14x 工具链经 chat 回退桥的转换(custom/tool_search/namespace)
2026-07-10 22:09:25 +08:00
Wesley Liddick
07fac34713
Merge pull request #3991 from fengshao1227/fix/anthropic-usage-cache-creation-tokens
...
fix(apicompat): Responses↔Anthropic 转换补齐 cache_creation_input_tokens
2026-07-10 21:49:29 +08:00
Wesley Liddick
151b9265fc
Merge pull request #3994 from fengshao1227/fix/compact-keepalive-nil-pointer
...
fix(handler): opsCaptureWriter 释放后 nil pointer panic
2026-07-10 21:49:07 +08:00
github-actions[bot]
6c588bb950
chore: sync VERSION to 0.1.151 [skip ci]
2026-07-10 13:24:13 +00:00
xlplbo and Claude Fable 5
90e9d03dec
fix(apicompat): 强制选择 tool_search 的 tool_choice 降级为指向代理的 function 选择
...
tool_search 工具未被丢弃而是降级为同名 function 代理,此前 tool_choice 过滤
把它连同其他服务端工具类型一起静默丢弃,强制工具搜索被退化为自动选择,
违反调用方明确指定的工具选择语义。改为映射到指向代理的 function 选择;
未声明 type=tool_search 时无可指向的代理,维持丢弃。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01NWQyEgFKKbdve67G6qCoAU
2026-07-10 21:14:33 +08:00
xlplbo and Claude Fable 5
e2b68d1f90
fix(apicompat): tool_choice 仅转发实际存在于转换结果中的工具
...
此前只检查转换后是否还剩任意工具,不校验 tool_choice 指向的工具是否幸存:
强制选择被丢弃的服务端工具(如 web_search)或指向不存在名字时,选择项被
原样转发,chat 上游因 tool_choice 指向未声明工具而 400。改为具名选择项仅
在目标存在于转换后工具集时转发,服务端工具类选择项随工具本身丢弃;
"auto" 等字符串形式保持原样转发。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01NWQyEgFKKbdve67G6qCoAU
2026-07-10 21:06:45 +08:00
xlplbo and Claude Fable 5
a2cdaa6419
fix(apicompat): 内置 tool_search 与同名工具撞名时显式拒绝请求
...
tool_search 服务端工具降级后的代理 function 不能改名(codex 的模型侧按
tool_search 这个名字调用),与客户端声明的同名 function/custom 工具无法
区分:去程产生重复声明,回程会把普通工具的调用劫持还原成 tool_search_call。
与 namespace 摊平撞名的处理一致,在请求转换阶段显式报错(网关 400);
重复声明 type=tool_search 去重后只产出一个代理,不拒绝。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01NWQyEgFKKbdve67G6qCoAU
2026-07-10 21:06:26 +08:00
li
bc3cb29027
fix(handler): 补齐 opsCaptureWriter 全部委托方法的 nil 守卫
2026-07-10 21:03:40 +08:00
li
89a551b964
fix(handler): opsCaptureWriter 释放后访问 nil panic
...
Fixes #3961
2026-07-10 20:56:31 +08:00
li
83f169e4fa
fix(apicompat): 补齐 Responses→Anthropic 流式路径的 cache_creation_input_tokens
2026-07-10 20:49:44 +08:00
xlplbo
eb4d005031
Merge remote-tracking branch 'upstream/main'
2026-07-10 20:46:38 +08:00
li
0d28f7f90d
fix(apicompat): Responses↔Anthropic 转换补齐 cache_creation_input_tokens
...
Fixes #3935
2026-07-10 20:40:45 +08:00
shaw
8a51119e39
fix(openai): pair originator with final User-Agent for codex upstream
...
上游 /backend-api/codex 的 404 gating 是配套校验:originator 必须与
User-Agent 首段(首个 '/' 前的 client 名)配套且为官方 codex 身份,
错配(如 originator=codex_cli_rs + UA=codex-tui/...)一律 404;version
头若携带须 >= 0.144.0。
修复:
- pkg/openai 新增 PairCodexClientIdentity:由最终出站 UA 推导配套
originator(含 CODEX_INTERNAL_ORIGINATOR_OVERRIDE 尾部括号组身份恢复、
精确集合大小写归一、长度/字符集校验)
- service 新增 enforceCodexIdentityHeaders 终态收口:originator 按最终
UA 重配,推导不出官方身份整体回退默认 Codex CLI 身份;version 低于
0.144.0 提升为内置版本;originator 缺失时 no-op(保护 messages bridge)
- 接入非透传/透传/WS 三条转发路径(透传与 WS 删除会把 codex-tui 等官方
UA 强改为 codex_cli_rs 造成错配的旧兜底)、用量探针(指纹缓存 UA 与硬
编码 originator 错配)、账号 responses/图像测试(opencode 错配)
- messages 兼容桥构建前显式打 bridge 标记,防止映射到非 gpt-5/codex
模型时收口误改其刻意最小化的请求形态
Fixes #3901
2026-07-10 19:11:26 +08:00
xlplbo and Claude Fable 5
f1082bb78f
fix(apicompat): namespace 摊平名撞名时显式拒绝请求
...
摊平名与顶层 function/custom 工具撞名、或跨 namespace 摊平出同名时,
chat 上游无法按 namespace 区分调用归属:此前重复声明照发上游、回程
固定命中其中一条映射,调用可能被还原到错误工具。这类请求在原生
Responses 上游合法,歧义由摊平转换制造且不可消除,改为在请求转换
阶段直接报错(网关返回 400 invalid_request_error 并点名冲突双方);
同一 (namespace, 子工具) 的重复声明去重后不拒绝。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01NWQyEgFKKbdve67G6qCoAU
2026-07-10 17:38:48 +08:00
xlplbo and Claude Fable 5
7942338328
fix(apicompat): 回程还原 namespace 子工具调用,修复 Codex MCP 工具 unsupported call
...
Codex 0.14x 将 MCP 工具声明为 namespace 工具,chat 桥去程摊平为
"<namespace>__<name>" function 工具后,回程仅原样回传平铺名的
function_call 项;codex 按 namespace+name 路由查不到该名字,所有
MCP 工具调用被判为 unsupported call。
- NamespaceToolNames 构建摊平名 →(namespace, 子工具名)反查表
(摊平名超长带截断哈希,无法按字符串切分还原)
- 非流式/流式回程命中映射时还原为裸子工具名 + namespace 字段,
ResponsesOutput 新增 Namespace 字段并同步 wire 层白名单
- 回退桥入口将映射与 CustomTools/ToolSearchDeclared 一并穿入
已在测试机经 codex exec + MCP server 端到端验证。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01NWQyEgFKKbdve67G6qCoAU
2026-07-10 17:38:17 +08:00
Wesley Liddick
5260a42a0b
Merge pull request #3953 from lyon-le/feat/openai-fast-policy-user-scope
...
feat(openai): 支持用户级 Fast/Flex 策略
2026-07-10 17:31:55 +08:00
Wesley Liddick
815516d8d3
Merge pull request #3969 from jinfeijie/fix/grok-responses-reasoning-effort
...
fix(grok): preserve compatible reasoning effort
2026-07-10 17:31:41 +08:00
jinfeijie bot
5a0dd510e5
fix(grok): remove obsolete helper
2026-07-10 17:11:04 +08:00
jinfeijie bot
0fa1eb85ec
fix(grok): preserve compatible reasoning effort
2026-07-10 16:58:17 +08:00
Wesley Liddick
6dd3274aaf
Merge pull request #3948 from superman2003/fix/gpt56-billing-usage-integrity
...
fix(openai): correct GPT-5.6 billing and usage gaps
2026-07-10 15:45:18 +08:00