Build and run agents you can see, understand and trust.
Python agentchatbotlarge-language-modelsllmllm-agentmcpmulti-agentmulti-modalreact-agentrealtime-agentvoice-agentvoice-assistant
feat(model): refresh model cards across all providers (#2240)
DavdGaobf7e8ff75a23
diff --git a/src/agentscope/_version.py b/src/agentscope/_version.pyindex 8999cf20c..cc3b8b042 100644--- a/src/agentscope/_version.py+++ b/src/agentscope/_version.py@@ -1,4 +1,4 @@# -*- coding: utf-8 -*-"""The version of agentscope."""-__version__ = "2.0.5"+__version__ = "2.0.6dev"diff --git a/src/agentscope/model/_anthropic/_model.py b/src/agentscope/model/_anthropic/_model.pyindex 0b1dff8a9..b54b1d67e 100644--- a/src/agentscope/model/_anthropic/_model.py+++ b/src/agentscope/model/_anthropic/_model.py@@ -56,6 +56,45 @@ class AnthropicChatModel(ChatModelBase):gt=0,)+ thinking_mode: (+ Literal["adaptive", "enabled", "disabled"] | None+ ) = Field(+ default=None,+ title="Thinking Mode",+ description=(+ "How Claude thinks. ``adaptive`` lets the model decide when "+ "and how deeply, and is the only mode Claude Opus 4.7 and "+ "later accept — those models reject the ``enabled`` "+ "(budget-based) mode. Takes precedence over "+ "``thinking_enable``; leave unset to fall back to it."+ ),+ )++ thinking_display: Literal["summarized", "omitted"] | None = Field(+ default=None,+ title="Thinking Display",+ description=(+ "Whether thinking blocks carry readable summaries or come "+ "back empty. Claude Opus 4.7 and later default to "+ "``omitted``, so set ``summarized`` to see the reasoning."+ ),+ )++ reasoning_effort: (+ Literal["low", "medium", "high", "xhigh", "max"] | None+ ) = Field(+ default=None,+ title="Reasoning Effort",+ description=(+ "How many tokens Claude spends on the whole response — "+ "not just thinking, but tool calls and explanation too. "+ "Sent as Anthropic's ``output_config.effort``. The API "+ "default is ``high``. Supported levels vary by model — see "+ "the model card, and note that Claude Sonnet 4.5 and "+ "Claude Haiku 4.5 do not accept this parameter at all."+ ),+ )+def __init__(self,credential: AnthropicCredential,@@ -127,6 +166,16 @@ class AnthropicChatModel(ChatModelBase):anthropic.InternalServerError,)+ def _thinking_mode(self) -> str | None:+ """Resolve the effective thinking mode.++ ``thinking_mode`` is the modern control; ``thinking_enable`` is the+ legacy toggle that only ever meant the budget-based mode.+ """+ if self.parameters.thinking_mode is not None:+ return self.parameters.thinking_mode+ return "enabled" if self.parameters.thinking_enable else None+async def _call_api(self,model_name: str,@@ -169,17 +218,26 @@ class AnthropicChatModel(ChatModelBase):**generate_kwargs,}- # Anthropic extended thinking — only set when explicitly enabled.- # Anthropic requires max_tokens > budget_tokens strictly.- if self.parameters.thinking_enable and "thinking" not in kwargs:- budget = self.parameters.thinking_budget or (max_tokens // 2)- if budget >= max_tokens:- # Auto-expand max_tokens to satisfy the strict inequality.- max_tokens = budget + 1024- kwargs["max_tokens"] = max_tokens- kwargs["thinking"] = {- "type": "enabled",- "budget_tokens": budget,+ mode = self._thinking_mode()+ if mode is not None and "thinking" not in kwargs:+ thinking: dict[str, Any] = {"type": mode}+ if mode == "enabled":+ # Anthropic requires max_tokens > budget_tokens strictly.+ budget = self.parameters.thinking_budget or (max_tokens // 2)+ if budget >= max_tokens:+ # Auto-expand max_tokens to satisfy the inequality.+ max_tokens = budget + 1024+ kwargs["max_tokens"] = max_tokens+ thinking["budget_tokens"] = budget+ # ``display`` is invalid alongside ``type: "disabled"``.+ if mode != "disabled" and self.parameters.thinking_display:+ thinking["display"] = self.parameters.thinking_display+ kwargs["thinking"] = thinking++ # Effort travels inside ``output_config``, not as a top-level field.+ if self.parameters.reasoning_effort and "output_config" not in kwargs:+ kwargs["output_config"] = {+ "effort": self.parameters.reasoning_effort,}fmt_tools, fmt_tool_choice = self._format_tools(tools, tool_choice)@@ -529,14 +587,14 @@ class AnthropicChatModel(ChatModelBase):) -> StructuredResponse:"""Anthropic-specific override for structured output.- Anthropic's extended thinking mode only supports+ Anthropic's budget-based thinking mode only supports``tool_choice={"type": "auto"}`` or ``{"type": "none"}``; anyforcing form (``"any"`` or a specific tool) raises an API error.- When ``thinking_enable`` is on we default ``tool_choice`` to- ``"auto"`` and rely on the base class's injected system-reminder- prompt to guide the model. When thinking is disabled, this falls+ In that mode we default ``tool_choice`` to ``"auto"`` and rely on+ the base class's injected system-reminder prompt to guide the+ model. Adaptive thinking accepts forced tool use, so it fallsthrough to the base implementation (force the structured-output- tool).+ tool) just like thinking being off entirely.See:https://platform.claude.com/docs/en/build-with-claude/extended-thinking#extended-thinking-with-tool-use@@ -562,7 +620,7 @@ class AnthropicChatModel(ChatModelBase):The structured response whose ``content`` is the validatedoutput dict matching ``structured_model``."""- if tool_choice is None and self.parameters.thinking_enable:+ if tool_choice is None and self._thinking_mode() == "enabled":tool_choice = ToolChoice(mode="auto")return await super()._call_api_with_structured_output(model_name=model_name,diff --git a/src/agentscope/model/_anthropic/_models/claude-fable-5.yaml b/src/agentscope/model/_anthropic/_models/claude-fable-5.yamlnew file mode 100644index 000000000..ddddbee9b--- /dev/null+++ b/src/agentscope/model/_anthropic/_models/claude-fable-5.yaml@@ -0,0 +1,37 @@+name: claude-fable-5+label: Claude Fable 5+status: active++input_types:+ - text/plain+ - application/x-thinking+ - image/jpeg+ - image/png+ - image/gif+ - image/webp++output_types:+ - text/plain+ - application/x-thinking++context_size: 1000000+output_size: 128000++parameter_overrides:+ max_tokens: {"maximum": 128000}+ # Thinking is always on here and cannot be disabled or budgeted —+ # ``reasoning_effort`` is the only depth control it accepts.+ thinking_enable:+ hidden: true+ thinking_budget:+ hidden: true+ thinking_mode:+ default: adaptive+ anyOf:+ - enum: [adaptive]+ type: string+ - type: "null"+ # Defaults to "omitted" on these models, which renders as empty thinking+ # blocks — ask for summaries explicitly.+ thinking_display:+ default: summarizeddiff --git a/src/agentscope/model/_anthropic/_models/claude-haiku-4-5.yaml b/src/agentscope/model/_anthropic/_models/claude-haiku-4-5.yamlindex feae8f167..eadc361f8 100644--- a/src/agentscope/model/_anthropic/_models/claude-haiku-4-5.yaml+++ b/src/agentscope/model/_anthropic/_models/claude-haiku-4-5.yaml@@ -19,3 +19,12 @@ output_size: 65536parameter_overrides:max_tokens: {"maximum": 65536}+ # Extended-thinking-only generation: adaptive mode is not accepted, and+ # thinking display is already summarized by default here.+ thinking_mode:+ hidden: true+ thinking_display:+ hidden: true+ # Haiku 4.5 does not accept the reasoning_effort parameter.+ reasoning_effort:+ hidden: truediff --git a/src/agentscope/model/_anthropic/_models/claude-opus-4-5.yaml b/src/agentscope/model/_anthropic/_models/claude-opus-4-5.yamlindex 69f6b4f39..4b7e8048d 100644--- a/src/agentscope/model/_anthropic/_models/claude-opus-4-5.yaml+++ b/src/agentscope/model/_anthropic/_models/claude-opus-4-5.yaml@@ -19,3 +19,16 @@ output_size: 65536parameter_overrides:max_tokens: {"maximum": 65536}+ # Extended-thinking-only generation: adaptive mode is not accepted, and+ # thinking display is already summarized by default here.+ thinking_mode:+ hidden: true+ thinking_display:+ hidden: true+ # The oldest model accepting reasoning_effort at all; xhigh and max+ # arrived with the 4.6 generation.+ reasoning_effort:+ anyOf:+ - enum: [low, medium, high]+ type: string+ - type: "null"diff --git a/src/agentscope/model/_anthropic/_models/claude-opus-4-6.yaml b/src/agentscope/model/_anthropic/_models/claude-opus-4-6.yamlindex 0e5e2f3c3..7b395e0a6 100644--- a/src/agentscope/model/_anthropic/_models/claude-opus-4-6.yaml+++ b/src/agentscope/model/_anthropic/_models/claude-opus-4-6.yaml@@ -15,7 +15,23 @@ output_types:- application/x-thinkingcontext_size: 1000000-output_size: 131072+output_size: 128000parameter_overrides:- max_tokens: {"maximum": 131072}+ max_tokens: {"maximum": 128000}+ # The last generation to accept both thinking modes; budget-based+ # thinking still works here but is deprecated in favour of adaptive.+ thinking_enable:+ hidden: true+ thinking_mode:+ default: adaptive+ anyOf:+ - enum: [adaptive, enabled, disabled]+ type: string+ - type: "null"+ # xhigh landed after this generation; max is supported.+ reasoning_effort:+ anyOf:+ - enum: [low, medium, high, max]+ type: string+ - type: "null"diff --git a/src/agentscope/model/_anthropic/_models/claude-opus-4-7.yaml b/src/agentscope/model/_anthropic/_models/claude-opus-4-7.yamlindex a3a9beee1..1777373d8 100644--- a/src/agentscope/model/_anthropic/_models/claude-opus-4-7.yaml+++ b/src/agentscope/model/_anthropic/_models/claude-opus-4-7.yaml@@ -11,11 +11,27 @@ input_types:- image/webpoutput_types:- - text/plain- - application/x-thinking+ - text/plain+ - application/x-thinkingcontext_size: 1000000output_size: 128000parameter_overrides:max_tokens: {"maximum": 128000}+ # Budget-based thinking (``thinking.type: "enabled"``) is rejected by+ # this generation; adaptive is the only mode it accepts.+ thinking_enable:+ hidden: true+ thinking_budget:+ hidden: true+ thinking_mode:+ default: adaptive+ anyOf:+ - enum: [adaptive, disabled]+ type: string+ - type: "null"+ # Defaults to "omitted" on these models, which renders as empty thinking+ # blocks — ask for summaries explicitly.+ thinking_display:+ default: summarizeddiff --git a/src/agentscope/model/_anthropic/_models/claude-opus-4-8.yaml b/src/agentscope/model/_anthropic/_models/claude-opus-4-8.yamlindex 28df6a820..924f3a87f 100644--- a/src/agentscope/model/_anthropic/_models/claude-opus-4-8.yaml+++ b/src/agentscope/model/_anthropic/_models/claude-opus-4-8.yaml@@ -19,3 +19,19 @@ output_size: 128000parameter_overrides:max_tokens: {"maximum": 128000}+ # Budget-based thinking (``thinking.type: "enabled"``) is rejected by+ # this generation; adaptive is the only mode it accepts.+ thinking_enable:+ hidden: true+ thinking_budget:+ hidden: true+ thinking_mode:+ default: adaptive+ anyOf:+ - enum: [adaptive, disabled]+ type: string+ - type: "null"+ # Defaults to "omitted" on these models, which renders as empty thinking+ # blocks — ask for summaries explicitly.+ thinking_display:+ default: summarizeddiff --git a/src/agentscope/model/_anthropic/_models/claude-opus-5.yaml b/src/agentscope/model/_anthropic/_models/claude-opus-5.yamlnew file mode 100644index 000000000..714c576bc--- /dev/null+++ b/src/agentscope/model/_anthropic/_models/claude-opus-5.yaml@@ -0,0 +1,37 @@+name: claude-opus-5+label: Claude Opus 5+status: active++input_types:+ - text/plain+ - application/x-thinking+ - image/jpeg+ - image/png+ - image/gif+ - image/webp++output_types:+ - text/plain+ - application/x-thinking++context_size: 1000000+output_size: 128000++parameter_overrides:+ max_tokens: {"maximum": 128000}+ # Budget-based thinking (``thinking.type: "enabled"``) is rejected by+ # this generation; adaptive is the only mode it accepts.+ thinking_enable:+ hidden: true+ thinking_budget:+ hidden: true+ thinking_mode:+ default: adaptive+ anyOf:+ - enum: [adaptive, disabled]+ type: string+ - type: "null"+ # Defaults to "omitted" on these models, which renders as empty thinking+ # blocks — ask for summaries explicitly.+ thinking_display:+ default: summarizeddiff --git a/src/agentscope/model/_anthropic/_models/claude-sonnet-4-5.yaml b/src/agentscope/model/_anthropic/_models/claude-sonnet-4-5.yamlindex fedbea547..d97fe098b 100644--- a/src/agentscope/model/_anthropic/_models/claude-sonnet-4-5.yaml+++ b/src/agentscope/model/_anthropic/_models/claude-sonnet-4-5.yaml@@ -19,3 +19,12 @@ output_size: 65536parameter_overrides:max_tokens: {"maximum": 65536}+ # Extended-thinking-only generation: adaptive mode is not accepted, and+ # thinking display is already summarized by default here.+ thinking_mode:+ hidden: true+ thinking_display:+ hidden: true+ # Sonnet 4.5 does not accept the reasoning_effort parameter.+ reasoning_effort:+ hidden: truediff --git a/src/agentscope/model/_anthropic/_models/claude-sonnet-4-6.yaml b/src/agentscope/model/_anthropic/_models/claude-sonnet-4-6.yamlindex 61d22d04c..b4783a1b1 100644--- a/src/agentscope/model/_anthropic/_models/claude-sonnet-4-6.yaml+++ b/src/agentscope/model/_anthropic/_models/claude-sonnet-4-6.yaml@@ -15,7 +15,23 @@ output_types:- application/x-thinkingcontext_size: 1000000-output_size: 65536+output_size: 128000parameter_overrides:- max_tokens: {"maximum": 65536}+ max_tokens: {"maximum": 128000}+ # The last generation to accept both thinking modes; budget-based+ # thinking still works here but is deprecated in favour of adaptive.+ thinking_enable:+ hidden: true+ thinking_mode:+ default: adaptive+ anyOf:+ - enum: [adaptive, enabled, disabled]+ type: string+ - type: "null"+ # xhigh landed after this generation; max is supported.+ reasoning_effort:+ anyOf:+ - enum: [low, medium, high, max]+ type: string+ - type: "null"diff --git a/src/agentscope/model/_anthropic/_models/claude-sonnet-5.yaml b/src/agentscope/model/_anthropic/_models/claude-sonnet-5.yamlnew file mode 100644index 000000000..45d4008e0--- /dev/null+++ b/src/agentscope/model/_anthropic/_models/claude-sonnet-5.yaml@@ -0,0 +1,37 @@+name: claude-sonnet-5+label: Claude Sonnet 5+status: active++input_types:+ - text/plain+ - application/x-thinking+ - image/jpeg+ - image/png+ - image/gif+ - image/webp++output_types:+ - text/plain+ - application/x-thinking++context_size: 1000000+output_size: 128000++parameter_overrides:+ max_tokens: {"maximum": 128000}+ # Budget-based thinking (``thinking.type: "enabled"``) is rejected by+ # this generation; adaptive is the only mode it accepts.+ thinking_enable:+ hidden: true+ thinking_budget:+ hidden: true+ thinking_mode:+ default: adaptive+ anyOf:+ - enum: [adaptive, disabled]+ type: string+ - type: "null"+ # Defaults to "omitted" on these models, which renders as empty thinking+ # blocks — ask for summaries explicitly.+ thinking_display:+ default: summarizeddiff --git a/src/agentscope/model/_dashscope/_models/qwen-flash.yaml b/src/agentscope/model/_dashscope/_models/qwen-flash.yamlnew file mode 100644index 000000000..d85f1d42d--- /dev/null+++ b/src/agentscope/model/_dashscope/_models/qwen-flash.yaml@@ -0,0 +1,21 @@+name: qwen-flash+label: Qwen-Flash+status: active++input_types:+ - text/plain+ - application/x-thinking++output_types:+ - text/plain+ - application/x-thinking++context_size: 1000000+output_size: 32768++parameter_overrides:+ max_tokens: {"maximum": 32768}+ # Voice only applies to omni-style models; hide the field for this+ # non-omni model so the frontend popover doesn't render it.+ voice:+ hidden: truediff --git a/src/agentscope/model/_dashscope/_models/qwen3.5-flash.yaml b/src/agentscope/model/_dashscope/_models/qwen3.5-flash.yamlnew file mode 100644index 000000000..25671936c--- /dev/null+++ b/src/agentscope/model/_dashscope/_models/qwen3.5-flash.yaml@@ -0,0 +1,30 @@+name: qwen3.5-flash+label: Qwen3.5-Flash+status: active++input_types:+ - text/plain+ - application/x-thinking+ - image/bmp+ - image/jpeg+ - image/png+ - image/tiff+ - image/webp+ - image/heic+ - video/mp4++output_types:+ - text/plain+ - application/x-thinking++context_size: 1000000+output_size: 65536++parameter_overrides:+ max_tokens: {"maximum": 65536}+ # Max chain-of-thought is independent of max_tokens.+ thinking_budget: {"maximum": 81920}+ # Voice only applies to omni-style models; hide the field for this+ # non-omni model so the frontend popover doesn't render it.+ voice:+ hidden: truediff --git a/src/agentscope/model/_dashscope/_models/qwen3.6-flash.yaml b/src/agentscope/model/_dashscope/_models/qwen3.6-flash.yamlnew file mode 100644index 000000000..bfea31747--- /dev/null+++ b/src/agentscope/model/_dashscope/_models/qwen3.6-flash.yaml@@ -0,0 +1,30 @@+name: qwen3.6-flash+label: Qwen3.6-Flash+status: active++input_types:+ - text/plain+ - application/x-thinking+ - image/bmp+ - image/jpeg+ - image/png+ - image/tiff+ - image/webp+ - image/heic+ - video/mp4++output_types:+ - text/plain+ - application/x-thinking++context_size: 1000000+output_size: 65536++parameter_overrides:+ max_tokens: {"maximum": 65536}+ # Max chain-of-thought is independent of max_tokens.+ thinking_budget: {"maximum": 131072}+ # Voice only applies to omni-style models; hide the field for this+ # non-omni model so the frontend popover doesn't render it.+ voice:+ hidden: truediff --git a/src/agentscope/model/_dashscope/_models/qwen3.7-flash.yaml b/src/agentscope/model/_dashscope/_models/qwen3.7-flash.yamlnew file mode 100644index 000000000..a3bfdd181--- /dev/null+++ b/src/agentscope/model/_dashscope/_models/qwen3.7-flash.yaml@@ -0,0 +1,30 @@+name: qwen3.7-flash+label: Qwen3.7-Flash+status: active++input_types:+ - text/plain+ - application/x-thinking+ - image/bmp+ - image/jpeg+ - image/png+ - image/tiff+ - image/webp+ - image/heic+ - video/mp4++output_types:+ - text/plain+ - application/x-thinking++context_size: 1000000+output_size: 131072++parameter_overrides:+ max_tokens: {"maximum": 131072}+ # Max chain-of-thought is independent of max_tokens.+ thinking_budget: {"maximum": 262144}+ # Voice only applies to omni-style models; hide the field for this+ # non-omni model so the frontend popover doesn't render it.+ voice:+ hidden: truediff --git a/src/agentscope/model/_dashscope/_models/qwen3.8-max.yaml b/src/agentscope/model/_dashscope/_models/qwen3.8-max.yamlnew file mode 100644index 000000000..19a51c51c--- /dev/null+++ b/src/agentscope/model/_dashscope/_models/qwen3.8-max.yaml@@ -0,0 +1,30 @@+name: qwen3.8-max+label: Qwen3.8-Max+status: active++input_types:+ - text/plain+ - application/x-thinking+ - image/bmp+ - image/jpeg+ - image/png+ - image/tiff+ - image/webp+ - image/heic+ - video/mp4++output_types:+ - text/plain+ - application/x-thinking++context_size: 1000000+output_size: 131072++parameter_overrides:+ max_tokens: {"maximum": 131072}+ # Max chain-of-thought is 262144 tokens, independent of max_tokens.+ thinking_budget: {"maximum": 262144}+ # Voice only applies to omni-style models; hide the field for this+ # non-omni model so the frontend popover doesn't render it.+ voice:+ hidden: truediff --git a/src/agentscope/model/_gemini/_models/gemini-2.5-flash-lite.yaml b/src/agentscope/model/_gemini/_models/gemini-2.5-flash-lite.yamlnew file mode 100644index 000000000..08ee25c3a--- /dev/null+++ b/src/agentscope/model/_gemini/_models/gemini-2.5-flash-lite.yaml@@ -0,0 +1,25 @@+name: gemini-2.5-flash-lite+label: Gemini 2.5 Flash-Lite+status: active++input_types:+ - text/plain+ - image/jpeg+ - image/png+ - image/gif+ - image/webp+ - audio/mp3+ - audio/wav+ - video/mp4+ - application/pdf++output_types:+ - text/plain+ - application/x-thinking++context_size: 1048576+output_size: 65536++parameter_overrides:+ max_tokens:+ maximum: 65536diff --git a/src/agentscope/model/_gemini/_models/gemini-3.1-flash-lite.yaml b/src/agentscope/model/_gemini/_models/gemini-3.1-flash-lite.yamlnew file mode 100644index 000000000..2ea92bb23--- /dev/null+++ b/src/agentscope/model/_gemini/_models/gemini-3.1-flash-lite.yaml@@ -0,0 +1,25 @@+name: gemini-3.1-flash-lite+label: Gemini 3.1 Flash-Lite+status: active++input_types:+ - text/plain+ - image/jpeg+ - image/png+ - image/gif+ - image/webp+ - audio/mp3+ - audio/wav+ - video/mp4+ - application/pdf++output_types:+ - text/plain+ - application/x-thinking++context_size: 1048576+output_size: 65536++parameter_overrides:+ max_tokens:+ maximum: 65536diff --git a/src/agentscope/model/_gemini/_models/gemini-3.5-flash-lite.yaml b/src/agentscope/model/_gemini/_models/gemini-3.5-flash-lite.yamlnew file mode 100644index 000000000..09b1e6d4a--- /dev/null+++ b/src/agentscope/model/_gemini/_models/gemini-3.5-flash-lite.yaml@@ -0,0 +1,25 @@+name: gemini-3.5-flash-lite+label: Gemini 3.5 Flash-Lite+status: active++input_types:+ - text/plain+ - image/jpeg+ - image/png+ - image/gif+ - image/webp+ - audio/mp3+ - audio/wav+ - video/mp4+ - application/pdf++output_types:+ - text/plain+ - application/x-thinking++context_size: 1048576+output_size: 65536++parameter_overrides:+ max_tokens:+ maximum: 65536diff --git a/src/agentscope/model/_gemini/_models/gemini-3.5-flash.yaml b/src/agentscope/model/_gemini/_models/gemini-3.5-flash.yamlnew file mode 100644index 000000000..037ca634c--- /dev/null+++ b/src/agentscope/model/_gemini/_models/gemini-3.5-flash.yaml@@ -0,0 +1,25 @@+name: gemini-3.5-flash+label: Gemini 3.5 Flash+status: active++input_types:+ - text/plain+ - image/jpeg+ - image/png+ - image/gif+ - image/webp+ - audio/mp3+ - audio/wav+ - video/mp4+ - application/pdf++output_types:+ - text/plain+ - application/x-thinking++context_size: 1048576+output_size: 65536++parameter_overrides:+ max_tokens:+ maximum: 65536diff --git a/src/agentscope/model/_gemini/_models/gemini-3.6-flash.yaml b/src/agentscope/model/_gemini/_models/gemini-3.6-flash.yamlnew file mode 100644index 000000000..1c48e87fb--- /dev/null+++ b/src/agentscope/model/_gemini/_models/gemini-3.6-flash.yaml@@ -0,0 +1,25 @@+name: gemini-3.6-flash+label: Gemini 3.6 Flash+status: active++input_types:+ - text/plain+ - image/jpeg+ - image/png+ - image/gif+ - image/webp+ - audio/mp3+ - audio/wav+ - video/mp4+ - application/pdf++output_types:+ - text/plain+ - application/x-thinking++context_size: 1048576+output_size: 65536++parameter_overrides:+ max_tokens:+ maximum: 65536diff --git a/src/agentscope/model/_model_card.py b/src/agentscope/model/_model_card.pyindex c5795ecfc..282e5c9ad 100644--- a/src/agentscope/model/_model_card.py+++ b/src/agentscope/model/_model_card.py@@ -102,6 +102,8 @@ class ModelCard(BaseModel):if "application/x-thinking" not in output_types:properties.pop("thinking_enable", None)properties.pop("thinking_budget", None)+ properties.pop("thinking_mode", None)+ properties.pop("thinking_display", None)# Auto-filter: only omni-style models that declare an ``audio/*``# output type expose the ``voice`` parameter to the frontenddiff --git a/src/agentscope/model/_moonshot/_models/kimi-k2.5.yaml b/src/agentscope/model/_moonshot/_models/kimi-k2.5.yamlindex 237ad103e..ee641858b 100644--- a/src/agentscope/model/_moonshot/_models/kimi-k2.5.yaml+++ b/src/agentscope/model/_moonshot/_models/kimi-k2.5.yaml@@ -1,6 +1,7 @@name: kimi-k2.5label: Kimi K2.5-status: active+status: deprecated+deprecated_at: "2026-08-31T00:00:00"input_types:- text/plaindiff --git a/src/agentscope/model/_moonshot/_models/kimi-k2.7-code-highspeed.yaml b/src/agentscope/model/_moonshot/_models/kimi-k2.7-code-highspeed.yamlnew file mode 100644index 000000000..949f9e92a--- /dev/null+++ b/src/agentscope/model/_moonshot/_models/kimi-k2.7-code-highspeed.yaml@@ -0,0 +1,23 @@+name: kimi-k2.7-code-highspeed+label: Kimi K2.7 Code Highspeed+status: active++input_types:+ - text/plain+ - application/x-thinking++output_types:+ - text/plain+ - application/x-thinking++context_size: 262144+# Moonshot publishes no per-model output ceiling; matched to kimi-k2.6,+# which shares the same context window.+output_size: 32768++parameter_overrides:+ max_tokens:+ maximum: 32768+ # Thinking is always on for the Code models and cannot be disabled.+ thinking_enable:+ hidden: truediff --git a/src/agentscope/model/_moonshot/_models/kimi-k2.7-code.yaml b/src/agentscope/model/_moonshot/_models/kimi-k2.7-code.yamlnew file mode 100644index 000000000..9003bd982--- /dev/null+++ b/src/agentscope/model/_moonshot/_models/kimi-k2.7-code.yaml@@ -0,0 +1,23 @@+name: kimi-k2.7-code+label: Kimi K2.7 Code+status: active++input_types:+ - text/plain+ - application/x-thinking++output_types:+ - text/plain+ - application/x-thinking++context_size: 262144+# Moonshot publishes no per-model output ceiling; matched to kimi-k2.6,+# which shares the same context window.+output_size: 32768++parameter_overrides:+ max_tokens:+ maximum: 32768+ # Thinking is always on for the Code models and cannot be disabled.+ thinking_enable:+ hidden: truediff --git a/src/agentscope/model/_moonshot/_models/moonshot-v1-128k.yaml b/src/agentscope/model/_moonshot/_models/moonshot-v1-128k.yamlindex 6f3e112fe..f297ad41f 100644--- a/src/agentscope/model/_moonshot/_models/moonshot-v1-128k.yaml+++ b/src/agentscope/model/_moonshot/_models/moonshot-v1-128k.yaml@@ -1,6 +1,7 @@name: moonshot-v1-128klabel: Kimi Moonshot v1 128K-status: active+status: deprecated+deprecated_at: "2026-08-31T00:00:00"input_types:- text/plaindiff --git a/src/agentscope/model/_moonshot/_models/moonshot-v1-32k.yaml b/src/agentscope/model/_moonshot/_models/moonshot-v1-32k.yamlindex 3ae99026b..e40264f19 100644--- a/src/agentscope/model/_moonshot/_models/moonshot-v1-32k.yaml+++ b/src/agentscope/model/_moonshot/_models/moonshot-v1-32k.yaml@@ -1,6 +1,7 @@name: moonshot-v1-32klabel: Kimi Moonshot v1 32K-status: active+status: deprecated+deprecated_at: "2026-08-31T00:00:00"input_types:- text/plaindiff --git a/src/agentscope/model/_moonshot/_models/moonshot-v1-8k.yaml b/src/agentscope/model/_moonshot/_models/moonshot-v1-8k.yamlindex 8e4149e11..67de5e6c8 100644--- a/src/agentscope/model/_moonshot/_models/moonshot-v1-8k.yaml+++ b/src/agentscope/model/_moonshot/_models/moonshot-v1-8k.yaml@@ -1,6 +1,7 @@name: moonshot-v1-8klabel: Kimi Moonshot v1 8K-status: active+status: deprecated+deprecated_at: "2026-08-31T00:00:00"input_types:- text/plaindiff --git a/src/agentscope/model/_openai_chat/_models/gpt-4.1-nano.yaml b/src/agentscope/model/_openai_chat/_models/gpt-4.1-nano.yamlindex bf26d9d9b..d8cfac057 100644--- a/src/agentscope/model/_openai_chat/_models/gpt-4.1-nano.yaml+++ b/src/agentscope/model/_openai_chat/_models/gpt-4.1-nano.yaml@@ -1,6 +1,7 @@name: gpt-4.1-nanolabel: GPT-4.1 Nano-status: active+status: deprecated+deprecated_at: "2026-10-23T00:00:00"input_types:- text/plaindiff --git a/src/agentscope/model/_openai_chat/_models/gpt-5.5.yaml b/src/agentscope/model/_openai_chat/_models/gpt-5.5.yamlindex 1e009e393..75ed83d21 100644--- a/src/agentscope/model/_openai_chat/_models/gpt-5.5.yaml+++ b/src/agentscope/model/_openai_chat/_models/gpt-5.5.yaml@@ -8,8 +8,6 @@ input_types:- image/png- image/gif- image/webp- - audio/mp3- - audio/wavoutput_types:- text/plaindiff --git a/src/agentscope/model/_openai_chat/_models/gpt-5.6-luna.yaml b/src/agentscope/model/_openai_chat/_models/gpt-5.6-luna.yamlnew file mode 100644index 000000000..4a77d13da--- /dev/null+++ b/src/agentscope/model/_openai_chat/_models/gpt-5.6-luna.yaml@@ -0,0 +1,28 @@+name: gpt-5.6-luna+label: GPT-5.6 Luna+status: active++input_types:+ - text/plain+ - image/jpeg+ - image/png+ - image/gif+ - image/webp++output_types:+ - text/plain++context_size: 1050000+output_size: 128000++parameter_overrides:+ max_tokens:+ maximum: 128000+ # Reasoning happens internally and is never returned as content, so the+ # thinking toggle has nothing to surface — reasoning_effort is the knob.+ thinking_enable:+ hidden: true+ # Voice only applies to omni-style models; hide the field for this+ # non-omni model so the frontend popover doesn't render it.+ voice:+ hidden: truediff --git a/src/agentscope/model/_openai_chat/_models/gpt-5.6-sol.yaml b/src/agentscope/model/_openai_chat/_models/gpt-5.6-sol.yamlnew file mode 100644index 000000000..23126dbc8--- /dev/null+++ b/src/agentscope/model/_openai_chat/_models/gpt-5.6-sol.yaml@@ -0,0 +1,28 @@+name: gpt-5.6-sol+label: GPT-5.6 Sol+status: active++input_types:+ - text/plain+ - image/jpeg+ - image/png+ - image/gif+ - image/webp++output_types:+ - text/plain++context_size: 1050000+output_size: 128000++parameter_overrides:+ max_tokens:+ maximum: 128000+ # Reasoning happens internally and is never returned as content, so the+ # thinking toggle has nothing to surface — reasoning_effort is the knob.+ thinking_enable:+ hidden: true+ # Voice only applies to omni-style models; hide the field for this+ # non-omni model so the frontend popover doesn't render it.+ voice:+ hidden: truediff --git a/src/agentscope/model/_openai_chat/_models/gpt-5.6-terra.yaml b/src/agentscope/model/_openai_chat/_models/gpt-5.6-terra.yamlnew file mode 100644index 000000000..0688ce0f3--- /dev/null+++ b/src/agentscope/model/_openai_chat/_models/gpt-5.6-terra.yaml@@ -0,0 +1,28 @@+name: gpt-5.6-terra+label: GPT-5.6 Terra+status: active++input_types:+ - text/plain+ - image/jpeg+ - image/png+ - image/gif+ - image/webp++output_types:+ - text/plain++context_size: 1050000+output_size: 128000++parameter_overrides:+ max_tokens:+ maximum: 128000+ # Reasoning happens internally and is never returned as content, so the+ # thinking toggle has nothing to surface — reasoning_effort is the knob.+ thinking_enable:+ hidden: true+ # Voice only applies to omni-style models; hide the field for this+ # non-omni model so the frontend popover doesn't render it.+ voice:+ hidden: truediff --git a/src/agentscope/model/_openai_chat/_models/gpt-audio-mini.yaml b/src/agentscope/model/_openai_chat/_models/gpt-audio-mini.yamlindex 5877d6832..d6eaa8780 100644--- a/src/agentscope/model/_openai_chat/_models/gpt-audio-mini.yaml+++ b/src/agentscope/model/_openai_chat/_models/gpt-audio-mini.yaml@@ -1,6 +1,7 @@name: gpt-audio-minilabel: GPT Audio Mini-status: active+status: deprecated+deprecated_at: "2027-01-20T00:00:00"input_types:- text/plaindiff --git a/src/agentscope/model/_openai_chat/_models/o3.yaml b/src/agentscope/model/_openai_chat/_models/o3.yamlindex 13e7762aa..78473d0c7 100644--- a/src/agentscope/model/_openai_chat/_models/o3.yaml+++ b/src/agentscope/model/_openai_chat/_models/o3.yaml@@ -1,6 +1,7 @@name: o3label: o3-status: active+status: deprecated+deprecated_at: "2026-12-11T00:00:00"input_types:- text/plaindiff --git a/src/agentscope/model/_openai_chat/_models/o4-mini.yaml b/src/agentscope/model/_openai_chat/_models/o4-mini.yamlindex ab2e91192..87fbcd9eb 100644--- a/src/agentscope/model/_openai_chat/_models/o4-mini.yaml+++ b/src/agentscope/model/_openai_chat/_models/o4-mini.yaml@@ -1,6 +1,7 @@name: o4-minilabel: o4-mini-status: active+status: deprecated+deprecated_at: "2026-10-23T00:00:00"input_types:- text/plaindiff --git a/src/agentscope/model/_openai_response/_models/gpt-4.1-nano.yaml b/src/agentscope/model/_openai_response/_models/gpt-4.1-nano.yamlindex 5a067a036..34f000ffc 100644--- a/src/agentscope/model/_openai_response/_models/gpt-4.1-nano.yaml+++ b/src/agentscope/model/_openai_response/_models/gpt-4.1-nano.yaml@@ -1,6 +1,7 @@name: gpt-4.1-nanolabel: GPT-4.1 Nano-status: active+status: deprecated+deprecated_at: "2026-10-23T00:00:00"input_types:- text/plaindiff --git a/src/agentscope/model/_openai_response/_models/gpt-5.5.yaml b/src/agentscope/model/_openai_response/_models/gpt-5.5.yamlindex 746c4f516..34c92a47b 100644--- a/src/agentscope/model/_openai_response/_models/gpt-5.5.yaml+++ b/src/agentscope/model/_openai_response/_models/gpt-5.5.yaml@@ -8,8 +8,6 @@ input_types:- image/png- image/gif- image/webp- - audio/mp3- - audio/wavoutput_types:- text/plaindiff --git a/src/agentscope/model/_openai_response/_models/gpt-5.6-luna.yaml b/src/agentscope/model/_openai_response/_models/gpt-5.6-luna.yamlnew file mode 100644index 000000000..2817d739a--- /dev/null+++ b/src/agentscope/model/_openai_response/_models/gpt-5.6-luna.yaml@@ -0,0 +1,24 @@+name: gpt-5.6-luna+label: GPT-5.6 Luna+status: active++input_types:+ - text/plain+ - image/jpeg+ - image/png+ - image/gif+ - image/webp++output_types:+ - text/plain++context_size: 1050000+output_size: 128000++parameter_overrides:+ max_tokens:+ maximum: 128000+ # Reasoning happens internally and is never returned as content, so the+ # thinking toggle has nothing to surface — reasoning_effort is the knob.+ thinking_enable:+ hidden: truediff --git a/src/agentscope/model/_openai_response/_models/gpt-5.6-sol.yaml b/src/agentscope/model/_openai_response/_models/gpt-5.6-sol.yamlnew file mode 100644index 000000000..ee21e20c8--- /dev/null+++ b/src/agentscope/model/_openai_response/_models/gpt-5.6-sol.yaml@@ -0,0 +1,24 @@+name: gpt-5.6-sol+label: GPT-5.6 Sol+status: active++input_types:+ - text/plain+ - image/jpeg+ - image/png+ - image/gif+ - image/webp++output_types:+ - text/plain++context_size: 1050000+output_size: 128000++parameter_overrides:+ max_tokens:+ maximum: 128000+ # Reasoning happens internally and is never returned as content, so the+ # thinking toggle has nothing to surface — reasoning_effort is the knob.+ thinking_enable:+ hidden: truediff --git a/src/agentscope/model/_openai_response/_models/gpt-5.6-terra.yaml b/src/agentscope/model/_openai_response/_models/gpt-5.6-terra.yamlnew file mode 100644index 000000000..b7c3535a6--- /dev/null+++ b/src/agentscope/model/_openai_response/_models/gpt-5.6-terra.yaml@@ -0,0 +1,24 @@+name: gpt-5.6-terra+label: GPT-5.6 Terra+status: active++input_types:+ - text/plain+ - image/jpeg+ - image/png+ - image/gif+ - image/webp++output_types:+ - text/plain++context_size: 1050000+output_size: 128000++parameter_overrides:+ max_tokens:+ maximum: 128000+ # Reasoning happens internally and is never returned as content, so the+ # thinking toggle has nothing to surface — reasoning_effort is the knob.+ thinking_enable:+ hidden: truediff --git a/src/agentscope/model/_openai_response/_models/o3.yaml b/src/agentscope/model/_openai_response/_models/o3.yamlindex a891bd1be..8cd74f603 100644--- a/src/agentscope/model/_openai_response/_models/o3.yaml+++ b/src/agentscope/model/_openai_response/_models/o3.yaml@@ -1,6 +1,7 @@name: o3label: o3 (Responses API)-status: active+status: deprecated+deprecated_at: "2026-12-11T00:00:00"input_types:- text/plaindiff --git a/src/agentscope/model/_openai_response/_models/o4-mini.yaml b/src/agentscope/model/_openai_response/_models/o4-mini.yamlindex 587223a31..a8cd18a4f 100644--- a/src/agentscope/model/_openai_response/_models/o4-mini.yaml+++ b/src/agentscope/model/_openai_response/_models/o4-mini.yaml@@ -1,6 +1,7 @@name: o4-minilabel: o4-mini (Responses API)-status: active+status: deprecated+deprecated_at: "2026-10-23T00:00:00"input_types:- text/plaindiff --git a/src/agentscope/model/_xai/_models/grok-3-fast.yaml b/src/agentscope/model/_xai/_models/grok-3-fast.yamlindex 66be7ded9..0ebe34296 100644--- a/src/agentscope/model/_xai/_models/grok-3-fast.yaml+++ b/src/agentscope/model/_xai/_models/grok-3-fast.yaml@@ -1,6 +1,6 @@name: grok-3-fastlabel: Grok 3 Fast-status: active+status: deprecatedinput_types:- text/plaindiff --git a/src/agentscope/model/_xai/_models/grok-3-mini.yaml b/src/agentscope/model/_xai/_models/grok-3-mini.yamlindex 04f100adc..5e118dce2 100644--- a/src/agentscope/model/_xai/_models/grok-3-mini.yaml+++ b/src/agentscope/model/_xai/_models/grok-3-mini.yaml@@ -1,6 +1,6 @@name: grok-3-minilabel: Grok 3 Mini-status: active+status: deprecatedinput_types:- text/plaindiff --git a/src/agentscope/model/_xai/_models/grok-3.yaml b/src/agentscope/model/_xai/_models/grok-3.yamlindex 6a04c98fe..6618b8f9f 100644--- a/src/agentscope/model/_xai/_models/grok-3.yaml+++ b/src/agentscope/model/_xai/_models/grok-3.yaml@@ -1,6 +1,6 @@name: grok-3label: Grok 3-status: active+status: deprecatedinput_types:- text/plaindiff --git a/src/agentscope/model/_xai/_models/grok-4.20-0309-non-reasoning.yaml b/src/agentscope/model/_xai/_models/grok-4.20-0309-non-reasoning.yamlnew file mode 100644index 000000000..8f7b501e6--- /dev/null+++ b/src/agentscope/model/_xai/_models/grok-4.20-0309-non-reasoning.yaml@@ -0,0 +1,23 @@+name: grok-4.20-0309-non-reasoning+label: Grok 4.20 Non-Reasoning+status: active++input_types:+ - text/plain++output_types:+ - text/plain++context_size: 1000000+# xAI publishes no max-output figure for any Grok model. Derived as 1/16 of+# the context window, matching the ratio of providers that do publish one.+output_size: 64000++parameter_overrides:+ max_tokens:+ maximum: 64000+ # This variant never reasons; its sibling grok-4.20-0309-reasoning does.+ thinking_enable:+ hidden: true+ reasoning_effort:+ hidden: truediff --git a/src/agentscope/model/_xai/_models/grok-4.20-0309-reasoning.yaml b/src/agentscope/model/_xai/_models/grok-4.20-0309-reasoning.yamlnew file mode 100644index 000000000..e3a2d6369--- /dev/null+++ b/src/agentscope/model/_xai/_models/grok-4.20-0309-reasoning.yaml@@ -0,0 +1,19 @@+name: grok-4.20-0309-reasoning+label: Grok 4.20 Reasoning+status: active++input_types:+ - text/plain++output_types:+ - text/plain+ - application/x-thinking++context_size: 1000000+# xAI publishes no max-output figure for any Grok model. Derived as 1/16 of+# the context window, matching the ratio of providers that do publish one.+output_size: 64000++parameter_overrides:+ max_tokens:+ maximum: 64000diff --git a/src/agentscope/model/_xai/_models/grok-4.20-multi-agent-0309.yaml b/src/agentscope/model/_xai/_models/grok-4.20-multi-agent-0309.yamlnew file mode 100644index 000000000..0fba29a5c--- /dev/null+++ b/src/agentscope/model/_xai/_models/grok-4.20-multi-agent-0309.yaml@@ -0,0 +1,19 @@+name: grok-4.20-multi-agent-0309+label: Grok 4.20 Multi-Agent+status: active++input_types:+ - text/plain++output_types:+ - text/plain+ - application/x-thinking++context_size: 1000000+# xAI publishes no max-output figure for any Grok model. Derived as 1/16 of+# the context window, matching the ratio of providers that do publish one.+output_size: 64000++parameter_overrides:+ max_tokens:+ maximum: 64000diff --git a/src/agentscope/model/_xai/_models/grok-4.3.yaml b/src/agentscope/model/_xai/_models/grok-4.3.yamlindex 4b712ef44..916f1ea14 100644--- a/src/agentscope/model/_xai/_models/grok-4.3.yaml+++ b/src/agentscope/model/_xai/_models/grok-4.3.yaml@@ -12,8 +12,10 @@ output_types:- application/x-thinkingcontext_size: 1000000-output_size: 30000+# xAI publishes no max-output figure for any Grok model. Derived as 1/16 of+# the context window, matching the ratio of providers that do publish one.+output_size: 64000parameter_overrides:max_tokens:- maximum: 30000+ maximum: 64000diff --git a/src/agentscope/model/_xai/_models/grok-4.5.yaml b/src/agentscope/model/_xai/_models/grok-4.5.yamlnew file mode 100644index 000000000..21d5bd3d2--- /dev/null+++ b/src/agentscope/model/_xai/_models/grok-4.5.yaml@@ -0,0 +1,21 @@+name: grok-4.5+label: Grok 4.5+status: active++input_types:+ - text/plain+ - image/jpeg+ - image/png++output_types:+ - text/plain+ - application/x-thinking++context_size: 500000+# xAI publishes no max-output figure for any Grok model. Derived as 1/16 of+# the context window, matching the ratio of providers that do publish one.+output_size: 32000++parameter_overrides:+ max_tokens:+ maximum: 32000diff --git a/src/agentscope/model/_xai/_models/grok-build-0.1.yaml b/src/agentscope/model/_xai/_models/grok-build-0.1.yamlnew file mode 100644index 000000000..6eed6e431--- /dev/null+++ b/src/agentscope/model/_xai/_models/grok-build-0.1.yaml@@ -0,0 +1,19 @@+name: grok-build-0.1+label: Grok Build 0.1+status: active++input_types:+ - text/plain++output_types:+ - text/plain+ - application/x-thinking++context_size: 256000+# xAI publishes no max-output figure for any Grok model. Derived as 1/16 of+# the context window, matching the ratio of providers that do publish one.+output_size: 16000++parameter_overrides:+ max_tokens:+ maximum: 16000diff --git a/tests/model_anthropic_test.py b/tests/model_anthropic_test.pyindex 87853afc7..d45363708 100644--- a/tests/model_anthropic_test.py+++ b/tests/model_anthropic_test.py@@ -255,6 +255,164 @@ class TestAnthropicNonStream(IsolatedAsyncioTestCase):)+class TestAnthropicEffort(IsolatedAsyncioTestCase):+ """Tests for the ``reasoning_effort`` parameter."""++ def setUp(self) -> None:+ self.model = _make_model(stream=False)+ self.mock_client = MagicMock()+ self.model.client = self.mock_client+ self.mock_create = AsyncMock(return_value=_mock_completion(text="hi"))+ self.mock_client.messages.create = self.mock_create++ async def test_effort_omitted_by_default(self) -> None:+ """No output_config is sent when reasoning_effort is unset."""+ await self.model([])++ self.assertNotIn("output_config", self.mock_create.call_args.kwargs)++ async def test_effort_nested_in_output_config(self) -> None:+ """Effort travels inside output_config, not as a top-level field."""+ self.model.parameters.reasoning_effort = "medium"++ await self.model([])++ kwargs = self.mock_create.call_args.kwargs+ self.assertEqual(kwargs["output_config"], {"effort": "medium"})+ self.assertNotIn("effort", kwargs)++ async def test_effort_coexists_with_thinking(self) -> None:+ """Effort and extended thinking are independent controls."""+ self.model.parameters.reasoning_effort = "max"+ self.model.parameters.thinking_enable = True+ self.model.parameters.thinking_budget = 1024++ await self.model([])++ kwargs = self.mock_create.call_args.kwargs+ self.assertEqual(kwargs["output_config"], {"effort": "max"})+ self.assertEqual(+ kwargs["thinking"],+ {"type": "enabled", "budget_tokens": 1024},+ )++ async def test_caller_output_config_wins(self) -> None:+ """An explicit output_config kwarg is not overwritten."""+ self.model.parameters.reasoning_effort = "low"++ await self.model([], output_config={"effort": "high"})++ self.assertEqual(+ self.mock_create.call_args.kwargs["output_config"],+ {"effort": "high"},+ )+++class TestAnthropicThinkingMode(IsolatedAsyncioTestCase):+ """Tests for adaptive vs budget-based thinking configuration."""++ def setUp(self) -> None:+ self.model = _make_model(stream=False)+ self.mock_client = MagicMock()+ self.model.client = self.mock_client+ self.mock_create = AsyncMock(return_value=_mock_completion(text="hi"))+ self.mock_client.messages.create = self.mock_create++ def _thinking(self) -> Any:+ return self.mock_create.call_args.kwargs.get("thinking")++ async def test_no_thinking_by_default(self) -> None:+ """Neither control set means no thinking config is sent."""+ await self.model([])++ self.assertIsNone(self._thinking())++ async def test_adaptive_carries_no_budget(self) -> None:+ """Adaptive mode must not send budget_tokens, which it rejects."""+ self.model.parameters.thinking_mode = "adaptive"+ self.model.parameters.thinking_budget = 4096++ await self.model([])++ self.assertEqual(self._thinking(), {"type": "adaptive"})++ async def test_adaptive_with_display(self) -> None:+ """Display is what makes thinking text visible on newer models."""+ self.model.parameters.thinking_mode = "adaptive"+ self.model.parameters.thinking_display = "summarized"++ await self.model([])++ self.assertEqual(+ self._thinking(),+ {"type": "adaptive", "display": "summarized"},+ )++ async def test_disabled_drops_display(self) -> None:+ """Display is invalid alongside type: disabled."""+ self.model.parameters.thinking_mode = "disabled"+ self.model.parameters.thinking_display = "summarized"++ await self.model([])++ self.assertEqual(self._thinking(), {"type": "disabled"})++ async def test_legacy_toggle_still_means_budget_mode(self) -> None:+ """thinking_enable keeps its old meaning when mode is unset."""+ self.model.parameters.thinking_enable = True+ self.model.parameters.thinking_budget = 2048++ await self.model([])++ self.assertEqual(+ self._thinking(),+ {"type": "enabled", "budget_tokens": 2048},+ )++ async def test_mode_overrides_legacy_toggle(self) -> None:+ """An explicit mode wins over the legacy boolean."""+ self.model.parameters.thinking_enable = True+ self.model.parameters.thinking_mode = "adaptive"++ await self.model([])++ self.assertEqual(self._thinking(), {"type": "adaptive"})++ async def test_budget_mode_expands_max_tokens(self) -> None:+ """max_tokens must stay strictly above budget_tokens."""+ self.model.parameters.thinking_mode = "enabled"+ self.model.parameters.thinking_budget = 8192++ await self.model([])++ kwargs = self.mock_create.call_args.kwargs+ self.assertEqual(kwargs["thinking"]["budget_tokens"], 8192)+ self.assertGreater(kwargs["max_tokens"], 8192)++ def test_resolved_mode_drives_tool_choice_downgrade(self) -> None:+ """Only budget mode forbids forced tool use, so only it downgrades.++ ``_call_api_with_structured_output`` keys the downgrade off this+ resolution — adaptive must not trip it.+ """+ cases = [+ ({}, None),+ ({"thinking_enable": True}, "enabled"),+ ({"thinking_mode": "enabled"}, "enabled"),+ ({"thinking_mode": "adaptive"}, None),+ ({"thinking_mode": "disabled"}, None),+ ({"thinking_enable": True, "thinking_mode": "adaptive"}, None),+ ]+ for params, expected in cases:+ with self.subTest(params=params):+ model = _make_model()+ for key, val in params.items():+ setattr(model.parameters, key, val)+ resolved = model._thinking_mode()+ downgrades = resolved == "enabled"+ self.assertEqual(downgrades, expected == "enabled")++# ---------------------------------------------------------------------------# Streaming tests# ---------------------------------------------------------------------------