Skip to content
This repository was archived by the owner on Feb 18, 2026. It is now read-only.
This repository was archived by the owner on Feb 18, 2026. It is now read-only.

Wrong request for openai codex model + OAuth mode. #21

@aero

Description

@aero

Hi,
I tried to use OpenAI OAuth mode.
the Test page in Admin panel works but curl test and claude code not work.

In the DEBUG log when it fails.

2026-01-29T06:32:55.050243Z  INFO ccm::server: 🔐 Loaded 1 OAuth tokens from storage
2026-01-29T06:32:55.050292Z  INFO ccm::server: 📦 Loaded 1 providers with 0 models
2026-01-29T06:32:55.050444Z  INFO ccm::server: 🚀 Server listening on 127.0.0.1:13456
2026-01-29T06:32:55.050494Z  INFO ccm::server: 🔐 OAuth callback server listening on 127.0.0.1:1455
2026-01-29T06:33:02.047932Z  INFO ccm::server: Received request for model: claude-opus-4.5
2026-01-29T06:33:02.047956Z DEBUG ccm::server: 📥 Incoming request body:
{
  "max_tokens": 1000,
  "messages": [
    {
      "content": "Hello",
      "role": "user"
    }
  ],
  "model": "claude-opus-4.5",
  "stream": true
}
2026-01-29T06:33:02.047975Z DEBUG ccm::router: 🔀 Auto-mapped model 'claude-opus-4.5' → 'gpt-5.2-codex'
2026-01-29T06:33:02.048010Z DEBUG ccm::router: ✅ Using model: gpt-5.2-codex
2026-01-29T06:33:02.048014Z  INFO ccm::server: 🎯 Routed to: gpt-5.2-codex (default)
2026-01-29T06:33:02.048016Z  INFO ccm::server: 📋 Found 1 provider mappings for model: gpt-5.2-codex
2026-01-29T06:33:02.048020Z  INFO ccm::server: 🔄 Trying mapping 1/1: provider=openai, actual_model=gpt-5.2-codex
2026-01-29T06:33:02.048032Z  INFO ccm::server: 🌊 Streaming request to provider: openai
2026-01-29T06:33:02.048047Z DEBUG ccm::providers::openai: Using /v1/responses endpoint for Codex model (streaming): gpt-5.2-codex
2026-01-29T06:33:02.048086Z DEBUG ccm::providers::openai: 🔐 Using OAuth Bearer token for ChatGPT Codex streaming on openai
2026-01-29T06:33:02.048143Z DEBUG reqwest::connect: starting new connection: https://chatgpt.com/
2026-01-29T06:33:02.060109Z DEBUG hyper_util::client::legacy::connect::http: connecting to 172.64.155.209:443
2026-01-29T06:33:02.067370Z DEBUG hyper_util::client::legacy::connect::http: connected to 172.64.155.209:443
2026-01-29T06:33:02.178782Z  INFO ccm::server: ⚠️ Provider openai streaming failed: Provider API error: 403 - <!DOCTYPE html><html lang="en-US"><head><title>Just a moment...</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=Edge"><meta name="robots" content="noindex,nofollow"><meta name="viewport" content="width=device-width,initial-scale=1"><style>*{box-sizing:border-box;margin:0;padding:0}html{line-height:1.15;-webkit-text-size-adjust:100%;color:#313131;font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"}body{display:flex;flex-direction:column;height:100vh;min-height:100vh}.main-content{margin:8rem auto;padding-left:1.5rem;max-widt
.
.

Looking at line

// OAuth (ChatGPT Codex) uses /codex/responses, API Key uses /responses
, it says that in oauth mode, it should be called as "/codex/responses", but it seems that the error is occurring because it is called as "/responses".

Does the condition for self.is_oauth() change depending on how it is called?

Is there a way to explicitly tell ccm to use OAuth mode without using a key (ANTHROPIC_API_KEY) when testing with curl from the command line or running claude code?

Test OK case in admin panel

2026-01-29T06:34:53.391835Z  INFO ccm::server: Received request for model: gpt-5.2-codex
2026-01-29T06:34:53.391878Z DEBUG ccm::server: 📥 Incoming request body:
{
  "max_tokens": 4096,
  "messages": [
    {
      "content": "안녕",
      "role": "user"
    }
  ],
  "model": "gpt-5.2-codex",
  "stream": false,
  "temperature": 1
}
2026-01-29T06:34:53.391977Z DEBUG ccm::router: ✅ Using model: gpt-5.2-codex
2026-01-29T06:34:53.391982Z  INFO ccm::server: 🎯 Routed to: gpt-5.2-codex (default)
2026-01-29T06:34:53.391987Z  INFO ccm::server: 📋 Found 1 provider mappings for model: gpt-5.2-codex
2026-01-29T06:34:53.391991Z  INFO ccm::server: 🔄 Trying mapping 1/1: provider=openai, actual_model=gpt-5.2-codex
2026-01-29T06:34:53.392021Z DEBUG ccm::providers::openai: Using /codex/responses endpoint for Codex model: gpt-5.2-codex
2026-01-29T06:34:53.392073Z DEBUG ccm::providers::openai: 🔐 Using OAuth Bearer token for ChatGPT Codex on openai
2026-01-29T06:34:53.392150Z DEBUG reqwest::connect: starting new connection: https://chatgpt.com/
2026-01-29T06:34:53.396099Z DEBUG hyper_util::client::legacy::connect::http: connecting to 172.64.155.209:443
2026-01-29T06:34:53.410375Z DEBUG hyper_util::client::legacy::connect::http: connected to 172.64.155.209:443
2026-01-29T06:34:55.959839Z DEBUG hyper_util::client::legacy::pool: pooling idle connection for ("https", chatgpt.com)
2026-01-29T06:34:55.960163Z DEBUG ccm::providers::openai: Responses API response body: event: response.created
data: {"type":"response.created","response":{"id":"resp_0bd7b290dbbe14f901697aff8ecd5881918b1377299db37b72","object":"response","created_at":1769668494,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":"You are Codex, based on GPT-5. You are running as a coding agent in the Codex CLI on a user's computer.\n\n## General\n\n- The arguments to `shell` will be passed to execvp(). Most terminal commands should be prefixed with [\"bash\", \"-lc\"].\n- Always set the `workdir` param when using the shell function. Do not use `cd` unless absolutely necessary.\n- When searching for text or files, prefer using `rg` or `rg --files` respectively b
.
.
.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions