IanShaw027
b61e4bcc45
fix: 对齐 JWT 常量 gofmt,并补全 available groups 契约字段
...
golangci-lint 要求 const 块按类型对齐;分组 DTO 新增
long_context_pricing_enabled 后,契约夹具未同步导致比较失败。
2026-08-13 08:55:56 +08:00
IanShaw027
363cc4994b
fix: SuperGrokPro 用 4.5 窗口区分 Heavy,容量抖动只封单模型
...
JWT 的 SuperGrokPro 同时覆盖 SuperGrok 与 Heavy,账单月额度又滞后,
账号会误升/误降。multi-agent 容量抖动还会把整号提出调度。
- CanonicalGrokPlan:明确 JWT 优先;模糊档仅采新鲜的 grok-4.5 Responses 窗口
- 配额快照写入 plan_from_45_responses 时间戳,过期信号不用
- engine_overloaded 对 multi-agent 只封当前模型 0.5s–5min
2026-08-13 07:49:14 +08:00
IanShaw027
a04ce49016
feat: 新增 grok-4.6 目录、官方定价与请求路径支持
...
官方目录价:<200k 为 $2 / 缓存读取 $0.50 / $6,≥200k 全部 2 倍。
原先没有独立价卡,/models 宣称可配 reasoning 但请求路径会剥掉 effort。
- 目录与别名接入 grok-4.6 / grok-4.6-latest,默认文本模型仍为 grok-4.5
- 独立回退价卡含缓存读取价与 200k 长上下文倍率
- 保留 reasoning_effort;Chat→Responses 的 cache/vision 桥接同样识别 4.6
2026-08-13 01:23:45 +08:00
IanShaw027
bb9e74285e
feat: 从 JWT tier 识别 Grok 订阅档位,刷新后覆盖失效订阅
...
Grok Build access token 带有数字 tier claim(0=free、1=supergrok、5=heavy、6=lite),
原先只解 email/sub/team_id,refresh 还会把旧档位抄回去,订阅失效后一直显示 Heavy。
- 解码 JWT tier,并归一化 display / header 别名(含 free-tier、SuperGrok Lite)
- 仅从 access token 读取档位;新 JWT 覆盖已存凭证,AT 无 claim 时保留旧值
- 用量与 free-cache 判定以当前 AT 为准,账单月额度仅作降级
2026-08-13 01:23:37 +08:00
IanShaw027
7eb1310701
fix(grok): close free-by-default billing and related review blockers
...
H1/H2: bill search and voice with code defaults when group prices are
nil (explicit 0 remains free); bump API key auth snapshot to v19 and
refresh incomplete media/search/audio projections.
M1–M6: free-quota soft gate fails open on cache miss with background
refresh and 60s default TTL; correct password_auth config docs; default
cross-client model map to true (→ grok-4.5); audit /tts and /web_search;
exclude composite from migration 220 video-price clears; never let a
search surcharge mask token pricing failures.
2026-08-08 14:39:22 +08:00
IanShaw027
165b072908
fix(grok): gateway media/voice routing, models, and status UI polish
...
Align gateway Grok media/voice paths and model lists, harden upstream failure
and quota handling, clear non-Grok video generation config migration, and polish
temp-unsched/status indicators with model whitelist updates.
2026-08-08 01:07:27 +08:00
IanShaw027
6d632eec45
fix(grok): tighten OAuth SSO flow and hide password login
...
Require oauth state/redirect consistency, fail closed on missing proxy,
and remove password login from create/reauth UI (admin-only password path stays off by default).
2026-08-08 01:07:19 +08:00
IanShaw027
72a56f862c
fix(grok): free 500k + 对齐 personal-dev tier/时间窗
...
- soft-gate 默认额度 500k tokens / 滚动 24h / 95%(门禁 475k)
- soft-gate 仅显式 free OAuth(subscription_tier/plan_type == free)
- isKnownGrokFreeAccount 按 personal-dev(usage% 为 paid 证据、仅 credentials tier)
- 调度阈值仅 grok_sched header quota 窗,去掉 billing 7d/30d 候选
2026-08-07 18:52:53 +08:00
IanShaw027
d7c9e7167b
fix(grok): 三轮评审 — 流式 Search 去重与调度/计费加固
...
- P0: 直播 SSE SearchCount 跨事件 call_id 去重,避免 ~2× 附加费
- SearchCount/Audio/WebSearchCalls 走 mandatory usage task
- web_search:uuid 等 forced request_id 优先于 client/local
- Sanitize 始终剥离 cookie;ApplyOAuth 清 grok_needs_reauth_at
- free 判定:paid 证据压过陈旧 free 凭据
- Gateway 列表应用 free soft-gate;token/body-read 可 failover
- web_search 重试支持 WaitPlan 获取;周 PeriodEnd 不再回填月 end
2026-08-07 17:58:23 +08:00
IanShaw027
a3aae134ee
fix(grok): 加固 SSO 凭证与 Cookie 隔离
2026-08-07 16:34:47 +08:00
IanShaw027
25d2b03e90
fix(grok): 加固 OAuth 会话共享与一次性消费
2026-08-07 16:29:48 +08:00
IanShaw027
79df1647d4
feat(grok): 账单绝对金额、调度阈值 UI、搜索/Voice 计费与 /v1/web_search
...
- BillingSummary 输出 prepaid/monthly_used/on_demand 绝对金额,并映射官方 7d/30d 进度条
- 账号编辑页支持 credentials.account_scheduling_threshold 覆盖;Settings 文案细化
- groups.search_price_per_1k + 管理端/缓存全链路;SearchCount/AudioUsage 请求级计费
- Voice TTS/STT/Realtime 成功路径 RecordUsage;独立 /v1/web_search 原生 Grok 搜索
2026-08-07 15:52:55 +08:00
IanShaw027
7c62382d04
feat(grok): 吸收调度阈值、配额解析、批量用量与 CLI 身份
...
从 personal-dev 取优并接线到 feat/grok-complete-integration:
- 调度阈值:grok_sched_* 写入、ApplyAccountSchedulingThreshold、
account_scheduling_thresholds 设置与 Settings UI、网关过滤
- 配额头:x-rate-limit 别名、相对秒 reset、tier/entitlement 扩展
- 批量 usage:GetUsageBatch + POST /usage/batch + AccountsView 合并加载
- CLI 身份:xai.cli_identity 统一 pin/UA;service 层 applyGrokCLIHeaders
与 transport 最终改写对齐;media eligibility 模块落地
- UsageCell:月度 cents→USD 与 30d 进度条展示
保留既有 failure taxonomy / sticky / free recovery 等 HEAD cools。
2026-08-07 14:53:18 +08:00
IanShaw027
0316994c52
fix(grok): 修正授权与模型映射边界
2026-08-07 14:50:02 +08:00
IanShaw027
2c8836e40b
fix(grok): 完善按模型视频价格矩阵
2026-08-07 14:42:00 +08:00
IanShaw027
cda6de44da
fix(grok): 运行时映射设置即时失效账号缓存
2026-08-07 13:59:32 +08:00
IanShaw027
eb6c9663e7
feat(grok): 视频按模型族配置每秒单价,并补齐管理端映射设置
...
分组新增 video_model_prices(JSONB);计费优先模型×分辨率覆盖,
其次旧分辨率三列,最后官方按模型族默认价。同步补齐 admin 设置
中的 grok_default_text_model / 跨客户端映射开关,并保持
grok-imagine-video-1.5 请求模型 identity 不被静默改写。
2026-08-07 12:44:08 +08:00
IanShaw027
74249b8fed
feat(grok): 模型目录与可配置映射,默认禁止跨厂商暗默改写
...
补齐 Grok/Imagine 官方模型与别名,并支持运行时默认文本模型。
默认 model_mapping 仅含 Grok 家族;新增 grok_default_text_model 与
grok_cross_client_model_map_enabled,仅在显式开启时将 gpt/claude/codex
等客户端模型名映射到默认文本模型,避免非 Grok 请求被静默改成 grok-4.5。
2026-08-07 12:31:14 +08:00
Wesley Liddick
770e35b474
Merge pull request #5040 from coo1white/upstream-pr/grok-cli-0.2.114
...
fix(grok): bump pinned Grok CLI version to 0.2.114
2026-08-04 16:16:20 +08:00
shaw
017f6bbd5e
fix(gateway): 收紧上游 URL 路径片段校验
...
网关有若干位置会把客户端可控的字符串拼进上游请求的 URL path(Responses
子路径、Gemini 模型名)。此前这些字符串未经校验直接参与拼接,可能改变上游
请求的路径结构,使实际发出的请求与客户端意图不一致。
- 新增 internal/service/upstream_path_guard.go:路径片段闭集允许清单
(\w + `-` + `.`),拒绝空片段、纯点片段、超长片段与过深后缀
- /responses/*subpath 三条路由入口新增守卫,不可转发的子路径直接 404;
service 层同时保证不产出不合规后缀,拼接函数再兜底一层
- Gemini AI Studio 原先 5 处重复的 URL 拼接收敛为唯一构造点
buildGeminiAIStudioModelActionURL(校验模型片段 + action 白名单)
- Gemini native / GetModel handler 增加入口校验;ForwardAIStudioGET 逐片段校验
- Grok video 端点的 request_id 增加片段合规校验
合法子路径(/compact、/compact/detail、/{id}/cancel 形态)与既有模型名行为
不变,通配路由保留。
2026-07-31 16:11:45 +08:00
Nick and Claude Opus 5
b74cb7891c
fix(grok): bump pinned Grok CLI version to 0.2.114
...
`cli-chat-proxy.grok.com` turns away requests that do not name a
supported client version — the failure mode #3952 was opened for. The
pin has sat at 0.2.93 since 2026-07-17, while https://x.ai/cli/stable
and `npm view @xai-official/grok version` both report 0.2.114.
The version was written out in three places, which is how they came to
drift:
- `repository/http_upstream.go` (OAuth traffic through the CLI proxy)
- `pkg/xai/billing.go` (billing and quota probes)
- `service/openai_gateway_grok.go` (gateway request headers)
`xai.CLIClientVersion` is now the single source, and the other two build
their own client identity from it, so the next bump is one line.
`internal/pkg/xai` is a leaf package both layers already import, so this
adds no cycle. `CLIUserAgent` derives from the same constant.
Checked against the real 0.2.114 binary rather than the version feed
alone: the `x-grok-client-version` header name, the `xai-grok-cli`
token-auth value, and the version string all match what the CLI sends.
The pinned value is also the floor an operator override must clear, so
some fixtures carried a meaning relative to it rather than a fixed
number. Those were moved, not search-and-replaced:
- the "valid override" case now uses 0.2.115-alpha.1; at 0.2.95-alpha.1
it would fall below the new floor, be dropped, and stop testing
acceptance at all
- the prerelease-at-the-minimum case tracks the pin to 0.2.114-beta.1,
or it becomes a copy of the below-minimum case
- three of the five malformed-semver entries sat below the new floor and
would have been turned away for being old, not for being malformed
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com >
2026-07-29 13:31:18 +07:00
superman2003
d2753dc2e2
fix(grok): serve current free quota policy
2026-07-19 12:17:52 +08:00
Heatherm Huang
8bc0a277f2
fix(grok): quarantine ineligible media accounts
2026-07-17 11:51:16 +08:00
shaw
7f5d067af2
feat(grok): 支持上游端点手动切换与快捷端点,修复 SSO 建号自定义地址被覆盖
...
官方端点(api.x.ai / cli-chat-proxy.grok.com)偶发不可用,运营方需要在
端点间手动切换。旧语义把 OAuth 账号存储的官方 host 一律视同"未定制"并
回落默认 CLI 网关:填了官方地址保存成功却不生效、重新编辑开关回到关闭、
再次保存直接删值,形成"修改不生效"的静默循环。
后端:
- GetGrokBaseURL OAuth 分支改为"存了什么用什么":官方 API / 区域 API /
第三方转发地址一律按填写值转发与探测,仅空值或无法解析的脏数据回落
默认 CLI 网关;删除官方变体运行时迁移逻辑
- *.api.x.ai 区域端点(us-east-1/us-west-2/eu-west-1 等)纳入可信 host,
OAuth 使用时不受运营方 URL 白名单限制,官方 host 仍强制 /v1 path
- 修复 SSO 批量建号 MergeCredentials 方向缺陷:BuildAccountCredentials
恒写官方 base_url,会覆盖导入请求指定的自定义转发地址;抽出
grokSSOImportCredentials 显式保留请求值(与 RefreshAccountToken 对齐)
前端:
- isCustomGrokBaseUrl 仅默认 CLI 网关 host 视同未定制:api.x.ai 与区域
端点保存后正常回显(开关开启 + 显示地址),不再被静默吞掉
- 新增 GrokBaseUrlPresets 快捷端点组件(Grok Build CLI / 官方 API /
us-east-1 / us-west-2 / eu-west-1),接入编辑(OAuth 自定义区 + apikey
Base URL)、新增(同前)与批量编辑(所选平台全为 grok 时显示,点击
自动勾选 base_url);仅快速填充,输入框仍可自由填写任意第三方地址
2026-07-16 19:10:21 +08:00
shaw
221581400b
feat(grok): 支持账号级自定义上游地址与请求头覆写
...
将账号级请求头覆写从 anthropic/openai 的 api_key 账号扩展到 Grok 的
api_key 与 oauth 账号,并放开 Grok OAuth 账号的自定义上游地址(仅作用于
转发端点,授权与 token 刷新链路不变)。
后端:
- IsHeaderOverrideEligible 扩展到 Grok(api_key+oauth),禁止名单新增
x-grok-conv-id(逐请求会话路由头)。
- 所有 Grok 上游请求路径接线 ApplyHeaderOverrides(Responses/Chat 桥/
媒体/配额探测/billing 探测/连通性测试),统一置于内置默认头之后。
- GetGrokBaseURL/GetGrokMediaBaseURL 放开 OAuth 自定义地址:官方地址
视同未定制回落官方网关,仅显式第三方 host 改发转发流量。
- 非官方 host 允许任意 path 前缀,官方 host 仍强制 /v1。
- OAuth base_url 校验按 host 判定官方/自定义,自定义 host 恒受运营方
URL 策略约束,不受 XAI_ALLOW_UNSAFE_URL_OVERRIDES 调试开关放宽。
- 给 GrokQuotaService 注入 config,使配额/billing 探测与转发共用同一
URL 策略。
前端:
- Edit 模态为 Grok OAuth 账号新增「自定义上游地址」开关。
- 请求头表单新增 JSON 快速导入与按 JSON 一键复制(复用 useClipboard,
兼容非安全上下文 HTTP 页面)。
- 门控改为平台×类型判定,Bulk 批量 base_url 增加格式校验,zh/en 文案同步。
2026-07-15 20:30:23 +08:00
王鹏
e8e360c802
fix(xai): reject unsafe base URL components
2026-07-15 12:50:15 +08:00
Heatherm Huang
b32b815e46
fix(grok): harden OAuth pool recovery
2026-07-14 14:55:30 +08:00
shaw
d41a10111d
Merge remote-tracking branch 'origin/main' into feat/grok-sso-device-oauth
...
# Conflicts:
# frontend/src/api/admin/grok.ts
2026-07-14 10:19:16 +08:00
jinfeijie bot
ad4bf5c60d
feat(grok): 支持 Web SSO 批量导入并转换为 Build OAuth
...
新增 Grok Web SSO → xAI Device Flow → Grok Build OAuth 导入链路,
支持管理员批量粘贴 SSO key 创建 OAuth 账号。
- 后端:ConvertSSOToBuild、ConvertFromSSO、POST /admin/grok/sso-to-oauth
- 批量:3 worker 并发,失败跳过并汇总 created/failed,worker panic recover
- 无 refresh_token 时写入 expires_at 并强制 auto_pause_on_expired
- 前端:SSO Cookie 导入入口、动态超时、中英文案、部分成功不关弹窗
- 测试:pkg/service/handler/前端超时单测;本地 Docker 真实 SSO e2e 通过
2026-07-14 01:09:07 +08:00
superman2003
c896cacf6d
feat(grok): improve free quota probing and usage
2026-07-13 19:49:56 +08:00
Heatherm Huang
bc5d6ecb46
fix(grok): allow third-party API base URLs
2026-07-13 15:27:57 +08:00
chenjian
909b96edd2
feat: support Grok video edits and extensions
2026-07-13 10:50:42 +08:00
Heatherm Huang
1a0a6ea9a8
fix: stabilize Grok quota probe model
2026-07-09 17:58:31 +08:00
Heatherm Huang
cccba9a82e
Add official Grok 4.5 support
2026-07-09 14:26:10 +08:00
Heatherm Huang
c34db70a88
fix: bridge grok composer image inputs
2026-07-07 10:55:07 +08:00
Heatherm Huang
c3e860607d
fix: include official grok media model ids
2026-07-01 11:43:35 +08:00
Heatherm Huang
2fe756e4be
fix: recognize grok media models
2026-07-01 11:43:35 +08:00
Heatherm Huang
3b5d812f7a
fix: route grok media endpoints
2026-07-01 11:43:35 +08:00
Heatherm Huang
720db8983f
test: harden grok quota readiness
2026-06-26 10:42:21 +08:00
Heatherm Huang
0d28642181
feat: add grok quota probe parity
2026-06-26 10:37:37 +08:00
Heatherm Huang
f29ccc7dfb
fix: reduce grok oauth account-risk paths
2026-06-26 10:36:09 +08:00
Heatherm Huang
b3a07aeae7
fix: align grok oauth exchange with xai
2026-06-26 10:36:09 +08:00
Heatherm Huang
39be1ec97f
feat: add grok subscription support
2026-06-26 10:36:09 +08:00