Skip to content

Respect active Codex Responses provider base URL for OpenAI-compatible traffic #374

Closed

Description

@1jehuang

When ~/.codex/config.toml configures a Responses-compatible gateway, JCode does not reuse that base URL and may send Codex/OpenAI Responses traffic to the wrong endpoint.

Credit: originally proposed in PR #95. This repo no longer accepts external PRs, so the problem is tracked here instead.

Activity

  1. added
    from-pr
    on Jun 12, 2026
  2. added
    triage: reproducible
    autonomous: likely
    priority: low
    on Jun 25, 2026
  3. 1jehuang commented on Jun 25, 2026

    @1jehuang
    OwnerAuthor

    Triage: reproducible, clear fix path.

    Confirmed in crates/jcode-base/src/provider/openai.rs. The Responses API base URL is resolved by resolve_api_base() (lines 861-900), which only checks env vars (JCODE_OPENAI_API_BASE, OPENAI_BASE_URL, OPENAI_API_BASE) and otherwise defaults to https://api.openai.com/v1. It never consults ~/.codex/config.toml. The only place we read that file is crates/jcode-base/src/mcp/protocol.rs (import_from_external, line 245) for MCP server import — not for the Responses base URL. So when a user has a Responses-compatible gateway configured in Codex's config.toml (model_provider base_url / wire_api), JCode ignores it and may send Codex/OpenAI Responses traffic to the default endpoint.

    Fix path: in resolve_api_base() (API-key mode only; ChatGPT/Codex OAuth backend stays fixed per lines 840-844), after the env-var checks, fall back to parsing the active model_provider base_url from ~/.codex/config.toml before defaulting to OPENAI_API_BASE. Reuse the existing absolute-http(s) validation.

    Labels: autonomous: likely (needs minor judgment on which Codex config field to honor and precedence vs env), priority: low (niche; env-var override already exists as a workaround).

  4. 1jehuang commented on Jun 25, 2026

    @1jehuang
    OwnerAuthor

    Fixed in b96dfa47 (pending release). Built and tests pass on Linux. See commit message for the specific change for this issue.

  5. added
    triage: fixed-pending-release
    and removed
    triage: reproducible
    on Jun 25, 2026
  6. 1jehuang commented on Jun 28, 2026

    @1jehuang
    OwnerAuthor

    Released in v0.32.0. Run jcode update to get it.

  7. removed
    triage: fixed-pending-release
    on Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    autonomous: likelyfrom-prpriority: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions