fix(copilot): route responses-only models (grok-4.x, gpt-5.x) to /responses API - #3
Closed
MaxMoldmann wants to merge 2 commits into
Closed
MaxMoldmann wants to merge 2 commits into
MaxMoldmann wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Models like
grok-4.5,grok-4.6,grok-4.7,gpt-5.3-codex,gpt-5.5, and other newer Copilot models fail with HTTP 400unsupported_api_for_modelwhen selected in jcode. The root cause is that Copilot only exposes these models via the OpenAI Responses API (/responsesendpoint), not/chat/completions.From the
/modelscatalog for these models:{ "supported_endpoints": ["/responses"] }Fix
Read
supported_endpointsfrom the/modelscatalog at startup. For any model that lists/responsesbut not/chat/completions, route requests to/responsesinstead.Changed Files
crates/jcode-base/src/auth/copilot.rs- Addsupported_endpoints: Vec<String>toCopilotModelInfo; addneeds_responses_api()method.crates/jcode-provider-copilot-runtime/src/lib.rs- Addresponses_model_idsset populated from/modelson startup. Instream_request, branch onmodel_needs_responses_api(): convert messages to Responses API input items and POST to/responses. Addprocess_responses_sse_streamto parse SSE events.crates/jcode-provider-copilot-runtime/Cargo.toml- Addjcode-provider-openaidependency.crates/jcode-tui/src/tui/app/commands.rs- Addunsupported_api_for_modeltois_fatal_model_endpoint_error.Tests
34/34 copilot-runtime unit tests pass. 7 new
needs_responses_apiauth tests, 3 new routing tests added.Live integration test against
api.githubcopilot.com:/modelslists grok-4.5/4.6/4.7 as responses-only/chat/completionsfor gpt-5.3-codexunsupported_api_for_model(root cause)/responsesstreaming for gpt-5.3-codex/responsesstreaming for grok-4.5/responsesstreaming for grok-4.6/responsesstreaming for grok-4.7Affected Models
gpt-5.3-codex,gpt-5.4-mini,gpt-5.5,gpt-5.6-luna,gpt-5.6-sol,gpt-5.6-terra,gpt-6-astra,gpt-6-luna,gpt-6-sol,grok-4.5,grok-4.6,grok-4.7,mai-code-1.1-flashLinked Issues
Closes 1jehuang#1128