You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Copilot / gpt-5-codex "model gpt-5-codex is not accessible via the /chat/completions endpoint" #2758
But trying to use it in opencode 0.11.3 I get the above error
I do see it available in my org
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:
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
Hey did some digging and this is what I am able to find.
On models.dev the github-api provided models make use of the @ai-sdk/openai-compatible package.
as noted by @caozhiyuangpt-5-codex only uses the /responses path
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
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.
@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.
@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.
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
}
}
}
}
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"
}
}
Reacted by Ryan, Obinna Odirionye, Nikolaj, Nicolás Aranda, Meulen92, Olzhas Askar, HidemaruOwO, Max Lorenz, Konstantinos Papadakis, Ondřej Hliba and 23 more
Reacted by Zakaria ANBARI, Ryan, HidemaruOwO, David Ed, Mayank Chauhan, Gregory Horvay, gafani, Suhaas-code, seonghun-ops, Jan-Henrik Damaschke and 2 more
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
Reacted by Lee Dongju and Yvan Wang
Reacted by Kamil Chmielewski, Ondřej Hliba, Asaduzzaman Noor, Catalin Enache, Kenneth Aasan, grahamcropley, Joakim Rosenfeldt Pedersen, Simon Poltier, Jye Harry, Vyacheslav Syrovatsky and 2 more
Activity
OpeOginni commentedon Sep 24, 2025
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-codexis 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 docsberatcmn commentedon Sep 24, 2025
Even tho I enabled the codex in settings I still have the same problem as the OG. Here is the screenshot:
OpeOginni commentedon Sep 24, 2025
@beratcmn still shows only for VSCode in the docs
caozhiyuan commentedon Sep 25, 2025
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
OpeOginni commentedon Sep 25, 2025
@caozhiyuan thanks and yeah that makes sense, so you think its an issue on Copliots side? with how they are serving the model?
caozhiyuan commentedon Sep 25, 2025
@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"
}
varo6 commentedon Sep 25, 2025
still having the same problem, but on copilot docs they claim it is only supported in Visual Studio Code v1.104.1 or higher
OpeOginni commentedon Sep 26, 2025
Hey did some digging and this is what I am able to find.
@ai-sdk/openai-compatiblepackage.gpt-5-codexonly uses the/responsespath@ai-sdk/openai-compatiblepackage/chat/completionsis hardcoded as default pathSo this should be a fix on the
ai-sdkside or this specific model provided on the github-api should use the@ai-sdk/openaipackage which supports the/responsesendpointmelMass commentedon Sep 26, 2025
FYI the error is in vscode insiders (latest) too
Mikeson01 commentedon Sep 26, 2025
same issue but works on my laptop
MGAMZ commentedon Sep 27, 2025
Same issue here, the VSCode version is the latest 1.104.2.

kayden-fyp commentedon Sep 27, 2025
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
OpeOginni commentedon Oct 2, 2025
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
34 remaining items
caozhiyuan commentedon Oct 17, 2025
@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.
dudufcb1 commentedon Oct 17, 2025
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.
matifali commentedon Oct 28, 2025
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
opencode auth login--> ChooseOther--> Name itopenai-api--> Paste an OpenAI TokenThen create a file
opencode.jsonwith 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)" } } } } }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 } } } }Also,
gpt-4oandgpt-5fail 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" } }Minoo7 commentedon Nov 18, 2025
any update on this?
rekram1-node commentedon Nov 18, 2025
im working on something should have a fix soon
asd-noor commentedon Nov 20, 2025
I am currently using a custom github-copilot provider to access GPT5 Codex models.
OpenCode version:
1.0.80Configuration snippet:
Hoping a future OpenCode update will fix this issue.
rekram1-node commentedon Nov 30, 2025
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
startGalway commentedon Jan 22, 2026
I found my VScode editon is too low ,which is 1.101.4. I update it to 1.108.2,the question solved.