Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix: cover o1 max-completion token fallback
chengyongru99f7f371fae7
diff --git a/nanobot/providers/openai_compat_provider.py b/nanobot/providers/openai_compat_provider.pyindex 5b766edf6..3a2ba2fbe 100644--- a/nanobot/providers/openai_compat_provider.py+++ b/nanobot/providers/openai_compat_provider.py@@ -94,10 +94,10 @@ def _model_slug(model_name: str) -> str:def _requires_max_completion_tokens(model_name: str) -> bool:- """Return True for models that reject ``max_tokens`` (GPT-5 family, o3/o4)."""+ """Return True for models that reject ``max_tokens`` (GPT-5 family, o-series)."""slug = _model_slug(model_name)return "gpt-5" in slug or any(- slug == p or slug.startswith((p + "-", p + ".")) for p in ("o3", "o4")+ slug == p or slug.startswith((p + "-", p + ".")) for p in ("o1", "o3", "o4"))diff --git a/tests/providers/test_litellm_kwargs.py b/tests/providers/test_litellm_kwargs.pyindex 81e5f5d0a..27896e58b 100644--- a/tests/providers/test_litellm_kwargs.py+++ b/tests/providers/test_litellm_kwargs.py@@ -933,8 +933,12 @@ def test_openai_compat_build_kwargs_uses_gpt5_safe_parameters() -> None:("model_name", "expected_key"),[("gpt-5.4", "max_completion_tokens"),+ ("o1-mini", "max_completion_tokens"),("o3-mini", "max_completion_tokens"),+ ("o4-mini", "max_completion_tokens"),("gpt-4", "max_tokens"),+ ("foo3-mini", "max_tokens"),+ ("foo4-mini", "max_tokens"),],)def test_openai_compat_build_kwargs_max_completion_tokens_by_model_name(