1. 23 Mar, 2026 1 commit
    • Ethan0x0000's avatar
      feat(service): add ForwardAsResponses/ForwardAsChatCompletions on GatewayService · 4321adab
      Ethan0x0000 authored
      New forwarding methods on GatewayService for Anthropic platform groups:
      
      - ForwardAsResponses: accept Responses body → convert to Anthropic →
        forward to upstream → convert response back to Responses format.
        Supports both streaming (SSE event-by-event conversion) and buffered
        (accumulate then convert) response modes.
      - ForwardAsChatCompletions: chain CC→Responses→Anthropic for request,
        Anthropic→Responses→CC for response. Streaming uses dual state machine
        chain with [DONE] marker.
      
      Both methods reuse existing GatewayService infrastructure:
      buildUpstreamRequest, Claude Code mimicry, cache control enforcement,
      model mapping, and return UpstreamFailoverError for handler-level retry.
      4321adab