You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a new service module that POSTs to ${copilotBaseUrl(state)}/responses, parallel to the existing create-chat-completions.ts / create-embeddings.ts / get-models.ts clients.
Current state
src/services/copilot/ contains exactly three call sites, all hitting /chat/completions, /embeddings, /models. No code anywhere POSTs to a URL containing responses.
Tasks
Create src/services/copilot/create-responses.ts
Use undici's fetch (same as create-chat-completions.ts:31)
URL: \${copilotBaseUrl(state)}/responses``
Headers via the same helper that builds Copilot headers today (Authorization: Bearer ${state.copilotToken}, copilot-integration-id: vscode-chat, editor-version, editor-plugin-version, user-agent, x-github-api-version)
Add OpenAI-Beta: responses=experimental if/when upstream requires it (verify via VS Code Copilot Chat traffic; remove if not needed)
Honor state.showToken for debug logging
Support both streaming (SSE via fetch-event-stream) and non-streaming
Define response types in src/services/copilot/responses-types.ts:
ResponseObject with output: Array<ResponseOutputItem>
ResponseStreamEvent discriminated union covering response.created, response.in_progress, response.output_item.added, response.output_text.delta, response.output_text.done, response.reasoning.delta, response.reasoning_summary_text.delta, response.function_call_arguments.delta, response.completed, response.failed, etc.
Wire X-Initiator: agent | user header derived the same way create-chat-completions.ts:21–29 already does for chat (assistant/tool present in input → agent)
Part of #1. Pairs with #2.
Goal
Add a new service module that POSTs to
${copilotBaseUrl(state)}/responses, parallel to the existingcreate-chat-completions.ts/create-embeddings.ts/get-models.tsclients.Current state
src/services/copilot/contains exactly three call sites, all hitting/chat/completions,/embeddings,/models. No code anywhere POSTs to a URL containingresponses.Tasks
src/services/copilot/create-responses.tsundici'sfetch(same ascreate-chat-completions.ts:31)\${copilotBaseUrl(state)}/responses``Authorization: Bearer ${state.copilotToken},copilot-integration-id: vscode-chat,editor-version,editor-plugin-version,user-agent,x-github-api-version)OpenAI-Beta: responses=experimentalif/when upstream requires it (verify via VS Code Copilot Chat traffic; remove if not needed)state.showTokenfor debug loggingfetch-event-stream) and non-streamingsrc/services/copilot/responses-types.ts:ResponseObjectwithoutput: Array<ResponseOutputItem>ResponseOutputItemdiscriminated union:reasoning | message | function_call | tool_call | image_generation_call | code_interpreter_call | local_shell_call | …ResponseReasoningItemMUST includeencrypted_content?: string(see Model-to-endpoint routing (chat vs responses) #5)ResponseStreamEventdiscriminated union coveringresponse.created,response.in_progress,response.output_item.added,response.output_text.delta,response.output_text.done,response.reasoning.delta,response.reasoning_summary_text.delta,response.function_call_arguments.delta,response.completed,response.failed, etc.X-Initiator: agent | userheader derived the same waycreate-chat-completions.ts:21–29already does for chat (assistant/tool present in input →agent)Copilot-Vision-Request: truewhen input containsinput_image(see Streaming reasoning events translation #10)Acceptance criteria
await createResponses(payload, { stream: false })returns a typedResponseObjectawait createResponses(payload, { stream: true })returns anAsyncIterable<ResponseStreamEvent>HTTPErrorclass (src/lib/error.ts)gpt-5.3-codexreturns at least onereasoningand onemessageoutput itemFile pointers
src/services/copilot/create-chat-completions.ts— reference shapesrc/lib/api-config.ts:16–19—copilotBaseUrlsrc/lib/error.tslitellm/llms/github_copilot/responses/transformation.py