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

Closed
opened 2026-02-16 17:32:42 -05:00 by yindo · 54 comments
Owner

Originally created by @andrewneilson on GitHub (Sep 24, 2025).

Originally assigned to: @rekram1-node on GitHub.

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

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
Originally created by @andrewneilson on GitHub (Sep 24, 2025). Originally assigned to: @rekram1-node on GitHub. ``` 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 <img width="934" height="120" alt="Image" src="https://github.com/user-attachments/assets/43255d84-6fd8-4685-9d3b-15c2c8a5c9a0" /> 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 ```
yindo closed this issue 2026-02-16 17:32:42 -05:00
Author
Owner

@OpeOginni commented on GitHub (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-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
@OpeOginni commented on GitHub (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-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](https://docs.github.com/en/copilot/reference/ai-models/model-hosting#openai-models) <img width="808" height="324" alt="Image" src="https://github.com/user-attachments/assets/b2c43524-dcc9-46cb-ad29-388b8fb193b5" />
Author
Owner

@beratcmn commented on GitHub (Sep 24, 2025):

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

Image
@beratcmn commented on GitHub (Sep 24, 2025): Even tho I enabled the codex in settings I still have the same problem as the OG. Here is the screenshot: <img width="1136" height="710" alt="Image" src="https://github.com/user-attachments/assets/26babaca-7b69-4a52-8517-ed85b790b7f1" />
Author
Owner

@OpeOginni commented on GitHub (Sep 24, 2025):

@beratcmn still shows only for VSCode in the docs

@OpeOginni commented on GitHub (Sep 24, 2025): @beratcmn still shows only for VSCode in the [docs](https://docs.github.com/en/copilot/reference/ai-models/model-hosting#openai-models)
Author
Owner

@caozhiyuan commented on GitHub (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

@caozhiyuan commented on GitHub (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
Author
Owner

@OpeOginni commented on GitHub (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?

@OpeOginni commented on GitHub (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?
Author
Owner

@caozhiyuan commented on GitHub (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"
}

@caozhiyuan commented on GitHub (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](https://gh.io/copilot-openai)." }, "preview": true, "supported_endpoints": ["/responses"], "vendor": "OpenAI", "version": "gpt-5-codex" }
Author
Owner

@varo6 commented on GitHub (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

@varo6 commented on GitHub (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
Author
Owner

@OpeOginni commented on GitHub (Sep 26, 2025):

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

@OpeOginni commented on GitHub (Sep 26, 2025): 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](https://github.com/vercel/ai/blob/f6603b7a71a13d48c38bce6a09ee98400dc0090d/packages/openai-compatible/src/chat/openai-compatible-chat-language-model.ts#L329) 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
Author
Owner

@melMass commented on GitHub (Sep 26, 2025):

FYI the error is in vscode insiders (latest) too

Image
@melMass commented on GitHub (Sep 26, 2025): FYI the error is in vscode insiders (latest) too <img width="399" height="183" alt="Image" src="https://github.com/user-attachments/assets/c549aaaf-e271-4f70-93d5-4fbd1736d08e" />
Author
Owner

@Mikeson01 commented on GitHub (Sep 26, 2025):

same issue but works on my laptop

@Mikeson01 commented on GitHub (Sep 26, 2025): same issue but works on my laptop
Author
Owner

@MGAMZ commented on GitHub (Sep 26, 2025):

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

@MGAMZ commented on GitHub (Sep 26, 2025): Same issue here, the VSCode version is the latest 1.104.2. <img width="910" height="286" alt="Image" src="https://github.com/user-attachments/assets/163825e9-3670-4455-a762-0bfcb4b567ef" />
Author
Owner

@kayden-fyp commented on GitHub (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

@kayden-fyp commented on GitHub (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
Author
Owner

@OpeOginni commented on GitHub (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

      "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"
          }
        }
      },
@OpeOginni commented on GitHub (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 ```ts "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" } } }, ```
Author
Owner

@OpeOginni commented on GitHub (Oct 2, 2025):

Image

Passed that and now here, Ill check it out more later

@OpeOginni commented on GitHub (Oct 2, 2025): <img width="753" height="286" alt="Image" src="https://github.com/user-attachments/assets/ce21c610-b3f1-4271-9845-97ac77662f06" /> Passed that and now here, Ill check it out more later
Author
Owner

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

@OpeOginni btw the github copilot api doesn't send reasoning chunks (p sure)

@rekram1-node commented on GitHub (Oct 2, 2025): @OpeOginni btw the github copilot api doesn't send reasoning chunks (p sure)
Author
Owner

@OpeOginni commented on GitHub (Oct 2, 2025):

@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

@OpeOginni commented on GitHub (Oct 2, 2025): > @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
Author
Owner

@OpeOginni commented on GitHub (Oct 2, 2025):

Got through the reasoning, now its a problem of the text part and how that is sent back and processed :(

@OpeOginni commented on GitHub (Oct 2, 2025): Got through the reasoning, now its a problem of the text part and how that is sent back and processed :(
Author
Owner

@OpeOginni commented on GitHub (Oct 3, 2025):

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+YYo8wBosKhWGnwmCuNWWoWTkPk4qBIecuNSeQdC7mnnmontfqutbennl+rEi4VaQAeBtsm+nQfn2b4OFTeJwMQ+id2wrLeHuJI//BFR+/ONHuOGetQo/msKockeh4GC+w+DM5SVwO1RF5ZyQtfJ8JDmAZbPvbFria6ppNDYGM4v0kAf/1fC2ezOyXDYkGdLHs/IKmtGiATVWSTUQ4zkvjKRgx4a1advSjFSpfE8kgTLbYFaolK/VwVcHFxSA+kA+j2cIPWdLrwvQ6l8fPeRY7ppAWVh7c2cwL4h+qGfEnj3SEaXvWmjch2ooXVWnG0CDSpn52EFOopfmzBbNKmJyPTqTmbW1FbMaP7ebpNSQ+xOTn6AsRkOtRshWQjUFwp7pugUwEkKwk",
  "text": "2"
}
[stream] text-start {
  "id": "EU+t6DkEGSYzft/3mKD1SW8rluprZcd+JxSl0Np2rHu8My76e+HES8L56eDaNqZ9WAYU/pBCPQ2Oht97IYMgFVwVzeR7Rj4iuJQFEL2BpgjJxeXmzXzfnZQHqPoLXdBBmhlSfSV+wWJdrV/o6GC8VHKoNdpFqCMhFh+GBRTJYa3K45PBUEE6EO2Jkth5GajvGohsLG0drnmclfthTKZrkMPxp33eTDtwX3/Rw2LPX6S3yTsSv8Cz2RDf0BTooqcqKBc4EhbBquajNfHj9ToKoAKRlGmhi5+ta5yVm3A9rtv4dlLmbEsJeN3/YEtrNKGteIe72GJ64iWifuCXZbFuxSl3Be5KH8fwsckBGWvRYHBfNlT3kmVn8FvulWCnT0aGsx4xvXJkHjvNclQL6G1JG0fMjA0w"
}
[stream] text-delta {
  "id": "EU+t6DkEGSYzft/3mKD1SW8rluprZcd+JxSl0Np2rHu8My76e+HES8L56eDaNqZ9WAYU/pBCPQ2Oht97IYMgFVwVzeR7Rj4iuJQFEL2BpgjJxeXmzXzfnZQHqPoLXdBBmhlSfSV+wWJdrV/o6GC8VHKoNdpFqCMhFh+GBRTJYa3K45PBUEE6EO2Jkth5GajvGohsLG0drnmclfthTKZrkMPxp33eTDtwX3/Rw2LPX6S3yTsSv8Cz2RDf0BTooqcqKBc4EhbBquajNfHj9ToKoAKRlGmhi5+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 commented on GitHub (Oct 3, 2025): Issue I noticed is the difference of how events are sent from the `/chat/completion` and the '/responses` api is. ```log [chat-stream] text-start { "id": "txt-0" } [chat-stream] text-delta { "id": "txt-0", "text": "Hello" } [chat-stream] text-delta { "id": "txt-0", "text": "!" } ``` ```log [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+YYo8wBosKhWGnwmCuNWWoWTkPk4qBIecuNSeQdC7mnnmontfqutbennl+rEi4VaQAeBtsm+nQfn2b4OFTeJwMQ+id2wrLeHuJI//BFR+/ONHuOGetQo/msKockeh4GC+w+DM5SVwO1RF5ZyQtfJ8JDmAZbPvbFria6ppNDYGM4v0kAf/1fC2ezOyXDYkGdLHs/IKmtGiATVWSTUQ4zkvjKRgx4a1advSjFSpfE8kgTLbYFaolK/VwVcHFxSA+kA+j2cIPWdLrwvQ6l8fPeRY7ppAWVh7c2cwL4h+qGfEnj3SEaXvWmjch2ooXVWnG0CDSpn52EFOopfmzBbNKmJyPTqTmbW1FbMaP7ebpNSQ+xOTn6AsRkOtRshWQjUFwp7pugUwEkKwk", "text": "2" } [stream] text-start { "id": "EU+t6DkEGSYzft/3mKD1SW8rluprZcd+JxSl0Np2rHu8My76e+HES8L56eDaNqZ9WAYU/pBCPQ2Oht97IYMgFVwVzeR7Rj4iuJQFEL2BpgjJxeXmzXzfnZQHqPoLXdBBmhlSfSV+wWJdrV/o6GC8VHKoNdpFqCMhFh+GBRTJYa3K45PBUEE6EO2Jkth5GajvGohsLG0drnmclfthTKZrkMPxp33eTDtwX3/Rw2LPX6S3yTsSv8Cz2RDf0BTooqcqKBc4EhbBquajNfHj9ToKoAKRlGmhi5+ta5yVm3A9rtv4dlLmbEsJeN3/YEtrNKGteIe72GJ64iWifuCXZbFuxSl3Be5KH8fwsckBGWvRYHBfNlT3kmVn8FvulWCnT0aGsx4xvXJkHjvNclQL6G1JG0fMjA0w" } [stream] text-delta { "id": "EU+t6DkEGSYzft/3mKD1SW8rluprZcd+JxSl0Np2rHu8My76e+HES8L56eDaNqZ9WAYU/pBCPQ2Oht97IYMgFVwVzeR7Rj4iuJQFEL2BpgjJxeXmzXzfnZQHqPoLXdBBmhlSfSV+wWJdrV/o6GC8VHKoNdpFqCMhFh+GBRTJYa3K45PBUEE6EO2Jkth5GajvGohsLG0drnmclfthTKZrkMPxp33eTDtwX3/Rw2LPX6S3yTsSv8Cz2RDf0BTooqcqKBc4EhbBquajNfHj9ToKoAKRlGmhi5+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?
Author
Owner

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

@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 commented on GitHub (Oct 3, 2025): @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
Author
Owner

@OpeOginni commented on GitHub (Oct 3, 2025):

@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

@OpeOginni commented on GitHub (Oct 3, 2025): @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
Author
Owner

@wienans commented on GitHub (Oct 3, 2025):

@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

https://github.com/vercel/ai/issues/8948

Doesn’t Look Like it gets much traction on vercel Side

@wienans commented on GitHub (Oct 3, 2025): > [@OpeOginni](https://github.com/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 https://github.com/vercel/ai/issues/8948 Doesn’t Look Like it gets much traction on vercel Side
Author
Owner

@jcubic commented on GitHub (Oct 4, 2025):

Can I ask which models are supported? Maybe it's worth documenting this. Or hide the models that are not supported by the auth method you're using.

I have GitHub Copilot Pro, and the only model that is working is Grok Code Fast 1. All other models throw an error.

@jcubic commented on GitHub (Oct 4, 2025): Can I ask which models are supported? Maybe it's worth documenting this. Or hide the models that are not supported by the auth method you're using. I have GitHub Copilot Pro, and the only model that is working is `Grok Code Fast 1`. All other models throw an error.
Author
Owner

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

@jcubic every model should work besides codex but we are exploring options to support it better

I bet I know what problems you are having tho one sec

@rekram1-node commented on GitHub (Oct 4, 2025): @jcubic every model should work besides codex but we are exploring options to support it better I bet I know what problems you are having tho one sec
Author
Owner

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

@jcubic make sure you enabled the models in your copilot settings: https://github.com/settings/copilot/features

Also depending on your subscription tier, be sure that you actually have access to the model

@rekram1-node commented on GitHub (Oct 4, 2025): @jcubic make sure you enabled the models in your copilot settings: https://github.com/settings/copilot/features Also depending on your subscription tier, be sure that you actually have access to the model
Author
Owner

@jcubic commented on GitHub (Oct 4, 2025):

@rekram1-node thanks, that works.

@jcubic commented on GitHub (Oct 4, 2025): @rekram1-node thanks, that works.
Author
Owner

@OpeOginni commented on GitHub (Oct 4, 2025):

Image

GETTING SOMEWHERE!!

Image

Tool calls seem to work kinda as well

@OpeOginni commented on GitHub (Oct 4, 2025): <img width="1191" height="720" alt="Image" src="https://github.com/user-attachments/assets/544747f2-afc3-4f23-8100-31bfd000cb8c" /> GETTING SOMEWHERE!! <img width="1174" height="711" alt="Image" src="https://github.com/user-attachments/assets/862c17b3-74e3-49d9-8c2d-ce450e4ae2a4" /> Tool calls seem to work kinda as well
Author
Owner

@OpeOginni commented on GitHub (Oct 4, 2025):

Image

It works 😭😭😭, but a bit slow

@OpeOginni commented on GitHub (Oct 4, 2025): <img width="1422" height="973" alt="Image" src="https://github.com/user-attachments/assets/d1fd8c88-2e27-462c-a9bb-daccf3ce6f28" /> It works 😭😭😭, but a bit slow
Author
Owner

@OpeOginni commented on GitHub (Oct 4, 2025):

For anyone who would like to try it out

      "github-copilot-local": {
        "npm": "@opeoginni/github-copilot-openai-compatible",
        "name": "GitHub Copilot (local)",
        "id": "github-copilot",
        "options": {
          "apiKey": "<copilot-request-token>"
        },
        "models": {
          "gpt-5-codex": {
            "name": "GPT-5 Codex",
            "id": "gpt-5-codex"
          }
        }
      }

UPDATE

Rather than run it like this, meaning you have to manually put in a request token, just go ahead and overide the package for github copilot

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

NOTE: The package affects your request billing on github's side, sadly every tool call is considered a request and can make you hit your limit fast, so watch your github copilot billing. Hopefully a fix for this would be pushed soon.

UPDATE: Fix has been pushed, you can use the package as you wish, it works well 😄

@OpeOginni commented on GitHub (Oct 4, 2025): For anyone who would like to try it out ```json "github-copilot-local": { "npm": "@opeoginni/github-copilot-openai-compatible", "name": "GitHub Copilot (local)", "id": "github-copilot", "options": { "apiKey": "<copilot-request-token>" }, "models": { "gpt-5-codex": { "name": "GPT-5 Codex", "id": "gpt-5-codex" } } } ``` **UPDATE** Rather than run it like this, meaning you have to manually put in a request token, just go ahead and overide the package for github copilot ```json "github-copilot": { "npm": "@opeoginni/github-copilot-openai-compatible", "id": "github-copilot" }, ``` **NOTE: The package affects your request billing on github's side, sadly every tool call is considered a request and can make you hit your limit fast, so watch your github copilot billing. Hopefully a fix for this would be pushed soon.** **UPDATE: Fix has been pushed, you can use the package as you wish, it works well 😄**
Author
Owner

@cirqueira-labs commented on GitHub (Oct 6, 2025):

For anyone who would like to try it out

  "github-copilot-local": {
    "npm": "@opeoginni/github-copilot-openai-compatible",
    "name": "GitHub Copilot (local)",
    "id": "github-copilot",
    "options": {
      "apiKey": "<copilot-request-token>"
    },
    "models": {
      "gpt-5-codex": {
        "name": "GPT-5 Codex",
        "id": "gpt-5-codex"
      }
    }
  }

same bad request here ..
I have a copilot plan and its enabled over config panel

@cirqueira-labs commented on GitHub (Oct 6, 2025): > For anyone who would like to try it out > > "github-copilot-local": { > "npm": "@opeoginni/github-copilot-openai-compatible", > "name": "GitHub Copilot (local)", > "id": "github-copilot", > "options": { > "apiKey": "<copilot-request-token>" > }, > "models": { > "gpt-5-codex": { > "name": "GPT-5 Codex", > "id": "gpt-5-codex" > } > } > } same bad request here .. I have a copilot plan and its enabled over config panel
Author
Owner

@OpeOginni commented on GitHub (Oct 6, 2025):

@cirqueira-labs might be your request token, its a bit hard to get since you need to grant the tokens using github api, Opencode handles this automatically.

After some tests this should work now, without you having to add your token, just add in this provider

      "github-copilot": {
        "npm": "@opeoginni/github-copilot-openai-compatible",
        "id": "github-copilot"
      },
@OpeOginni commented on GitHub (Oct 6, 2025): @cirqueira-labs might be your request token, its a bit hard to get since you need to grant the tokens using github api, Opencode handles this automatically. After some tests this should work now, without you having to add your token, just add in this provider ```json "github-copilot": { "npm": "@opeoginni/github-copilot-openai-compatible", "id": "github-copilot" }, ```
Author
Owner

@cirqueira-labs commented on GitHub (Oct 7, 2025):

For anyone who would like to try it out

  "github-copilot-local": {
    "npm": "@opeoginni/github-copilot-openai-compatible",
    "name": "GitHub Copilot (local)",
    "id": "github-copilot",
    "options": {
      "apiKey": "<copilot-request-token>"
    },
    "models": {
      "gpt-5-codex": {
        "name": "GPT-5 Codex",
        "id": "gpt-5-codex"
      }
    }
  }

UPDATE

Rather than run it like this, meaning you have to manually put in a request token, just go ahead and overide the package for github copilot

  "github-copilot": {
    "npm": "@opeoginni/github-copilot-openai-compatible",
    "id": "github-copilot"
  },
Image
@cirqueira-labs commented on GitHub (Oct 7, 2025): > For anyone who would like to try it out > > "github-copilot-local": { > "npm": "@opeoginni/github-copilot-openai-compatible", > "name": "GitHub Copilot (local)", > "id": "github-copilot", > "options": { > "apiKey": "<copilot-request-token>" > }, > "models": { > "gpt-5-codex": { > "name": "GPT-5 Codex", > "id": "gpt-5-codex" > } > } > } > **UPDATE** > > Rather than run it like this, meaning you have to manually put in a request token, just go ahead and overide the package for github copilot > > "github-copilot": { > "npm": "@opeoginni/github-copilot-openai-compatible", > "id": "github-copilot" > }, <img width="915" height="336" alt="Image" src="https://github.com/user-attachments/assets/c2c4d133-1ac8-41fc-bf88-8847393986b6" />
Author
Owner

@OpeOginni commented on GitHub (Oct 7, 2025):

@cirqueira-labs it still works for me, please can you share your opencode.json file?

@OpeOginni commented on GitHub (Oct 7, 2025): @cirqueira-labs it still works for me, please can you share your `opencode.json` file?
Author
Owner

@varo6 commented on GitHub (Oct 7, 2025):

@cirqueira-labs might be your request token, its a bit hard to get since you need to grant the tokens using github api, Opencode handles this automatically.

After some tests this should work now, without you having to add your token, just add in this provider

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

Thanks, working for me!

@varo6 commented on GitHub (Oct 7, 2025): > [@cirqueira-labs](https://github.com/cirqueira-labs) might be your request token, its a bit hard to get since you need to grant the tokens using github api, Opencode handles this automatically. > > After some tests this should work now, without you having to add your token, just add in this provider > > "github-copilot": { > "npm": "@opeoginni/github-copilot-openai-compatible", > "id": "github-copilot" > }, Thanks, working for me!
Author
Owner

@dongju93 commented on GitHub (Oct 7, 2025):

Copilot Pro subscribers can use 300 premium requests per month.
When using the Copilot model with existing OpenCode, you can see that each prompt consumes one premium request, equivalent to several OpenCode requests. (This is how the Copilot model deducts usage.)
However, after applying the above method, when using the gpt-5-codex model, it appears each API request generated by the prompt deducts usage.
After applying the above npm, I requested two prompts from the gpt-5-codex model and confirmed 50 premium requests were used.

@dongju93 commented on GitHub (Oct 7, 2025): Copilot Pro subscribers can use 300 premium requests per month. When using the Copilot model with existing OpenCode, you can see that each prompt consumes one premium request, equivalent to several OpenCode requests. (This is how the Copilot model deducts usage.) However, after applying the above method, when using the gpt-5-codex model, it appears each API request generated by the prompt deducts usage. After applying the above npm, I requested two prompts from the gpt-5-codex model and confirmed 50 premium requests were used.
Author
Owner

@varo6 commented on GitHub (Oct 7, 2025):

Copilot Pro subscribers can use 300 premium requests per month. When using the Copilot model with existing OpenCode, you can see that each prompt consumes one premium request, equivalent to several OpenCode requests. (This is how the Copilot model deducts usage.) However, after applying the above method, when using the gpt-5-codex model, it appears each API request generated by the prompt deducts usage. After applying the above npm, I requested two prompts from the gpt-5-codex model and confirmed 50 premium requests were used.

I was using it a bit and it definitely is not usage optimized for copilot. Maybe is not doing 50 premium requests for me but more than other models.

@varo6 commented on GitHub (Oct 7, 2025): > Copilot Pro subscribers can use 300 premium requests per month. When using the Copilot model with existing OpenCode, you can see that each prompt consumes one premium request, equivalent to several OpenCode requests. (This is how the Copilot model deducts usage.) However, after applying the above method, when using the gpt-5-codex model, it appears each API request generated by the prompt deducts usage. After applying the above npm, I requested two prompts from the gpt-5-codex model and confirmed 50 premium requests were used. I was using it a bit and it definitely is not usage optimized for copilot. Maybe is not doing 50 premium requests for me but more than other models.
Author
Owner

@OpeOginni commented on GitHub (Oct 7, 2025):

@dongju93 Noticing you are right, it takes more than 1 request, Ill do some digging into it.

@OpeOginni commented on GitHub (Oct 7, 2025): @dongju93 Noticing you are right, it takes more than 1 request, Ill do some digging into it.
Author
Owner

@OpeOginni commented on GitHub (Oct 7, 2025):

@dongju93 @varo6 Seem to have found something, and its really funny.

Github might not really be using prompts for requests, but the costs you incur. I have 3 screenshots that show me using the GPT-5-Codex (Preview) on VSCode. Each prompt uses 1 request, but the cost is also $0.04.

But on the last screenshot I used the same prompt, but on OpenCode, and the request jumped from 156 used premium requests to 167 used premium request, meaning I used 11 request in the single OpenCode prompt. But if you look at the cost I incurred using Opencode it is exactly $0.44, which is 11x the cost using it on VS Code. Might be a massive conincidence, but I also think its not. This also means that they are really reducing the response quality of the model on VSCode just to make sure its use is around $0.04.

First VSCode Prompt Usage Image
Second VSCode Prompt Usage (+1 Request, +$0.04 Cost) Image
Third VSCode Prompt Usage (+1 Request, +$0.04 Cost) Image
OpenCode Prompt Usage (+11 Request, +$0.44 Cost) Image

Maybe someone else could test it out and confirm 🙏

@OpeOginni commented on GitHub (Oct 7, 2025): @dongju93 @varo6 Seem to have found something, and its really funny. Github might not really be using prompts for requests, but the costs you incur. I have 3 screenshots that show me using the `GPT-5-Codex (Preview)` on VSCode. Each prompt uses 1 request, but the cost is also $0.04. But on the last screenshot I used the same prompt, but on OpenCode, and the request jumped from 156 used premium requests to 167 used premium request, meaning I used 11 request in the single OpenCode prompt. But if you look at the cost I incurred using Opencode it is exactly $0.44, which is 11x the cost using it on VS Code. Might be a massive conincidence, but I also think its not. This also means that they are really reducing the response quality of the model on VSCode just to make sure its use is around $0.04. <details> <summary>First VSCode Prompt Usage</summary> <img width="977" height="78" alt="Image" src="https://github.com/user-attachments/assets/f9f1021a-5d52-4943-883f-ced3865f0ec6" /> </details> <details> <summary>Second VSCode Prompt Usage (+1 Request, +$0.04 Cost)</summary> <img width="882" height="65" alt="Image" src="https://github.com/user-attachments/assets/e5f52bf7-ca5c-4c19-a645-00ac6cd314a9" /> </details> <details> <summary>Third VSCode Prompt Usage (+1 Request, +$0.04 Cost)</summary> <img width="952" height="74" alt="Image" src="https://github.com/user-attachments/assets/817048d3-c15f-457a-9e31-fd5c202971bc" /> </details> <details> <summary>OpenCode Prompt Usage (+11 Request, +$0.44 Cost)</summary> <img width="942" height="60" alt="Image" src="https://github.com/user-attachments/assets/9dcc466c-2687-4ea0-8ad6-d76e980a25b9" /> </details> Maybe someone else could test it out and confirm 🙏
Author
Owner

@wienans commented on GitHub (Oct 8, 2025):

@dongju93 @varo6 Seem to have found something, and its really funny.

Github might not really be using prompts for requests, but the costs you incur. I have 3 screenshots that show me using the GPT-5-Codex (Preview) on VSCode. Each prompt uses 1 request, but the cost is also $0.04.

But on the last screenshot I used the same prompt, but on OpenCode, and the request jumped from 156 used premium requests to 167 used premium request, meaning I used 11 request in the single OpenCode prompt. But if you look at the cost I incurred using Opencode it is exactly $0.44, which is 11x the cost using it on VS Code. Might be a massive conincidence, but I also think its not. This also means that they are really reducing the response quality of the model on VSCode just to make sure its use is around $0.04.

First VSCode Prompt Usage
Second VSCode Prompt Usage (+1 Request, +$0.04 Cost)
Third VSCode Prompt Usage (+1 Request, +$0.04 Cost)
OpenCode Prompt Usage (+11 Request, +$0.44 Cost)
Maybe someone else could test it out and confirm 🙏

I think that is due to the fact that you can buy one request for 0.04$ if you run out of your included requests.

@wienans commented on GitHub (Oct 8, 2025): > [@dongju93](https://github.com/dongju93) [@varo6](https://github.com/varo6) Seem to have found something, and its really funny. > > Github might not really be using prompts for requests, but the costs you incur. I have 3 screenshots that show me using the `GPT-5-Codex (Preview)` on VSCode. Each prompt uses 1 request, but the cost is also $0.04. > > But on the last screenshot I used the same prompt, but on OpenCode, and the request jumped from 156 used premium requests to 167 used premium request, meaning I used 11 request in the single OpenCode prompt. But if you look at the cost I incurred using Opencode it is exactly $0.44, which is 11x the cost using it on VS Code. Might be a massive conincidence, but I also think its not. This also means that they are really reducing the response quality of the model on VSCode just to make sure its use is around $0.04. > > First VSCode Prompt Usage > Second VSCode Prompt Usage (+1 Request, +$0.04 Cost) > Third VSCode Prompt Usage (+1 Request, +$0.04 Cost) > OpenCode Prompt Usage (+11 Request, +$0.44 Cost) > Maybe someone else could test it out and confirm 🙏 I think that is due to the fact that you can buy one request for 0.04$ if you run out of your included requests.
Author
Owner

@caozhiyuan commented on GitHub (Oct 8, 2025):

@OpeOginni https://github.com/sst/opencode-copilot-auth/blob/main/index.mjs#L87 when X-Initiator=agent, does not consume premium requests. in responses api, body.messages.some( (msg) => msg.role && ["tool", "assistant"].includes(msg.role), ) need adjuest

@caozhiyuan commented on GitHub (Oct 8, 2025): @OpeOginni https://github.com/sst/opencode-copilot-auth/blob/main/index.mjs#L87 when X-Initiator=agent, does not consume premium requests. in responses api, ` body.messages.some( (msg) => msg.role && ["tool", "assistant"].includes(msg.role), ) ` need adjuest
Author
Owner

@OpeOginni commented on GitHub (Oct 9, 2025):

@caozhiyuan got a PR with the adjustment, you think this works?

@OpeOginni commented on GitHub (Oct 9, 2025): @caozhiyuan got a [PR](https://github.com/sst/opencode-copilot-auth/pull/2) with the adjustment, you think this works?
Author
Owner

@caozhiyuan commented on GitHub (Oct 9, 2025):

@OpeOginni I used claude code or codex, and contributed to copilot-api. You can compare the implementation. https://github.com/caozhiyuan/copilot-api/tree/feature/gpt-5-codex

@caozhiyuan commented on GitHub (Oct 9, 2025): @OpeOginni I used claude code or codex, and contributed to copilot-api. You can compare the implementation. https://github.com/caozhiyuan/copilot-api/tree/feature/gpt-5-codex
Author
Owner

@vernica9393 commented on GitHub (Oct 10, 2025):

@OpeOginni I used claude code or codex, and contributed to copilot-api. You can compare the implementation. https://github.com/caozhiyuan/copilot-api/tree/feature/gpt-5-codex

Hello i used your ersion but i got this

Image is normal?

@vernica9393 commented on GitHub (Oct 10, 2025): > [@OpeOginni](https://github.com/OpeOginni) I used claude code or codex, and contributed to copilot-api. You can compare the implementation. https://github.com/caozhiyuan/copilot-api/tree/feature/gpt-5-codex Hello i used your ersion but i got this <img width="614" height="47" alt="Image" src="https://github.com/user-attachments/assets/ac42ee06-034f-4a1c-98ef-9aaaf1ff1090" /> is normal?
Author
Owner

@caozhiyuan commented on GitHub (Oct 10, 2025):

@vernica9393 Is there any problem? You can enable logging when starting: bun run start start -v

@caozhiyuan commented on GitHub (Oct 10, 2025): @vernica9393 Is there any problem? You can enable logging when starting: bun run start start -v
Author
Owner

@ClassyCircuit commented on GitHub (Oct 16, 2025):

Any updates to this issue? We can't use gpt-5-codex until this is fixed.

@ClassyCircuit commented on GitHub (Oct 16, 2025): Any updates to this issue? We can't use gpt-5-codex until this is fixed.
Author
Owner

@dongju93 commented on GitHub (Oct 16, 2025):

@ClassyCircuit As you can see at the top of this issue, the GPT-5 Codex model provided by Copilot is currently unavailable outside the VS Code Copilot Chat extension (API unsupported).
In this thread, the Copilot model was made compatible with OpenAI models for use in OpenCode; however, additional issues relating to usage arose. Instead of resolving these issues, it would be better to wait until the Copilot GPT-5-Codex model officially provides an API and OpenCode supports its use.

@dongju93 commented on GitHub (Oct 16, 2025): @ClassyCircuit As you can see at the top of this issue, the GPT-5 Codex model provided by Copilot is currently unavailable outside the VS Code Copilot Chat extension (API unsupported). In this thread, the Copilot model was made compatible with OpenAI models for use in OpenCode; however, additional issues relating to usage arose. Instead of resolving these issues, it would be better to wait until the Copilot GPT-5-Codex model officially provides an API and OpenCode supports its use.
Author
Owner

@dudufcb1 commented on GitHub (Oct 17, 2025):

@caozhiyuan Hey do you have this already implemented? I did my own version, but i feel is kinda buggy, you have a release version? i guess the official copilot api still didnt merged or he did??

@dudufcb1 commented on GitHub (Oct 17, 2025): @caozhiyuan Hey do you have this already implemented? I did my own version, but i feel is kinda buggy, you have a release version? i guess the official copilot api still didnt merged or he did??
Author
Owner

@caozhiyuan commented on GitHub (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.

@caozhiyuan commented on GitHub (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.
Author
Owner

@dudufcb1 commented on GitHub (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.

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.

@dudufcb1 commented on GitHub (Oct 17, 2025): > [@dudufcb1](https://github.com/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.
Author
Owner

@matifali commented on GitHub (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

  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"
       }
     }
    
@matifali commented on GitHub (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 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 ```json { "$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. <details> <summary>Error</summary> ```json { "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 } } } } ``` </details> 5. Also, `gpt-4o` and `gpt-5` fail with a different error while **_gpt-4.1_** works as expected ```json { "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" } } ```
Author
Owner

@Minoo7 commented on GitHub (Nov 18, 2025):

any update on this?

@Minoo7 commented on GitHub (Nov 18, 2025): any update on this?
Author
Owner

@rekram1-node commented on GitHub (Nov 18, 2025):

im working on something should have a fix soon

@rekram1-node commented on GitHub (Nov 18, 2025): im working on something should have a fix soon
Author
Owner

@asd-noor commented on GitHub (Nov 20, 2025):

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.

@asd-noor commented on GitHub (Nov 20, 2025): 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.
Author
Owner

@rekram1-node commented on GitHub (Nov 29, 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

@rekram1-node commented on GitHub (Nov 29, 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
Author
Owner

@startGalway commented on GitHub (Jan 21, 2026):

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

@startGalway commented on GitHub (Jan 21, 2026): I found my VScode editon is too low ,which is 1.101.4. I update it to 1.108.2,the question solved.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1811