sub2api icon indicating copy to clipboard operation
sub2api copied to clipboard

求助 sub2api 应该怎么配置支持 codex-cli 0.145.0?

Open wxqqh opened this issue 4 months ago • 2 comments

我自己部署了一个sub2api 实例并加入了订阅账号, 使用下面配置给 codex-cli

model_provider = "OpenAI"
model = "gpt-5.5"
review_model = "gpt-5.5"
model_reasoning_effort = "xhigh"
disable_response_storage = true
network_access = "enabled"
windows_wsl_setup_acknowledged = true

[model_providers.OpenAI]
name = "OpenAI"
base_url = "https://domain/"
wire_api = "responses"
requires_openai_auth = false
http_headers = { "x-openai-actor-authorization" = "local-image-extension" }

[features]
goals = true

[projects."/root/.codex"]
trust_level = "trusted"

[tui.model_availability_nux]
"gpt-5.6-sol" = 4

而且 API_KEY 是正确的, 通过 下面的方式可以正确返回

(base) ➜  ~ curl https://domain/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-key" \
  -d '{
    "model": "gpt-5.5",
    "messages": [
      {"role": "user", "content": "你好, 你是什么模型?"}
    ]
  }'
{"id":"resp_0f33c3d258b423c5016a6207e437608194aeb84e1d6cbe1add","object":"chat.completion","created":1784809447,"model":"gpt-5.5","choices":[{"index":0,"message":{"role":"assistant","content":"你好!我是一个由 OpenAI 训练的 AI 语言模型助手,可以帮你回答问题、写作、翻译、编程、总结资料等。  \n如果你想知道具体的模型名称或版本,需要看你当前使用的平台/API 配置。"},"finish_reason":"stop"}],"usage":{"prompt_tokens":13,"completion_tokens":127,"total_tokens":140,"completion_tokens_details":{"reasoning_tokens":66}}}

但配置完启动 codex 的时候会直接提示 INVALID_API_KEY(此时请求地址是https://domain/responses), 我把 baseurl 改成 https://domain/v1 也不行

  └ Unexpected status 401 Unauthorized: {"code":"INVALID_API_KEY","message":"Invalid API key"}, url: https://domain/responses, cf-ray: a1faaadeeafec152-EWR,
    request id: 7c4ba64e-1c10-45d6-84b5-3db0255e1af2

应该如何配置才能使用?

wxqqh avatar Jul 23 '26 12:07 wxqqh

去掉domain,maybe

starkyYourEyes avatar Jul 26 '26 05:07 starkyYourEyes

+v1后,重新创建一个新的key并导入,然后退出所有对话窗口后再新开个对话

Breeze-mi avatar Jul 26 '26 17:07 Breeze-mi