fix: Codex 端点 URL 使用 /responses 而非 /v1/responses

Codex OAuth 端点(chatgpt.com/backend-api/codex)不走标准 /v1 前缀,之前 build_provider_url() 统一使用 /v1/responses 导致 404 错误。

修改内容:
- transport.py: build_provider_url() 对 Codex URL 做特判,使用 /responses
- EndpointFormDialog.vue: placeholder 对 Codex 端点显示正确路径
- guide-config.ts: 文档说明两种路径格式
This commit is contained in:
AAEE86
2026-02-05 09:48:37 +08:00
parent 9c19a72d67
commit fecf48e180
3 changed files with 31 additions and 5 deletions

View File

@@ -146,6 +146,10 @@ def build_provider_url(
else:
# 使用 API 格式的默认路径
path = _resolve_default_path(endpoint_sig)
# Codex OAuth 端点chatgpt.com/backend-api/codex使用 /responses 而非 /v1/responses
base_url = getattr(endpoint, "base_url", "") or ""
if endpoint_sig == "openai:cli" and _is_codex_url(base_url):
path = "/responses"
if effective_path_params:
try:
path = path.format(**effective_path_params)
@@ -191,6 +195,15 @@ def _resolve_default_path(endpoint_sig: str | None) -> str:
return "/"
def _is_codex_url(base_url: str) -> bool:
"""判断是否是 Codex OAuth 端点(如 chatgpt.com/backend-api/codex
Codex 端点不走标准 /v1 前缀,直接使用 /responses。
"""
url = base_url.rstrip("/")
return "/backend-api/codex" in url or url.endswith("/codex")
# ==============================================================================
# Vertex AI 配置
# ==============================================================================