Whitepaper
Docs
Sign In
Function
Function
filter
v0.1
OpenAI Reasoning Effort
Function ID
openai_reasoning_effort
Creator
@eynsfordcq
Downloads
75+
Control the reasoning effort for OpenAI's reasoning model like o1 or o3-mini
Get
README
No README available
Function Code
Show
""" title: Openrouter Provider Routing author: eynsfordcq github_url: https://github.com/eynsfordcq openai reference: https://platform.openai.com/docs/guides/reasoning?api-mode=chat#reasoning-effort version: 0.1 how to use: 1. Import the function. 2. Enable the function. 3. Configure valve: - reasoning_effort: select the desired reasoning effort from the drop down. 4. Enable the function for your openai reasoning model. 5. Navigate to "Models" in Admin tab. 6. Select the model you want to enable this function. - Under "filters", check the OpenAI Reasoning Effort function. 7. Alternatively, create a model under "workspace" - Navigate to "workspace". - Click the "+" button in "models" tab. - Enter model name, model id, and select desired a base model. - Under "filters", check the OpenAI Reasoning Effort function. 8. Enable "usage" and compare the reasoning tokens for different reasoning effort. """ from pydantic import BaseModel, Field from typing import Literal class Filter: class Valves(BaseModel): reasoning_effort: Literal["low", "medium", "high"] = Field( default="medium", description="Control the Reasoning Effort for OpenAI's reasoning model like o1, o3-mini", ) def __init__(self): self.valves = self.Valves() def inlet(self, body: dict) -> dict: body["reasoning_effort"] = self.valves.reasoning_effort return body