Commit Graph
8336 Commits
Author SHA1 Message Date
yan9651688 f2386f9b2d feat(model-plaza): add copy button for model IDs 2026-11-19 16:08:16 -08:00
William Drake e0328a62ac fix(antigravity): a bare 429 after the retry loop cools no account the loop skipped
(cherry picked from commit 3547841e4f33fe9c8c091f649730b286346c865b)
2026-11-19 12:59:41 -07:00
William Drake e7a556ff53 test(antigravity): a bare 429 after the retry loop cools no second account
(cherry picked from commit bfb89961cef3e7fee878c58220a1c1fd40f41b82)
2026-11-19 12:59:41 -07:00
William Drake 26b68da5c5 fix(antigravity): one request cools at most one account for a bare 429
A bare 429 (no ErrorInfo, no reset time) is also what Google sends for a
single request it will not serve. When it follows the request to another
account, the request is the likely cause: the loop still fails over, but
it no longer cools that account and logs bare_429_cooldown_skipped. An
account throttled for everyone is cooled by the next request that
reaches it first, as with the empty-stream rule (4ce6281f). 429s that
carry a reason or a reset time are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit dc2124e238e865db6bcc1b85e8fd235b56d9b1ab)
2026-11-19 12:59:41 -07:00
William Drake 747d228a21 test(antigravity): a bare 429 on several accounts is request-scoped
On 2026-11-16 one 1.8 MB gemini-4-argon-high request got Google's bare
429 ("Resource has been exhausted", no reason, no reset time) on four
accounts in a row while those accounts kept serving other requests. Each
account was cooled for the whole antigravity:gemini group, and a second
customer whose group held only those accounts got "No available
accounts" for a minute.

The request should cool only the first account; another request still
cools the next one, and a 429 with a reset time still cools every
account.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 8bee4caee6e9f60f43d4a2fec3abe792c78731e6)
2026-11-19 12:59:41 -07:00
AIBIN GEandclaude-mythos-5-2 2b67d1ede2 fix(gateway): reject request bodies whose duplicate fields disagree
A body such as {"model":"cheap",...,"model":"expensive"} was scheduled and
billed under the first model, while paths that decode and re-encode the
body forwarded the last one. gjson returns the first member with a name;
encoding/json keeps the last and matches struct fields case-insensitively.
The group allowlist already validates every model candidate, but billing
did not, and groups without an allowlist had no check at all.

RejectConflictingRequestFields runs on every gateway chain after the
allowlist and before the composite rewrite. It answers 400 when a
top-level JSON member, a member of the session object, or a multipart
model/session field is declared more than once with different values.
Repeated fields with identical values still pass, as they do in the
allowlist. Responses WebSocket frames apply the same rule to their model
candidates on the first frame and on later turns.

The source-level chain assertion in gateway_model_allowlist_test.go is
updated for the new middleware position.

Not covered: repeated non-model members inside WebSocket frames (an
existing test accepts a repeated previous_response_id there), and nested
objects other than session.

Refs: GHSA-p3r4-jcm3-2hph

Co-Authored-By: claude-mythos-5-2 <noreply@anthropic.com>
2026-11-20 04:00:28 +09:00
r266-tech 3e190f7e05 fix(typesafe): apply account model mapping to System One 2026-11-20 02:39:02 +08:00
wucm667 4480cd90a4 fix(openai): fail over upstream request timeouts 2026-11-19 23:45:59 +08:00
Anankke 3eca473aa1 Merge remote-tracking branch 'origin/main' into upstream/compaction-cache-ttl-5m 2026-11-19 01:53:19 -08:00
Anankke 2cf2c33226 Merge remote-tracking branch 'origin/main' into upstream/websearch-exa-provider 2026-11-19 01:52:18 -08:00
Anankke 6d4fcbad47 Merge remote-tracking branch 'origin/main' into upstream/bridge-web-search-sources 2026-11-19 01:51:05 -08:00
Daiyangcheng fec3de4a73 fix(gateway): resolve an issue where 'stop' and Kimi dynamic tool definitions were lost during protocol conversio 2026-11-19 16:23:51 +08:00
wucm667 92fd567a47 fix(grok): accept five edit sources and classify input errors 2026-11-19 15:47:59 +08:00
wucm667 155b83badb fix(i18n): clarify Ultra Fast service tier hints 2026-11-19 09:49:44 +08:00
wucm667 baf058f645 chore: sync upstream main for current validation 2026-11-19 09:49:44 +08:00
r266-tech 735bcb0573 fix(antigravity): preserve upstream Gemini SSE comment frames 2026-11-19 00:14:38 +08:00
alfadb 26e0be3392 fix(gateway): ensure DeepSeek Anthropic tool-use history carries thinking blocks
DeepSeek 官方 Anthropic 原生端点在 thinking 模式下要求工具续接请求把
assistant 历史里的 thinking 块完整回传;缺失时上游会按 tool-call ID 尝试
自动恢复,恢复失败返回 400:The content[].thinking in the thinking mode
must be passed back to the API。

本补位仅对 api.deepseek.com 账号(targetsDeepSeekAPIHost)且请求启用
thinking 时生效:给含 tool_use 但缺 thinking/redacted_thinking 的
assistant 消息在 content 首部插入单个空格占位的 thinking 块
(DeepSeek 可能把空串按缺失处理){"type":"thinking","thinking":" "}。
signature 可省略——官方文档说明 input 侧的 signature 不做校验。其他上游
与无需改动的请求体保持字节不变。
2026-11-18 21:00:32 +08:00
TeacherLi e2148a1813 fix(ops): weight average token rate by request duration 2026-11-18 08:25:44 +00:00
superman2003 75de2de480 fix(codex): preserve native audio input capabilities 2026-11-18 14:48:14 +08:00
superman2003 e52bc308bb fix(usage): record per-turn Responses reasoning effort 2026-11-18 14:30:09 +08:00
superman2003 e3872e1615 fix(openai): preserve VS Code IDE context in HTTP Responses 2026-11-18 14:05:43 +08:00
iam1maker 44db3dd72b fix(gemini): keep trailing parts out of the final tool-result turn
Clients legally send a user text message right after tool results (step
budget reminders, mid-turn steering, context-management notices). The
Chat Completions -> Responses -> Anthropic chain merges that text into the
same Anthropic user message as the tool_result blocks
(mergeConsecutiveMessages), and convertClaudeMessagesToGeminiContents maps
each Anthropic message 1:1 to one contents entry, so the final contents
entry ends with functionResponse parts followed by text.

Vertex rejects that shape with HTTP 400 "Requests ending with a model turn
are not supported.", even though the turn is a user turn. The same happens
when tool-result media is appended after the function responses for models
without multimodal function responses.

Split trailing non-functionResponse parts into their own trailing user
turn. Part order is preserved, only the turn boundary moves; Vertex accepts
the split form (verified against generateContent directly and through
/v1/chat/completions).
2026-11-18 13:38:31 +08:00
github-actions[bot] 2af3f1e15c chore: sync VERSION to 0.2.23 [skip ci] 2026-11-18 03:51:52 +00:00
Wesley Liddick 5af9afb588 Merge pull request #8920 from Wei-Shaw/fix/openai-stream-idle-failover-budget
fix(openai): bound pre-output idle failover to the first-output switch budget
v0.2.23
2026-11-18 11:40:09 +08:00
Wesley Liddick 2354c78288 Merge pull request #8174 from wucm667/fix/issue-8172-anthropic-cache-ttl
Preserve Anthropic cache creation TTL details
2026-11-18 11:39:55 +08:00
Wesley Liddick 19d4cb222a Merge pull request #8577 from WGeorgezzzz/fix/openai-stream-idle-timeout-failover
fix(openai): enforce stream idle deadlines and pre-output failover
2026-11-18 11:16:36 +08:00
wucm667 82395b0b5a test(usage): distinguish EOF before and after client output 2026-11-18 11:07:28 +08:00
XYZ0901 a4b72bef09 fix(admin): initialize default platform quotas for new users
AI-Co-Authored-By: Codex
2026-11-18 10:58:24 +08:00
shaw 29809eef09 fix(openai): bound pre-output idle failover to the first-output switch budget
The pre-output idle timeout failover did not set SafeToFailoverAfterWrite,
so it escaped maxOpenAIFirstOutputTimeoutSwitches and fell back to
max_account_switches (default 10). With the defaults (180s idle, first-output
timeout disabled) one stalled request could walk 11 accounts and apply
HandleStreamTimeout to each of them.

Mark the error like the other pre-output failovers in this function so it
shares the one-switch first-output budget. Only keepalive comments can have
reached the client at this point, which is exactly what the flag asserts.
2026-11-18 10:57:38 +08:00
Wesley Liddick 9e9ca6fe95 Merge pull request #8914 from r266-tech/codex/channel-ultrafast-pricing
fix(channels): support configurable Ultra Fast pricing
2026-11-18 10:40:58 +08:00
Wesley Liddick 4e10912b4e Merge pull request #8598 from lkon2112/fix/billing-heap-test
test(billing): reuse rate resolver and isolate heap checks
2026-11-18 10:40:41 +08:00
wucm667 23c3eb7f8b fix(usage): align cache usage across Anthropic conversion boundaries 2026-11-18 10:19:03 +08:00
wucm667 202e23b2b8 chore(build): upgrade Go toolchain to 1.27.4 2026-11-18 10:19:03 +08:00
Wesley Liddick 69d2fae913 Merge pull request #8903 from jianjianai/perf/openai-raw-chat-stream-flush
perf(openai): 原生 Chat Completions 流式透传在等待上游前才 flush
2026-11-18 09:07:48 +08:00
Wesley Liddick 45632495f5 Merge pull request #8904 from jianjianai/perf/openai-chat-reasoning-single-pass
perf(openai): DeepSeek reasoning 占位与 Ollama Cloud reasoning 回填改为单遍改写请求体
2026-11-18 09:07:36 +08:00
Wesley Liddick a4d3103cd5 Merge pull request #8906 from lyy0709/codex/gpt62-astra-sol
feat(openai): 接入 GPT-6.2 Sol 和 Astra
2026-11-18 09:01:08 +08:00
r266-tech b36cb244f3 fix(channels): support configurable Ultra Fast pricing 2026-11-18 07:05:45 +08:00
Echways 75290a9f26 fix(accounts): omit temperature from account tests for models that reject it
The Anthropic and Bedrock account test payloads always sent
temperature: 1, so testing claude-opus-4-8 failed with HTTP 400
("temperature is deprecated for this model") and a working account was
reported as broken.

Add claude.RejectsTemperature for Opus 4.7/4.8, Opus 5.5, Fable 5.2 and
Mythos 5.2, and skip the field for those models. Other models keep the
existing payload.

Fixes #8625
2026-11-17 23:08:42 +03:00
lyy0709 2d20707f16 fix(openai): honor GPT-6.2 Ultrafast entitlements by Pro plan 2026-11-18 03:53:56 +08:00
lyy0709 6107cf1748 feat(openai): support GPT-6.2 Sol and Astra 2026-11-18 03:09:38 +08:00
jianjianaiandClaude Opus 5.5 d867299264 perf(openai): DeepSeek reasoning 占位与 Ollama Cloud reasoning 回填改为单遍改写请求体
ensureDeepSeekChatReasoningPlaceholders 对每条缺 reasoning_content 的 assistant
消息调用一次 sjson.SetBytes,每次都复制整个请求体并从头定位路径,k 条消息、
请求体长 n 时是 O(k·n)。agent 对话里 assistant 消息常有几百条、请求体几百 KB
到数 MB,一个请求就要复制上百 MB。生产环境 60 秒 CPU profile 中该函数约占
网关 CPU 的 3%,是请求体处理里最大的单项。normalizeOllamaCloudChatCompletionsRequest
是同一写法。

新增 setStringFieldInJSONObjects:按 gjson 给出的元素偏移只复制一次请求体,
输出与逐条 sjson.SetBytes 逐字节相同(新增键的位置与逗号、已有键的替换、
字符串编码都按 sjson 的规则)。偏移无法可靠核对时返回 ok=false,调用方回退到
原来的逐条写法。

基准(300 轮 agent 对话,请求体约 1 MB):
  逐条 sjson:396 ms/op,514 MB/op
  单遍改写:  3.4 ms/op,2.4 MB/op

测试:固定用例(紧凑/带空白格式、已有空串/null/false 值、嵌套同名字段、重复键、
Unicode 与转义)和 300 个随机生成的请求体,均与逐条 sjson 的输出逐字节比对,
并断言走的是单遍路径;另测无法定位时拒绝改写。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 16:46:39 +00:00
jianjianaiandClaude Opus 5.5 2c67844964 perf(openai): 原生 Chat Completions 流式透传在等待上游前才 flush
streamRawChatCompletions 之前每写一行就 Flush 一次,包括事件之间的空行,
所以每个 SSE 事件至少两次写系统调用。生产环境 60 秒 CPU profile 中,这条
路径下的 Flush(含 chunked 编码与 write 系统调用)约占网关 CPU 的 8%。

改为把上游响应体包一层 flushBeforeUpstreamRead:bufio.Scanner 只有在缓冲里
没有完整行、要向上游读新数据时才调用 Read,就在这时 flush 已写出的内容。

- 已到达的事件仍在开始等待上游之前写给客户端,延迟不变
- data 行与事件间空行、同一次读取到达的多个事件合并成一次 flush
- 扫描、改写、计费、截断判定逻辑不变

测试:
- 一次读取到达 5 个事件:flush 从 10 次降到 1 次,输出逐字节不变
- 上游在客户端收到第一个事件前不再发送数据:第一个事件仍被及时 flush
  (若推迟到下一次读取之后才 flush,该用例会超时失败)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 16:34:49 +00:00
Ming-Sir-69 65be27787c feat(frontend): warn on frequent manual token refreshes
Manual refresh racing the single-use rotating refresh token (e.g. against
the background auto-refresh) can invalidate the grant and pause the
account. Surface this with a tooltip on the refresh action and a
non-blocking warning when the same account is refreshed again within a
minute; the action itself is never blocked.
2026-11-18 00:21:53 +08:00
stevelee477 f358f0a41a feat(accounts): estimate Claude OAuth and setup-token window costs 2026-11-17 23:10:31 +08:00
r266-tech 3b95559788 fix(accounts): opt in to bulk passthrough model filter changes 2026-11-17 21:46:58 +08:00
SipengXie2024 77ba3346d1 fix(openai): skip foreign-vendor models on ChatGPT OAuth accounts, passthrough included
Empty-mapping OpenAI OAuth accounts accepted claude-* models, and OAuth or
setup-token accounts with openai_passthrough accepted every model. Both send
requests to chatgpt.com/backend-api/codex, which answers foreign models with
a non-retryable 400 ("not supported when using Codex with a ChatGPT
account"), so mixed groups handed claude-* requests from Codex clients to
the OAuth account instead of the API-key account that serves them.

- Add "claude-" to openAIOAuthForeignModelPrefixes.
- Apply the foreign-prefix check to OAuth and setup-token passthrough too;
  API-key passthrough keeps allowing every model.
- Schedule /v1/messages by the channel-mapped model, as Responses, Chat
  Completions and the Responses WebSocket already do, so a channel mapping
  a claude-* alias to a GPT model still lands on OAuth accounts.
2026-11-17 09:50:16 +00:00
r266-tech 18c42a29d2 perf(scheduler): omit expanded groups from account cache 2026-11-17 16:50:37 +08:00
SipengXie2024 f66984fc5d fix(openai): keep relayed image usage on a single SSE data line
The Codex direct Images endpoints pretty-print their JSON. When a streaming
request gets a plain JSON answer, the usage object is copied verbatim into the
completed event, so its newlines split the SSE data payload. Strict SSE
clients then read a truncated JSON line and report no image even though the
event carries b64_json. Compact usage before embedding it.
2026-11-17 08:28:24 +00:00
wucm667 570d59e9ac fix(anthropic): expose metadata-backed long-context models 2026-11-17 15:13:03 +08:00
zhanghuaxiangandCursor bcb22d4de8 fix(openai): stop pinning large request bodies after the handler
Clone the few request-view strings that outlive the handler instead of aliasing the request body, drop the converted Responses input once it is marshaled, and avoid pointing usage logs at the forward input. Async prompt audit checks its scope before copying the body and no longer clones twice, splits and trims prompts without full []rune copies, and skips redaction rewrites that cannot match.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-17 11:28:53 +08:00