Skip to content

Commit 060d272

Browse files
committed
feat(server): force full thinking budget for Opus on all routes
1 parent d9e3f68 commit 060d272

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/proxy_app/main.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,14 @@ async def chat_completions(
926926
"custom_reasoning_budget"
927927
) or generation_cfg.get("custom_reasoning_budget", False)
928928

929+
# Auto-enable full thinking budget for Opus models
930+
# This ensures Opus always gets maximum thinking capacity (no // 4 reduction)
931+
if model and "opus" in model.lower():
932+
if not reasoning_effort:
933+
request_data["reasoning_effort"] = "high"
934+
if not custom_reasoning_budget:
935+
request_data["custom_reasoning_budget"] = True
936+
929937
logging.getLogger("rotator_library").debug(
930938
f"Handling reasoning parameters: model={model}, reasoning_effort={reasoning_effort}, custom_reasoning_budget={custom_reasoning_budget}"
931939
)

src/rotator_library/anthropic_compat/translator.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,9 @@ def translate_anthropic_request(request: AnthropicMessagesRequest) -> Dict[str,
370370
openai_request["reasoning_effort"] = "disable"
371371
elif _is_opus_model(request.model):
372372
# Enable thinking for Opus models when no thinking config is provided
373-
# Use "high" effort but NOT custom_reasoning_budget, so // 4 applies
374-
# This gives 8192 thinking tokens (32768 // 4) which is reasonable for most tasks
375-
# Users who want full capacity can explicitly set thinking.budget_tokens >= 32000
373+
# Always use full thinking capacity for Opus (no // 4 reduction)
376374
openai_request["reasoning_effort"] = "high"
377-
# Note: NOT setting custom_reasoning_budget here to conserve tokens
375+
openai_request["custom_reasoning_budget"] = True
378376

379377
return openai_request
380378

0 commit comments

Comments
 (0)