Skip to content

Question: Codex sessions hidden after switching model_provider to ai-api gateway #52

@youjunjer

Description

@youjunjer

Hi, thank you for publishing this project.

I am testing an OpenAI-compatible gateway setup for Codex using a custom provider in ~/.codex/config.toml, similar to:

model = "openai/gpt-5.x"
model_provider = "ai_api_gateway"

[model_providers.ai_api_gateway]
name = "AI API Gateway"
base_url = "https://example.com/v1"
wire_api = "responses"
env_key = "AIAPI_TOKEN"

The gateway requests work for new Codex conversations. However, when a user switches from their normal OpenAI/ChatGPT Codex provider to the gateway provider, their existing Codex local project conversations/history appear to disappear or become unavailable in Codex Desktop / resume flows. New conversations still work.

I found a related upstream Codex issue where switching model_provider hides existing local sessions from resume/history surfaces, even though the session files are still present: openai/codex#15494

Do you have a recommended ai-api/Codex setup pattern to avoid this problem? For example:

  • avoid setting top-level model_provider globally and only register [model_providers.*]
  • launch Codex with a per-session CLI override such as codex -m ... -c 'model_provider="ai_api_gateway"'
  • use a separate CODEX_HOME for short-lived classroom/workshop tokens
  • any other profile/project setup that preserves long-term project history

The use case is important because a global provider switch is acceptable for short-term classroom usage, but not for long-term development if existing project conversations become hidden.

Thanks for any guidance or prior experience.

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