gpt-5-codex through GitHub Copilot provider returns API call error #1898

Closed
opened 2026-02-16 17:33:08 -05:00 by yindo · 2 comments
Owner

Originally created by @sin4ch on GitHub (Oct 1, 2025).

My selected provider for opencode is GitHub Copilot. Whenever I try to select gpt-5-codex, I get this error:

Image

This felt strange since gpt-5 non-codex works perfectly.

I figured out that gpt-5 supports the chat/completions and responses APIs, while gpt-5-codex does not.

Case in point:

In opencode's provider implementation, only Azure/OpenAI models work with the responses endpoint. All others, including those from GitHub Copilot, are implemented using chat/completions. This is what's causing the problem with codex.

I will be creating a PR with a fix shortly. My fix will ensure that all gpt-5* models use the responses api rather than chat/completions. I also implemented a fallback, just in case.

Originally created by @sin4ch on GitHub (Oct 1, 2025). My selected provider for opencode is GitHub Copilot. Whenever I try to select `gpt-5-codex`, I get this error: <img width="1959" height="213" alt="Image" src="https://github.com/user-attachments/assets/ae55a258-bed5-47e3-acb5-711f82ba049e" /> This felt strange since `gpt-5` non-codex works perfectly. I figured out that `gpt-5` supports the `chat/completions` and `responses` APIs, while `gpt-5-codex` does not. Case in point: - https://platform.openai.com/docs/guides/migrate-to-responses#migrating-from-chat-completions - https://platform.openai.com/docs/models/gpt-5-codex#:~:text=It%27s%20available%20in,only In opencode's provider implementation, only Azure/OpenAI models work with the `responses` endpoint. All others, including those from GitHub Copilot, are implemented using `chat/completions`. This is what's causing the problem with `codex`. I will be creating a PR with a fix shortly. My fix will ensure that all `gpt-5*` models use the `responses` api rather than `chat/completions`. I also implemented a fallback, just in case.
yindo closed this issue 2026-02-16 17:33:08 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 1, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #2758: Same error with gpt-5-codex through GitHub Copilot provider - "model gpt-5-codex is not accessible via the /chat/completions endpoint"

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Oct 1, 2025): This issue might be a duplicate of existing issues. Please check: - #2758: Same error with gpt-5-codex through GitHub Copilot provider - "model gpt-5-codex is not accessible via the /chat/completions endpoint" Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Oct 1, 2025):

duplicate of #2758

@rekram1-node commented on GitHub (Oct 1, 2025): duplicate of #2758
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1898