Skip to content

CubeLoop — a Pythonic, async-native agent harness core designed for high performance, readability, and production-grade persistence.

feat(providers): forward max_tokens and temperature in stream calls

xf gong5f8ae6cc615e
diff --git a/cubepi/providers/base.py b/cubepi/providers/base.py
index 73e827d..8464bd8 100644
--- a/cubepi/providers/base.py
+++ b/cubepi/providers/base.py
@@ -82,6 +82,7 @@ class Model(BaseModel):
reasoning: bool = False
context_window: int = 200_000
max_tokens: int = 8192
+ temperature: float = 0.7
cost: ModelCost | None = None
thinking_level_map: dict[str, str | None] | None = None
diff --git a/cubepi/providers/openai.py b/cubepi/providers/openai.py
index 02f9f63..e8d0ecc 100644
--- a/cubepi/providers/openai.py
+++ b/cubepi/providers/openai.py
@@ -72,6 +72,8 @@ class OpenAIProvider:
"model": model.id,
"messages": api_messages,
"stream": True,
+ "max_tokens": model.max_tokens,
+ "temperature": model.temperature,
}
if tools:
kwargs["tools"] = [self._convert_tool(t) for t in tools]
diff --git a/cubepi/providers/openai_responses.py b/cubepi/providers/openai_responses.py
index 552e8b0..c2c7e77 100644
--- a/cubepi/providers/openai_responses.py
+++ b/cubepi/providers/openai_responses.py
@@ -98,6 +98,11 @@ class OpenAIResponsesProvider:
if model.max_tokens:
kwargs["max_output_tokens"] = model.max_tokens
+ # Forward temperature for non-reasoning models; reasoning models don't
+ # support temperature on the Responses API.
+ if not model.reasoning:
+ kwargs["temperature"] = model.temperature
+
async def _produce() -> None:
try:
nonlocal kwargs