Skip to content

[Bug/错误]: 使用 codex + auth.json 时无法 featch models #1636

@xbpk3t

Description

@xbpk3t

Pre-submission Checklist / 提交前检查

  • I have searched the existing issues and this bug has not been reported / 我已搜索现有 issues,此 Bug 尚未被报告
  • I have read the documentation / 我已阅读文档
  • I am using the latest version of AxonHub / 我正在使用 AxonHub 的最新版本

FAQ Check / FAQ 检查

  • I have checked the FAQ and this bug is not covered there / 我已查阅 FAQ,此 Bug 未被覆盖

Bug Description / Bug 描述

Summary

Codex channel created with imported auth.json works after manually entering models, but Fetch Models fails during channel creation.

Version

AxonHub: v0.9.38
Deployment: Docker

Steps to reproduce

  1. Add Channel
  2. Select Codex
  3. Choose auth.json auth mode
  4. Paste a valid Codex auth.json
  5. Click Apply To Credentials
  6. Click Fetch Models

Actual behavior

Fetch Models returns:

{
  "models": [],
  "error": "failed to fetch models: GET - https://chatgpt.com/backend-api/codex/models with status 400 Bad Request"
}

Browser GraphQL request shows apiKey is sent as an access token JWT, not the full OAuth credentials JSON.

Expected behavior

For Codex official/auth.json credentials, FetchModels should return the built-in codex.DefaultModels() list instead of requesting:

https://chatgpt.com/backend-api/codex/models

Additional context

If I manually fill the model IDs, the channel works correctly. So the auth.json and actual Codex request path are valid; only the Fetch Models helper fails.

可能的修复方向

后端修会更稳。比如:

if channelType == channel.TypeCodex {
    if auth-json mode / official mode / default codex baseURL {
        return codex.DefaultModels()
    }
}

或者前端在 auth.json 模式下调用 FetchModels 时,不要把 access_token 单独传给 apiKey,而是传完整 OAuth credentials JSON,让后端的 isOAuthJSON(apiKey) 能命中默认模型分支。


发 issue 后,再次确认了一下

在第一次新增 auth.json 时会有上面的问题

但是现在又可以成功 fetch models 了

Image

需要您确认一下是否会存在这种情况

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions