Copilot / gpt-5-codex "model gpt-5-codex is not accessible via the /chat/completions endpoint"
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 https://github.com/sst/models.dev/pull/222
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:
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
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
Even tho I enabled the codex in settings I still have the same problem as the OG. Here is the screenshot:
@beratcmn still shows only for VSCode in the docs
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
@caozhiyuan thanks and yeah that makes sense, so you think its an issue on Copliots side? with how they are serving the model?
@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" }
still having the same problem, but on copilot docs they claim it is only supported in Visual Studio Code v1.104.1 or higher
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-compatiblepackage. - as noted by @caozhiyuan
gpt-5-codexonly uses the/responsespath - In the codebase for the
@ai-sdk/openai-compatiblepackage/chat/completionsis 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
FYI the error is in vscode insiders (latest) too
same issue but works on my laptop
Same issue here, the VSCode version is the latest 1.104.2.
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
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"
}
}
},
Passed that and now here, Ill check it out more later
@OpeOginni btw the github copilot api doesn't send reasoning chunks (p sure)
@OpeOginni btw the github copilot api doesn't send reasoning chunks (p sure)
Yeah I think the issue is with the way I am processing the response, already on a fix for it will give update a bit later, but just glad to have gotten to this point lol
Got through the reasoning, now its a problem of the text part and how that is sent back and processed :(
Issue I noticed is the difference of how events are sent from the /chat/completion and the '/responses` api is.
[chat-stream] text-start {
"id": "txt-0"
}
[chat-stream] text-delta {
"id": "txt-0",
"text": "Hello"
}
[chat-stream] text-delta {
"id": "txt-0",
"text": "!"
}
[stream] text-start {
"id": "ELwsS6LXOHjJbY1qlQKW8paczwpzujHnudWpxxlr6iaYm1wymMTzxIm82hFAF1xcvnZDmJoC5fucqNEj9+zd3ey2mDQi1GSh5bCBli93gbJM3eVcR5wUj2EIYUJHwmp77tFqfLmnXaDiM5bTKebGVJppMa1NjwGABgYETrn/UJviClcDfUNkT6cUCmTvotgyizZZE2p0ZeByGXLRSoMtO6BQUEEjROqkZ8klpDaTZXx6MEVT8TUQaRvHUNWn8sy5+OZ9+Ah4UOEPQABIghH02ifn0ZwiRrnPflCqt6ivv37MLD2Nj0PFts6pc1TOyGnUBvhCu8N0bWrnHVpNBdX92TBTtilQHX3HozAF/JFqauFeC9I9T3rQT4N92OnwsBzOpD5iha36aQ71OSVm5SIGSBAplnKm"
}
[stream] text-start {
"id": "zF5KAW2uiNfGNb00yV+YYo8wBosKhWGnwmCuNWWoWTkPk4qBIecuNSeQdC7mnnmontfqutbennl+rEi4VaQAeBtsm+nQfn2b4OFTeJwMQ+id2wrLeHuJI//BFR+/ONHuOGetQo/msKockeh4GC+w+DM5SVwO1RF5ZyQtfJ8JDmAZbPvbFria6ppNDYGM4v0kAf/1fC2ezOyXDYkGdLHs/IKmtGiATVWSTUQ4zkvjKRgx4a1advSjFSpfE8kgTLbYFaolK/VwVcHFxSA+kA+j2cIPWdLrwvQ6l8fPeRY7ppAWVh7c2cwL4h+qGfEnj3SEaXvWmjch2ooXVWnG0CDSpn52EFOopfmzBbNKmJyPTqTmbW1FbMaP7ebpNSQ+xOTn6AsRkOtRshWQjUFwp7pugUwEkKwk"
}
[stream] text-delta {
"id": "zF5KAW2uiNfGNb00yV+YYo8wBosKhWGnwmCuNWWoWTkPk4qB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qcqKBc4EhbBquajNfHj9ToKoAKRlGmhi5+ta5yVm3A9rtv4dlLmbEsJeN3/YEtrNKGteIe72GJ64iWifuCXZbFuxSl3Be5KH8fwsckBGWvRYHBfNlT3kmVn8FvulWCnT0aGsx4xvXJkHjvNclQL6G1JG0fMjA0w",
"text": " +"
}
So I might make a change to accept the text-delta even before the text-start, or is it best I force text-start to come before text-delta from the provider sdk itself?
@OpeOginni before you get too in the weeds here, ideally the solution is making the vercel ai sdk openai compatible also have responses api support
I saw open discussions and issues about this i think
@rekram1-node appreciate the heads up, already in the weeds lol but was cool to learn more about how it all ticks. Best to wait for their updates