Skip to content

Copilot / gpt-5-codex "model gpt-5-codex is not accessible via the /chat/completions endpoint" #2758

Closed

Description

@andrewneilson
AI_APICallError: model gpt-5-codex is not accessible via the /chat/completions endpoint

gpt-5-codex from copilot was added about 8 hours ago anomalyco/models.dev#222

But trying to use it in opencode 0.11.3 I get the above error

I do see it available in my org

Image

When I check the available models from the copilot api it doesn't look available, but the fact that it was added makes me wonder if I'm missing something:

gpt-4.1
gpt-5-mini
gpt-5
gpt-3.5-turbo
gpt-3.5-turbo-0613
gpt-4o-mini
gpt-4o-mini-2024-07-18
gpt-4
gpt-4-0613
gpt-4-0125-preview
gpt-4o
gpt-4o-2024-11-20
gpt-4o-2024-05-13
gpt-4-o-preview
gpt-4o-2024-08-06
o3-mini
o3-mini-2025-01-31
o3-mini-paygo
text-embedding-ada-002
text-embedding-3-small
text-embedding-3-small-inference
claude-3.5-sonnet
claude-3.7-sonnet
claude-3.7-sonnet-thought
claude-sonnet-4
claude-opus-4
claude-opus-41
gemini-2.0-flash-001
gemini-2.5-pro
o3
o3-2025-04-16
o4-mini
o4-mini-2025-04-16
gpt-4.1-2025-04-14

Activity

  1. OpeOginni commented on Sep 24, 2025

    @OpeOginni
    Contributor

    Hello @andrewneilson noticed that in this url https://github.com/settings/copilot/features, you can enable different models to use for the copilot API, noted gpt-5-codex is not there to enable or disable so checked the docs, and that shows that 5-codex is only available on VS Code for now, so maybe it doesn't work on the API yet docs

    Image
  2. beratcmn commented on Sep 24, 2025

    @beratcmn

    Even tho I enabled the codex in settings I still have the same problem as the OG. Here is the screenshot:

    Image
  3. OpeOginni commented on Sep 24, 2025

    @OpeOginni
    Contributor

    @beratcmn still shows only for VSCode in the docs

  4. caozhiyuan commented on Sep 25, 2025

    @caozhiyuan
    Contributor

    gpt-5-codex use openai response api https://platform.openai.com/docs/api-reference/responses/create endpoint , diff with /chat/completions , should use /responses endpoint , the request parameters have changed @OpeOginni

  5. OpeOginni commented on Sep 25, 2025

    @OpeOginni
    Contributor

    @caozhiyuan thanks and yeah that makes sense, so you think its an issue on Copliots side? with how they are serving the model?

  6. caozhiyuan commented on Sep 25, 2025

    @caozhiyuan
    Contributor

    @OpeOginni Because OpenAI will use the responses API for its subsequent new models, Copilot also provides a responses API. this is copilot gpt-5-codex model info {
    "capabilities": {
    "family": "gpt-5-codex",
    "limits": {
    "max_context_window_tokens": 200000,
    "max_output_tokens": 64000,
    "max_prompt_tokens": 128000,
    "vision": {
    "max_prompt_image_size": 3145728,
    "max_prompt_images": 1,
    "supported_media_types": ["image/jpeg", "image/png", "image/webp", "image/gif"]
    }
    },
    "object": "model_capabilities",
    "supports": {
    "parallel_tool_calls": true,
    "streaming": true,
    "structured_outputs": true,
    "tool_calls": true,
    "vision": true
    },
    "tokenizer": "o200k_base",
    "type": "chat"
    },
    "id": "gpt-5-codex",
    "model_picker_category": "powerful",
    "model_picker_enabled": true,
    "name": "GPT-5-Codex (Preview)",
    "object": "model",
    "policy": {
    "state": "enabled",
    "terms": "Enable access to the latest GPT-5-Codex model from OpenAI. Learn more about how GitHub Copilot serves GPT-5-Codex."
    },
    "preview": true,
    "supported_endpoints": ["/responses"],
    "vendor": "OpenAI",
    "version": "gpt-5-codex"
    }

  7. varo6 commented on Sep 25, 2025

    @varo6

    still having the same problem, but on copilot docs they claim it is only supported in Visual Studio Code v1.104.1 or higher

  8. OpeOginni commented on Sep 26, 2025

    @OpeOginni
    Contributor

    Hey did some digging and this is what I am able to find.

    1. On models.dev the github-api provided models make use of the @ai-sdk/openai-compatible package.
    2. as noted by @caozhiyuan gpt-5-codex only uses the /responses path
    3. In the codebase for the @ai-sdk/openai-compatible package /chat/completions is hardcoded as default path

    So this should be a fix on the ai-sdk side or this specific model provided on the github-api should use the @ai-sdk/openai package which supports the /responses endpoint

  9. melMass commented on Sep 26, 2025

    @melMass

    FYI the error is in vscode insiders (latest) too

    Image
  10. Mikeson01 commented on Sep 26, 2025

    @Mikeson01

    same issue but works on my laptop

  11. MGAMZ commented on Sep 27, 2025

    @MGAMZ

    Same issue here, the VSCode version is the latest 1.104.2.
    Image

  12. kayden-fyp commented on Sep 27, 2025

    @kayden-fyp

    gpt-5-codex has its own prompts in codex.
    It would be great if the prompts could be considered along with gpt-5-codex support.
    https://cookbook.openai.com/examples/gpt-5-codex_prompting_guide

  13. OpeOginni commented on Oct 2, 2025

    @OpeOginni
    Contributor

    Hey @rekram1-node been working on a fix, could you try this to test on your end? NPM cache prevents me from trying out the new version that should fix somethings.

    You can check the package code here https://github.com/OpeOginni/github-copilot-openai-compatible

          "github-copilot-local": {
            "npm": "@opeoginni/github-copilot-openai-compatible",
            "name": "GitHub Copilot (local)",
            "id": "github-copilot",
            "options": {
              "baseURL": "https://api.githubcopilot.com",
              "apiKey": "<your-github-request-token>"
            },
            "models": {
              "gpt-5-codex": {
                "name": "GPT-5 Codex",
                "id": "gpt-5-codex"
              }
            }
          },
  14. 34 remaining items

  15. caozhiyuan commented on Oct 17, 2025

    @caozhiyuan
    Contributor

    @dudufcb1 What issue did you encounter? Currently, I'm running the source code with bun. I also encountered an issue: the copilot responses API sometimes returns an endless sequence of /r/n, roughly once in about 100 requests. To address this, I added a logger feature in the logger branch, which will record all request and response information. https://github.com/caozhiyuan/copilot-api/tree/feature/logger . also , i am using copilot api gpt-5-codex in claude code for almost two weeks, no issues so far.

  16. dudufcb1 commented on Oct 17, 2025

    @dudufcb1

    @dudufcb1 What issue did you encounter? Currently, I'm running the source code with bun. I also encountered an issue: the copilot responses API sometimes returns an endless sequence of /r/n, roughly once in about 100 requests. To address this, I added a logger feature in the logger branch, which will record all request and response information. https://github.com/caozhiyuan/copilot-api/tree/feature/logger . also , i am using copilot api gpt-5-codex in claude code for almost two weeks, no issues so far.

    The problem I found was that it works well, but every once in a while - though in my case more often - it gives me a 400 error because the request sends encrypted content that for some reason doesn't match and it rejects me, and it only works by closing the session and logging in again. In my case, I'm using regular Codex with its regular CLI. I do use Claude but with Sonnet 4.5. Would you mind sharing how you use it with Claude? I'm going to try your branch, thank you very much.

  17. matifali commented on Oct 28, 2025

    @matifali

    I get the exact same issue when trying to use it with an OpenAI provider proxy or the upstream OpenAI provider using manual config.

    Steps to Reproduce

    1. opencode auth login --> Choose Other --> Name it openai-api --> Paste an OpenAI Token

    2. Then create a file opencode.json with the following content

      {
        "$schema": "https://opencode.ai/config.json",
        "provider": {
          "openai-api": {
            "npm": "@ai-sdk/openai-compatible",
            "name": "OpenAI API",
            "options": {
              "baseURL": "https://api.openai.com/v1"
            },
            "models": {
              "gpt-5": {
                "name": "GPT-5 (API)"
              },
              "gpt-5-codex": {
                "name": "GPT-5 Codex (API)"
              },
              "gpt-4.1": {
                "name": "GPT-4.1 (API)"
              },
              "gpt-4o": {
                "name": "GPT 4o (API)"
              }
            }
          }
        }
      }
    3. Start a chat while choosing GPT-5 Codex (API) and notice the error in the logs.

      Error
      {
        "error": {
          "name": "AI_APICallError",
          "url": "https://api.openai.com/v1/chat/completions",
          "requestBodyValues": {
            "model": "gpt-5-codex",
            "messages": [
              {
                "role": "system",
                "content": "You are a helpful AI assistant tasked with summarizing conversations.\n\nWhen asked to summarize, provide a detailed but concise summary of the conversation. \nFocus on information that would be helpful for continuing the conversation, including:\n- What was done\n- What is currently being worked on\n- Which files are being modified\n- What needs to be done next\n\nYour summary should be comprehensive enough to provide context but concise enough to be quickly understood.\n"
              },
              {
                "role": "system",
                "content": "Here is some useful information about the environment you are running in:\n<env>\n  Working directory: /Users/matifali\n  Is directory a git repo: no\n  Platform: darwin\n  Today's date: Wed Oct 29 2025\n</env>\n<project>\n  \n</project>"
              },
              {
                "role": "user",
                "content": "Hello"
              },
              {
                "role": "user",
                "content": "Hello"
              },
              {
                "role": "user",
                "content": "Hello"
              },
              {
                "role": "user",
                "content": "Provide a detailed but concise summary of our conversation above. Focus on information that would be helpful for continuing the conversation, including what we did, what we're doing, which files we're working on, and what we're going to do next."
              }
            ],
            "stream": true,
            "stream_options": {
              "include_usage": true
            }
          },
          "statusCode": 404,
          "responseHeaders": {
            "access-control-expose-headers": "X-Request-ID",
            "alt-svc": "h3=\":443\"; ma=86400",
            "cf-cache-status": "DYNAMIC",
            "cf-ray": "995d02abccea21e8-KHI",
            "connection": "keep-alive",
            "content-encoding": "br",
            "content-type": "application/json",
            "date": "Tue, 28 Oct 2025 19:58:53 GMT",
            "openai-organization": "personal-fohgpy",
            "openai-processing-ms": "31",
            "openai-project": "proj_zZW0fa2RFEOlOXnmyW4lsOea",
            "openai-version": "2020-10-01",
            "server": "cloudflare",
            "strict-transport-security": "max-age=31536000; includeSubDomains; preload",
            "transfer-encoding": "chunked",
            "x-content-type-options": "nosniff",
            "x-envoy-upstream-service-time": "289",
            "x-openai-proxy-wasm": "v0.1",
            "x-ratelimit-limit-requests": "15000",
            "x-ratelimit-limit-tokens": "10000000",
            "x-ratelimit-remaining-requests": "14999",
            "x-ratelimit-remaining-tokens": "9999754",
            "x-ratelimit-reset-requests": "4ms",
            "x-ratelimit-reset-tokens": "1ms",
            "x-request-id": "req_4c99801df4c7467fabb36f54b960afab",
            "set-cookie": "_cfuvid=aoytCSB4c9V68IJOBIAvx_ZhKXvEcHzkLHw8fogCBLI-1761681533381-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None"
          },
          "responseBody": "{\n  \"error\": {\n    \"message\": \"This model is only supported in v1/responses and not in v1/chat/completions.\",\n    \"type\": \"invalid_request_error\",\n    \"param\": \"model\",\n    \"code\": null\n  }\n}",
          "isRetryable": false,
          "data": {
            "error": {
              "message": "This model is only supported in v1/responses and not in v1/chat/completions.",
              "type": "invalid_request_error",
              "param": "model",
              "code": null
            }
          }
        }
      }
    4. Also, gpt-4o and gpt-5 fail with a different error while gpt-4.1 works as expected

      {
         "error": {
           "status": 400,
           "endpoint": "https://api.openai.com/v1/chat/completions",
           "message": "Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.",
           "type": "invalid_request_error",
           "param": "max_tokens",
           "code": "unsupported_parameter"
         }
       }
  18. Minoo7 commented on Nov 18, 2025

    @Minoo7

    any update on this?

  19. rekram1-node commented on Nov 18, 2025

    @rekram1-node
    Contributor

    im working on something should have a fix soon

  20. asd-noor commented on Nov 20, 2025

    @asd-noor

    I am currently using a custom github-copilot provider to access GPT5 Codex models.
    OpenCode version: 1.0.80

    Configuration snippet:

    "github-copilot": {
        "npm": "@opeoginni/github-copilot-openai-compatible",
        "name": "GitHub Copilot",
        "id": "github-copilot"
    },
    

    Hoping a future OpenCode update will fix this issue.

  21. rekram1-node commented on Nov 30, 2025

    @rekram1-node
    Contributor

    This will be fixed in the next release, worked with @OpeOginni the request counting bug that happened with codex on his plugin earlier should be fixed.

    Also rolled in his changes into main repo so that you can use codex w/ copilot.

    We will clean it up later but this issue has been open long enough figured we should just ship it

  22. startGalway commented on Jan 22, 2026

    @startGalway

    I found my VScode editon is too low ,which is 1.101.4. I update it to 1.108.2,the question solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions