Skip to content

fix(copilot): route responses-only models (grok-4.x, gpt-5.x) to /responses API - #3

Closed
MaxMoldmann wants to merge 2 commits into
masterfrom
fix/copilot-responses-api-routing-v2
Closed

MaxMoldmann wants to merge 2 commits into
masterfrom
fix/copilot-responses-api-routing-v2

Conversation

@MaxMoldmann

@MaxMoldmann MaxMoldmann commented Sep 24, 2026 •

Copy link
Copy Markdown
Owner

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 400 unsupported_api_for_model when selected in jcode. The root cause is that Copilot only exposes these models via the OpenAI Responses API (/responses endpoint), not /chat/completions.

From the /models catalog for these models:

{ "supported_endpoints": ["/responses"] }

Fix

Read supported_endpoints from the /models catalog at startup. For any model that lists /responses but not /chat/completions, route requests to /responses instead.

Changed Files

  • crates/jcode-base/src/auth/copilot.rs - Add supported_endpoints: Vec<String> to CopilotModelInfo; add needs_responses_api() method.
  • crates/jcode-provider-copilot-runtime/src/lib.rs - Add responses_model_ids set populated from /models on startup. In stream_request, branch on model_needs_responses_api(): convert messages to Responses API input items and POST to /responses. Add process_responses_sse_stream to parse SSE events.
  • crates/jcode-provider-copilot-runtime/Cargo.toml - Add jcode-provider-openai dependency.
  • crates/jcode-tui/src/tui/app/commands.rs - Add unsupported_api_for_model to is_fatal_model_endpoint_error.

Tests

34/34 copilot-runtime unit tests pass. 7 new needs_responses_api auth tests, 3 new routing tests added.

Live integration test against api.githubcopilot.com:

Check Result
/models lists grok-4.5/4.6/4.7 as responses-only ✓ 13 responses-only models confirmed
/chat/completions for gpt-5.3-codex ✓ HTTP 400 unsupported_api_for_model (root cause)
/responses streaming for gpt-5.3-codex ✓ HTTP 200, text delta received
/responses streaming for grok-4.5 ✓ HTTP 200
/responses streaming for grok-4.6 ✓ HTTP 200
/responses streaming for grok-4.7 ✓ HTTP 200

Affected 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-flash

Linked Issues

Closes 1jehuang#1128

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Grok not usable on GitHub Copilot subscription

1 participant