Skip to content

Commit 4e0c6f3

Browse files
authored
Pass through reasoning input flag and output chunks (#1096)
Some OpenRouter models allow to include the reasoning output if told to do so with a special input flag. This seems to be specific to OpenRouter. A simple test is: ``` curl http://localhost:8989/openrouter/completions \ -H "Authorization: Bearer $OPENROUTER_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "deepseek/deepseek-r1", "messages": [ {"role": "user", "content": "What is heavier, a kilogram of iron or a kilogram of feathers?"} ], "include_reasoning": true, "stream": true }' ``` Fixes: #977
1 parent cf9090d commit 4e0c6f3

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/codegate/types/openai/_request_models.py

+1
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ class ChatCompletionRequest(pydantic.BaseModel):
318318
user: str | None = None
319319
function_call: str | FunctionChoice | None = "auto" # deprecated
320320
functions: List[LegacyFunctionDef] | None = None # deprecated
321+
include_reasoning: bool | None = None # openrouter extension
321322

322323
def get_stream(self) -> bool:
323324
return self.stream

src/codegate/types/openai/_response_models.py

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ class MessageDelta(pydantic.BaseModel):
115115
tool_calls: List[ToolCall] | None = None
116116
role: Role | None = None
117117
function_call: FunctionCall | None = None # deprecated
118+
reasoning: str | None = None # openrouter extension
118119

119120

120121
class ChoiceDelta(pydantic.BaseModel):

0 commit comments

Comments
 (0)