Skip to content

openai-compatibility 上游请求 60s 硬超时返回 500,长响应被截断 #2144

@adminwdsj

Description

@adminwdsj

描述

通过 openai-compatibility 配置的上游(如 NVIDIA API),当模型响应时间超过 60s 时,
CLIProxyAPI 直接返回 HTTP 500,请求被截断。

复现场景

  • 配置了 NVIDIA moonshotai/kimi-k2-instruct-0905 作为 openai-compatibility 上游
  • 客户端(Chrome 扩展 / cursor2api)发起 non-streaming 请求
  • 上游模型推理耗时 > 60s 时,CLIProxyAPI 主动断开连接返回 500

部分请求耗时超过 1 分钟时会被强制中断。

期望行为

建议

参考 #2060 的思路,在 openai-compatibility 的配置中也支持 response-header-timeout 字段:

openai-compatibility:
- name: NVIDIA
  base-url: https://integrate.api.nvidia.com/v1
  response-header-timeout: 300  # 等待上游首字节的超时
  api-key-entries:
    - api-key: nvapi-xxx

#2060 的 `response-header-timeout` 应该也覆盖 `openai-compatibility` provider,不只是 `claude-api-key`。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions