Skip to content

gpt-5-codex model endpoint support + Codex CLI documentation #117

Open

Description

@dylbarne
  1. enable compatibility with new gpt-5-codex model, by default copilot-api routes to chat/completions endpoint however looks like codex model expects different endpoint
  2. provide some documentation around compatibility with usage to Codex CLI config (similar to existing docs showing how can be used with claude code settings already)
    • here is minimal working toml config I have been using: (although if repo maintainers have other suggestions around that would be appreciated, if when added to README potentially)
model = "gpt-5-mini"
review_model = "gpt-5-mini"
model_provider = "copilot"

[model_providers.copilot]
name = "Github Copilot"
base_url = "http://127.0.0.1:4141"

Activity

  1. vtomnet commented on Sep 25, 2025

    @vtomnet
  2. caozhiyuan commented on Sep 26, 2025

    @caozhiyuan
    Contributor

    @dylbarne @vtomnet in codex cli in done, https://github.com/caozhiyuan/copilot-api/tree/feature/gpt-5-codex . but in claude code ,need more test . use gpt-5-codex generated these codes

  3. Louis454545 commented on Sep 26, 2025

    @Louis454545

    @dylbarne @vtomnet in codex cli in done, https://github.com/caozhiyuan/copilot-api/tree/feature/gpt-5-codex . but in claude code ,need more test . use gpt-5-codex generated these codes

    wow thanks for that, but how to setup copilot-api with codex ?

  4. caozhiyuan commented on Sep 26, 2025

    @caozhiyuan
    Contributor

    @Louis454545 config.toml
    model = "gpt-5-codex"
    model_provider = "github-copilot"
    model_reasoning_effort = "high"

    [model_providers.github-copilot]
    name = "github-copilot"
    base_url = "http://localhost:4141"
    env_key = "GITHUB_COPILOT_API_KEY"
    wire_api = "responses"

  5. zicjin commented on Oct 1, 2025

    @zicjin

    @caozhiyuan

    ▌ hello?
    
    ⚠️ stream error: unexpected status 404 Not Found: 404 Not Found; retrying 1/5 in 187ms…
    
    ⚠️ stream error: unexpected status 404 Not Found: 404 Not Found; retrying 2/5 in 414ms…
    
    ⚠️ stream error: unexpected status 404 Not Found: 404 Not Found; retrying 3/5 in 863ms…
    

    I used the same configuration, aren't you getting the same result?

    copilot-api console:

    <-- POST /responses
    --> POST /responses 404 1ms
    <-- POST /responses
    --> POST /responses 404 0ms
    <-- POST /responses
    --> POST /responses 404 0ms
    
  6. caozhiyuan commented on Oct 1, 2025

    @caozhiyuan
    Contributor

    @zicjin #119 I have added the ping event, which currently resolves the codex disconnection issue: Transport error: error decoding response body. I've tested it and it's working fine now.

    please update code , use https://github.com/caozhiyuan/copilot-api/tree/feature/gpt-5-codex

  7. caozhiyuan commented on Oct 1, 2025

    @caozhiyuan
    Contributor

    this is my codex config
    model = "gpt-5-codex"
    model_provider = "github-copilot"
    model_reasoning_effort = "high"

    [model_providers.github-copilot]
    name = "github-copilot"
    base_url = "http://localhost:4141"
    env_key = "GITHUB_COPILOT_API_KEY"
    wire_api = "responses"
    request_max_retries = 3
    stream_max_retries = 0
    stream_idle_timeout_ms = 300000

  8. guanghechen commented on Oct 18, 2025

    @guanghechen

    hi @caozhiyuan, I tried your fork branch and it works great. Thank you very much for your work. During usage, I encountered a small issue I'd like to ask you about: after enabling the codex web_search feature, when I run codex --search, I get the following error. Do you have any idea what might be causing this?

    unexpected status 400 Bad Request: {"error":{"message":"{\"error\":{\"message\":\"The use of the web search tool is not supported.\",\"code\":\"unsupported_value\",\"param\":\"tools\",\"type\":\"invalid_request_error\"}}\n","type":"error"}}
    
  9. caozhiyuan commented on Oct 18, 2025

    @caozhiyuan
    Contributor

    @guanghechen copilot don't support web_search tool, you should deny WebSearch. if use in claude code , add this setting https://github.com/ericc-ch/copilot-api/blob/master/README.md?plain=1#L319 . codex also can disable web_search tool

  10. guanghechen commented on Oct 18, 2025

    @guanghechen

    Okay, but if we disable the web-search tool, how can the agent fetch the latest documents or information from the web? Doesn't this cause the agent to always use the data it was trained on?

  11. caozhiyuan commented on Oct 18, 2025

    @caozhiyuan
    Contributor

    @guanghechen use mcp fetch or websearch

  12. guanghechen commented on Oct 18, 2025

    @guanghechen

    Thank you for your fast reply! Do you have any recommended MCP fetch tools, Context7? By the way, what does "websearch" mean? Is it an MCP tool?

  13. caozhiyuan commented on Oct 18, 2025

    @caozhiyuan
    Contributor

    @guanghechen "context7": {
    "type": "stdio",
    "command": "npx",
    "args": [
    "-y",
    "@upstash/context7-mcp"
    ]
    },
    "fetch": {
    "command": "uvx",
    "args": [
    "mcp-server-fetch",
    "--ignore-robots-txt"
    ]
    }

  14. dylbarne commented on Jan 9, 2026

    @dylbarne
    Author

    @zicjin #119 I have added the ping event, which currently resolves the codex disconnection issue: Transport error: error decoding response body. I've tested it and it's working fine now.

    please update code , use https://github.com/caozhiyuan/copilot-api/tree/feature/gpt-5-codex

    @caozhiyuan I have been using your forked /all branch for Codex CLI lately and has been working great for the most part (for Planning/review etc.) although when it comes time to make file edits am running into 500 status internal server error intermittently (with gpt-5.2 model)

    Failed to create responses Response { status: 500,
      statusText: 'Internal Server Error',
      headers:
       Headers { 'content-security-policy': "default-src 'none'; sandbox",
         'content-type': 'text/plain; charset=utf-8',
         'copilot-edits-session': '***',
         'strict-transport-security': 'max-age=***',
         'x-content-type-options': 'nosniff',
         'x-request-id': '***',
         date: '***',
         'content-length': '***',
         'x-github-backend': 'Kubernetes',
         'x-github-request-id': '***' },
      body: ReadableStream { locked: false, state: 'readable', supportsBYOB: true },
      bodyUsed: false,
      ok: false,
      redirected: false,
      type: 'basic',
      url: 'https://api.business.githubcopilot.com/responses' }
    

    my config mostly matches the one you gave with respect to provider setup

  15. caozhiyuan commented on Jan 10, 2026

    @caozhiyuan
    Contributor

    Since when has it been like this? I tried locally and it's the same. I've been using claude code. @dylbarne This is a copilot server-side error, possibly related to apply_patch custom_tool_call, it's not a function call.

  16. dylbarne commented on Jan 10, 2026

    @dylbarne
    Author

    Since when has it been like this? I tried locally and it's the same. I've been using claude code. @dylbarne This is a copilot server-side error, possibly related to apply_patch custom_tool_call, it's not a function call.

    hmm yah am not entirely sure, I had also recently been using CC and opencode more recently, just came back to Codex this ~week and noticed the error

    maybe is due to some settings around apply_patch_freeform (just did this based on guidance from https://steipete.me/posts/2025/shipping-at-inference-speed#my-config) - potentially can play around with other patch-related settings

    but yah was just curious if you/others were experiencing the same

  17. caozhiyuan commented on Jan 10, 2026

    @caozhiyuan
    Contributor
  18. caozhiyuan commented on Jan 10, 2026

    @caozhiyuan
    Contributor

    seems copilot not support custom tool . so changed it to function tool . codex support funtion and custom apply_patch tool, but can't change gpt-5.2 default config, so change tool type in request.

  19. caozhiyuan commented on Jan 10, 2026

    @caozhiyuan
    Contributor

    Given the recent policies of Claude, I'm also planning to migrate to OpenCode, which is a great tool. However, this tool has a lot of content, and feature updates might not be timely, so I've added a custom provider for this project. @dylbarne #167 (comment)

  20. dylbarne commented on Jan 29, 2026

    @dylbarne
    Author

    @guanghechen copilot don't support web_search tool, you should deny WebSearch. if use in claude code , add this setting https://github.com/ericc-ch/copilot-api/blob/master/README.md?plain=1#L319 . codex also can disable web_search tool

    just noting for others who might see and run into this, looks like Codex web_search is now enabled by default (https://developers.openai.com/codex/changelog/#codex-2026-01-28-mdx), so will need to disable in config.toml

    for me when setting only at the [features].web_search level, this did not seem to work , needed to set as web_search = "disabled" at root level despite warning in CLI

    Image

    @caozhiyuan to some of the above point, would it potentially be possible to "map" web_search tool however Codex is calling to whatever legit enabled way Copilot expects? I am unfamiliar with the two architectures compatibility, though just assuming may have some may of doing this that the copilot api does allow

  21. caozhiyuan commented on Jan 30, 2026

    @caozhiyuan
    Contributor

    @dylbarne fixed

  22. johnib commented on Apr 5, 2026

    @johnib
  23. caozhiyuan commented on Apr 6, 2026

    @caozhiyuan
    Contributor

    The GitHub copilot gpt model has supported native web search for the past two months.

  24. johnib commented on Apr 6, 2026

    @johnib

    my trials were on gpt-5.3-codex. could it be that it's indeed not enabled on that model?

    not sure if this page confirms that or just not updated:

    https://github.blog/changelog/2026-02-25-improved-web-search-in-copilot-on-github-com/

  25. caozhiyuan commented on Apr 8, 2026

    @caozhiyuan
    Contributor

    @johnib in github website copilot setting, have a native websearch enable switch

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions