"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations from openrouter.types import BaseModel, Nullable, UnrecognizedStr from openrouter.utils import validate_open_enum from pydantic.functional_validators import PlainValidator from typing import Any, Dict, List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict FusionServerToolConfigEffort = Union[ Literal[ "xhigh", "high", "medium", "low", "minimal", "none", ], UnrecognizedStr, ] r"""Reasoning effort level for panelist and judge inner calls.""" class FusionServerToolConfigReasoningTypedDict(TypedDict): r"""Reasoning configuration forwarded to panelist and judge inner calls. Use this to control reasoning effort and token budget for models that support extended thinking.""" effort: NotRequired[FusionServerToolConfigEffort] r"""Reasoning effort level for panelist and judge inner calls.""" max_tokens: NotRequired[int] r"""Maximum number of reasoning tokens each panelist and judge model may use. Helps bound cost when models allocate too much budget to chain-of-thought.""" class FusionServerToolConfigReasoning(BaseModel): r"""Reasoning configuration forwarded to panelist and judge inner calls. Use this to control reasoning effort and token budget for models that support extended thinking.""" effort: Annotated[ Optional[FusionServerToolConfigEffort], PlainValidator(validate_open_enum(False)), ] = None r"""Reasoning effort level for panelist and judge inner calls.""" max_tokens: Optional[int] = None r"""Maximum number of reasoning tokens each panelist and judge model may use. Helps bound cost when models allocate too much budget to chain-of-thought.""" class FusionServerToolConfigToolTypedDict(TypedDict): type: str r"""Server tool type identifier (e.g. \"openrouter:web_search\", \"openrouter:web_fetch\").""" parameters: NotRequired[Dict[str, Nullable[Any]]] r"""Optional configuration forwarded as the tool's `parameters` object.""" class FusionServerToolConfigTool(BaseModel): type: str r"""Server tool type identifier (e.g. \"openrouter:web_search\", \"openrouter:web_fetch\").""" parameters: Optional[Dict[str, Nullable[Any]]] = None r"""Optional configuration forwarded as the tool's `parameters` object.""" class FusionServerToolConfigTypedDict(TypedDict): r"""Configuration for the openrouter:fusion server tool.""" analysis_models: NotRequired[List[str]] r"""Slugs of models to run in parallel as the analysis panel. Each model receives the user prompt with openrouter:web_search and openrouter:web_fetch enabled, then a judge model summarizes the collective output into structured analysis JSON. Capped at 8 models to bound cost amplification. Defaults to the Quality preset from /labs/fusion.""" max_completion_tokens: NotRequired[int] r"""Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, the provider's default applies.""" max_tool_calls: NotRequired[int] r"""Maximum number of tool-calling steps each panelist (analysis model) and the judge model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 8. Capped at 16.""" model: NotRequired[str] r"""Slug of the judge model that produces the structured analysis JSON. Defaults to the model used in the outer API request.""" reasoning: NotRequired[FusionServerToolConfigReasoningTypedDict] r"""Reasoning configuration forwarded to panelist and judge inner calls. Use this to control reasoning effort and token budget for models that support extended thinking.""" temperature: NotRequired[float] r"""Sampling temperature forwarded to panelist and judge inner calls. When omitted, the provider's default applies.""" tools: NotRequired[List[FusionServerToolConfigToolTypedDict]] r"""Server tools available to panelist and judge inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: \"openrouter:web_search\" }, { type: \"openrouter:web_fetch\" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only).""" class FusionServerToolConfig(BaseModel): r"""Configuration for the openrouter:fusion server tool.""" analysis_models: Optional[List[str]] = None r"""Slugs of models to run in parallel as the analysis panel. Each model receives the user prompt with openrouter:web_search and openrouter:web_fetch enabled, then a judge model summarizes the collective output into structured analysis JSON. Capped at 8 models to bound cost amplification. Defaults to the Quality preset from /labs/fusion.""" max_completion_tokens: Optional[int] = None r"""Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, the provider's default applies.""" max_tool_calls: Optional[int] = None r"""Maximum number of tool-calling steps each panelist (analysis model) and the judge model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 8. Capped at 16.""" model: Optional[str] = None r"""Slug of the judge model that produces the structured analysis JSON. Defaults to the model used in the outer API request.""" reasoning: Optional[FusionServerToolConfigReasoning] = None r"""Reasoning configuration forwarded to panelist and judge inner calls. Use this to control reasoning effort and token budget for models that support extended thinking.""" temperature: Optional[float] = None r"""Sampling temperature forwarded to panelist and judge inner calls. When omitted, the provider's default applies.""" tools: Optional[List[FusionServerToolConfigTool]] = None r"""Server tools available to panelist and judge inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: \"openrouter:web_search\" }, { type: \"openrouter:web_fetch\" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only)."""