Skip to content

Reasoning types & reasoning_effort passthrough in chat-completions path #16

@HXYerror

Description

@HXYerror

Part of #1.

Goal

Even on the legacy /chat/completions path, reasoning models accept the top-level reasoning_effort parameter (minimal | low | medium | high) and may return choices[].message.reasoning_content (or delta.reasoning_content in stream). copilot-api currently has neither, so the parameter is dropped on the way in and the field is dropped on the way out.

Current state

  • Grep "reasoning" (case-insensitive) across the entire repo → 0 hits
  • ChatCompletionsPayload type at src/services/copilot/create-chat-completions.ts:127–151 has no reasoning_effort field
  • Delta and ResponseMessage types at src/services/copilot/create-chat-completions.ts:72–123 have no reasoning_content field
  • The Anthropic adapter explicitly suppresses thinking block output: "GitHub Copilot doesn't generate thinking blocks, so we don't include them in responses" (src/routes/messages/non-stream-translation.ts:305)

Tasks

  • Add reasoning_effort?: 'minimal' | 'low' | 'medium' | 'high' to ChatCompletionsPayload
  • Add reasoning_content?: string to Delta and ResponseMessage
  • In the chat-completions stream translator, surface delta.reasoning_content to clients (don't drop)
  • Cross-link with Anthropic /v1/messages → Responses API adapter #8 so the Anthropic adapter can synthesize thinking blocks from reasoning_content (this issue is just the OpenAI-shape side)

Acceptance criteria

  • POST /v1/chat/completions with \"reasoning_effort\": \"high\" and \"model\": \"gpt-5\" produces an upstream call that includes that field
  • If upstream returns reasoning_content, the client sees it (non-stream and stream)
  • Existing Chat Completions tests still pass

File pointers

  • src/services/copilot/create-chat-completions.ts:21–29 — payload construction
  • src/services/copilot/create-chat-completions.ts:72–123 — response/delta types
  • src/services/copilot/create-chat-completions.ts:127–151 — payload type
  • OpenAI docs: https://platform.openai.com/docs/guides/reasoning

Metadata

Metadata

Assignees

No one assigned

    Labels

    reasoningReasoning / thinking / encrypted_content

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions