1. 14 Apr, 2026 1 commit
    • sakurawztlt's avatar
      fix: Anthropic 非流式路径在上游终态事件 output 为空时从 delta 事件重建响应内容 · 777820c1
      sakurawztlt authored and 陈曦's avatar 陈曦 committed
      b2e379cf 引入的 BufferedResponseAccumulator 已修复了 chat_completions
      非流式路径和 responses OAuth 非流式路径,但遗漏了 Anthropic /v1/messages
      非流式路径 (handleAnthropicBufferedStreamingResponse)。
      
      当客户端请求 stream=false 且模型开启思考时,上游 response.completed
      终态事件的 output 字段可能为空,实际 message 内容通过
      response.output_text.delta 增量事件下发。旧代码只读终态事件的 Response,
      导致客户端收到的 content 字段为空 ([{"type":"text"}])。
      
      本 commit 将 b2e379cf 的相同修复模式镜像到 Anthropic 路径:在 SSE 扫描
      过程中用 BufferedResponseAccumulator 累积 delta 内容,终态 output 为空
      时通过 SupplementResponseOutput 补充重建。
      
      同时修复 handleAnthropicBufferedStreamingResponse 遗漏 response.done
      事件类型的问题,与 chat completions 路径保持一致,避免上游发送
      response.done 时 handler 认不出终态事件、最终返回 502 的潜在问题。
      
      BufferedResponseAccumulator 已在 chatcompletions_responses_test.go 有
      完整单元测试覆盖(TextOnly/ToolCalls/Reasoning/Mixed/SupplementEmpty/
      NoSupplementWhenOutputExists/EmptyDeltas/IgnoresNonFunctionCallItems),
      本次复用相同累加器无需新增测试。
      777820c1
  2. 09 Apr, 2026 1 commit
  3. 08 Apr, 2026 1 commit
  4. 07 Apr, 2026 1 commit
  5. 04 Apr, 2026 1 commit
  6. 03 Apr, 2026 2 commits
  7. 31 Mar, 2026 1 commit
  8. 29 Mar, 2026 1 commit
  9. 24 Mar, 2026 1 commit
  10. 17 Mar, 2026 1 commit
    • Ethan0x0000's avatar
      feat(service): record upstream model across all gateway paths · 2e4ac88a
      Ethan0x0000 authored
      Propagate UpstreamModel through ForwardResult and OpenAIForwardResult in Anthropic direct, API-key passthrough, Bedrock, and OpenAI gateway flows. Extract optionalNonEqualStringPtr and optionalTrimmedStringPtr into usage_log_helpers.go. Store upstream_model only when it differs from the requested model.
      
      Also introduces anthropicPassthroughForwardInput struct to reduce parameter count.
      2e4ac88a
  11. 16 Mar, 2026 1 commit
    • QTom's avatar
      fix(gateway): 防止 OpenAI Codex 跨用户串流 · ab4e8b2c
      QTom authored
      根因:多个用户共享同一 OAuth 账号时,conversation_id/session_id 头
      未做用户隔离,导致上游 chatgpt.com 将不同用户的请求关联到同一会话。
      
      HTTP SSE 修复:
      - 新增 isolateOpenAISessionID(apiKeyID, raw),将 API Key ID 混入
        session 标识符(xxhash),确保不同 Key 的用户产生不同上游会话
      - buildUpstreamRequest: OAuth 分支先 Del 客户端透传的 session 头,
        再用隔离值覆盖
      - buildUpstreamRequestOpenAIPassthrough: 透传路径同样隔离
      - ForwardAsAnthropic: Anthropic Messages 兼容路径同步修复
      - buildOpenAIWSHeaders: WS 路径的 OAuth session 头同步隔离
      ab4e8b2c
  12. 14 Mar, 2026 1 commit
  13. 11 Mar, 2026 1 commit
    • shaw's avatar
      refactor: 重构 Chat Completions 端点,采用类型安全的 Responses API 转换 · 9d814679
      shaw authored
      将 /v1/chat/completions 端点从 ResponseWriter 劫持模式重构为独立的
      类型安全转换路径,与 Anthropic Messages 端点架构对齐:
      
      - 在 apicompat 包新增 Chat Completions 完整类型定义和双向转换器
      - 新增 ForwardAsChatCompletions service 方法,走 Responses API 上游
      - Handler 改为独立的账号选择/failover 循环,不再劫持 Responses handler
      - 提取 handleCompatErrorResponse 为 Chat Completions 和 Messages 共用
      - 删除旧的 forwardChatCompletions 直传路径及相关死代码
      9d814679
  14. 09 Mar, 2026 5 commits
  15. 07 Mar, 2026 2 commits
  16. 06 Mar, 2026 4 commits