## Python SDK Changes:

* `open_router.benchmarks.get_benchmarks()`: **Added**
* `open_router.datasets.get_benchmarks_artificial_analysis()`: **Deleted** **Breaking** ⚠️
* `open_router.datasets.get_benchmarks_design_arena()`: **Deleted** **Breaking** ⚠️
* `open_router.chat.send()`:  `response` **Changed**
* `open_router.embeddings.generate()`:  `response.usage` **Changed**
* `open_router.embeddings.list_models()`:  `response.data.[].reasoning` **Added**
* `open_router.models.get()`:  `response.data.reasoning` **Added**
* `open_router.models.list()`:  `response.data.[].reasoning` **Added**
* `open_router.models.list_for_user()`:  `response.data.[].reasoning` **Added**
This commit is contained in:
speakeasybot
2026-06-22 16:37:22 +00:00
parent 7b4b9feaa5
commit f5ba09f0c9
34 changed files with 1640 additions and 1730 deletions
+75 -78
View File
@@ -276,38 +276,6 @@ if TYPE_CHECKING:
BashServerToolEnvironment,
BashServerToolEnvironmentTypedDict,
)
from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict
from .benchmarksaaitem import BenchmarksAAItem, BenchmarksAAItemTypedDict
from .benchmarksaameta import (
BenchmarksAAMeta,
BenchmarksAAMetaSource,
BenchmarksAAMetaSourceURL,
BenchmarksAAMetaTypedDict,
BenchmarksAAMetaVersion,
)
from .benchmarksaaresponse import (
BenchmarksAAResponse,
BenchmarksAAResponseTypedDict,
)
from .benchmarksdaitem import (
BenchmarksDAItem,
BenchmarksDAItemTypedDict,
TournamentStats,
TournamentStatsTypedDict,
)
from .benchmarksdameta import (
BenchmarksDAMeta,
BenchmarksDAMetaSource,
BenchmarksDAMetaSourceURL,
BenchmarksDAMetaTypedDict,
BenchmarksDAMetaVersion,
EloBounds,
EloBoundsTypedDict,
)
from .benchmarksdaresponse import (
BenchmarksDAResponse,
BenchmarksDAResponseTypedDict,
)
from .bulkaddworkspacemembersrequest import (
BulkAddWorkspaceMembersRequest,
BulkAddWorkspaceMembersRequestTypedDict,
@@ -559,6 +527,8 @@ if TYPE_CHECKING:
CompletionTokensDetailsTypedDict,
PromptTokensDetails,
PromptTokensDetailsTypedDict,
ServerToolUseDetails,
ServerToolUseDetailsTypedDict,
)
from .chatusermessage import (
ChatUserMessage,
@@ -1436,6 +1406,7 @@ if TYPE_CHECKING:
from .modelbenchmarks import ModelBenchmarks, ModelBenchmarksTypedDict
from .modelgroup import ModelGroup
from .modellinks import ModelLinks, ModelLinksTypedDict
from .modelreasoning import DefaultEffort, ModelReasoning, ModelReasoningTypedDict
from .modelresponse import ModelResponse, ModelResponseTypedDict
from .modelscountresponse import (
ModelsCountResponse,
@@ -2348,6 +2319,34 @@ if TYPE_CHECKING:
UnauthorizedResponseErrorData,
UnauthorizedResponseErrorDataTypedDict,
)
from .unifiedbenchmarkpricing import (
UnifiedBenchmarkPricing,
UnifiedBenchmarkPricingTypedDict,
)
from .unifiedbenchmarksaaitem import (
UnifiedBenchmarksAAItem,
UnifiedBenchmarksAAItemSource,
UnifiedBenchmarksAAItemTypedDict,
)
from .unifiedbenchmarksdaitem import (
TournamentStats,
TournamentStatsTypedDict,
UnifiedBenchmarksDAItem,
UnifiedBenchmarksDAItemSource,
UnifiedBenchmarksDAItemTypedDict,
)
from .unifiedbenchmarksmeta import (
UnifiedBenchmarksMeta,
UnifiedBenchmarksMetaSource,
UnifiedBenchmarksMetaTypedDict,
UnifiedBenchmarksMetaVersion,
)
from .unifiedbenchmarksresponse import (
Data,
DataTypedDict,
UnifiedBenchmarksResponse,
UnifiedBenchmarksResponseTypedDict,
)
from .unprocessableentityresponseerrordata import (
UnprocessableEntityResponseErrorData,
UnprocessableEntityResponseErrorDataTypedDict,
@@ -2728,26 +2727,6 @@ __all__ = [
"BashServerToolEnvironmentTypedDict",
"BashServerToolType",
"BashServerToolTypedDict",
"BenchmarkPricing",
"BenchmarkPricingTypedDict",
"BenchmarksAAItem",
"BenchmarksAAItemTypedDict",
"BenchmarksAAMeta",
"BenchmarksAAMetaSource",
"BenchmarksAAMetaSourceURL",
"BenchmarksAAMetaTypedDict",
"BenchmarksAAMetaVersion",
"BenchmarksAAResponse",
"BenchmarksAAResponseTypedDict",
"BenchmarksDAItem",
"BenchmarksDAItemTypedDict",
"BenchmarksDAMeta",
"BenchmarksDAMetaSource",
"BenchmarksDAMetaSourceURL",
"BenchmarksDAMetaTypedDict",
"BenchmarksDAMetaVersion",
"BenchmarksDAResponse",
"BenchmarksDAResponseTypedDict",
"BulkAddWorkspaceMembersRequest",
"BulkAddWorkspaceMembersRequestTypedDict",
"BulkAddWorkspaceMembersResponse",
@@ -3069,13 +3048,16 @@ __all__ = [
"CustomToolTypedDict",
"DABenchmarkEntry",
"DABenchmarkEntryTypedDict",
"Data",
"DataCollection",
"DataRegion",
"DataTypedDict",
"DatetimeServerTool",
"DatetimeServerToolConfig",
"DatetimeServerToolConfigTypedDict",
"DatetimeServerToolType",
"DatetimeServerToolTypedDict",
"DefaultEffort",
"DefaultParameters",
"DefaultParametersTypedDict",
"DeleteBYOKKeyResponse",
@@ -3120,8 +3102,6 @@ __all__ = [
"EditCompact20260112TypedDict",
"EditTypeInputTokens",
"EditTypedDict",
"EloBounds",
"EloBoundsTypedDict",
"EndpointInfo",
"EndpointInfoTypedDict",
"EndpointStatus",
@@ -3518,6 +3498,8 @@ __all__ = [
"ModelGroup",
"ModelLinks",
"ModelLinksTypedDict",
"ModelReasoning",
"ModelReasoningTypedDict",
"ModelResponse",
"ModelResponseTypedDict",
"ModelTypedDict",
@@ -4076,6 +4058,8 @@ __all__ = [
"SearchQualityLevel",
"Security",
"SecurityTypedDict",
"ServerToolUseDetails",
"ServerToolUseDetailsTypedDict",
"ServiceUnavailableResponseErrorData",
"ServiceUnavailableResponseErrorDataTypedDict",
"ShellCallItem",
@@ -4277,6 +4261,20 @@ __all__ = [
"URLCitationTypedDict",
"UnauthorizedResponseErrorData",
"UnauthorizedResponseErrorDataTypedDict",
"UnifiedBenchmarkPricing",
"UnifiedBenchmarkPricingTypedDict",
"UnifiedBenchmarksAAItem",
"UnifiedBenchmarksAAItemSource",
"UnifiedBenchmarksAAItemTypedDict",
"UnifiedBenchmarksDAItem",
"UnifiedBenchmarksDAItemSource",
"UnifiedBenchmarksDAItemTypedDict",
"UnifiedBenchmarksMeta",
"UnifiedBenchmarksMetaSource",
"UnifiedBenchmarksMetaTypedDict",
"UnifiedBenchmarksMetaVersion",
"UnifiedBenchmarksResponse",
"UnifiedBenchmarksResponseTypedDict",
"UniqueInsight",
"UniqueInsightTypedDict",
"UnprocessableEntityResponseErrorData",
@@ -4569,30 +4567,6 @@ _dynamic_imports: dict[str, str] = {
"BashServerToolEngine": ".bashservertoolengine",
"BashServerToolEnvironment": ".bashservertoolenvironment",
"BashServerToolEnvironmentTypedDict": ".bashservertoolenvironment",
"BenchmarkPricing": ".benchmarkpricing",
"BenchmarkPricingTypedDict": ".benchmarkpricing",
"BenchmarksAAItem": ".benchmarksaaitem",
"BenchmarksAAItemTypedDict": ".benchmarksaaitem",
"BenchmarksAAMeta": ".benchmarksaameta",
"BenchmarksAAMetaSource": ".benchmarksaameta",
"BenchmarksAAMetaSourceURL": ".benchmarksaameta",
"BenchmarksAAMetaTypedDict": ".benchmarksaameta",
"BenchmarksAAMetaVersion": ".benchmarksaameta",
"BenchmarksAAResponse": ".benchmarksaaresponse",
"BenchmarksAAResponseTypedDict": ".benchmarksaaresponse",
"BenchmarksDAItem": ".benchmarksdaitem",
"BenchmarksDAItemTypedDict": ".benchmarksdaitem",
"TournamentStats": ".benchmarksdaitem",
"TournamentStatsTypedDict": ".benchmarksdaitem",
"BenchmarksDAMeta": ".benchmarksdameta",
"BenchmarksDAMetaSource": ".benchmarksdameta",
"BenchmarksDAMetaSourceURL": ".benchmarksdameta",
"BenchmarksDAMetaTypedDict": ".benchmarksdameta",
"BenchmarksDAMetaVersion": ".benchmarksdameta",
"EloBounds": ".benchmarksdameta",
"EloBoundsTypedDict": ".benchmarksdameta",
"BenchmarksDAResponse": ".benchmarksdaresponse",
"BenchmarksDAResponseTypedDict": ".benchmarksdaresponse",
"BulkAddWorkspaceMembersRequest": ".bulkaddworkspacemembersrequest",
"BulkAddWorkspaceMembersRequestTypedDict": ".bulkaddworkspacemembersrequest",
"BulkAddWorkspaceMembersResponse": ".bulkaddworkspacemembersresponse",
@@ -4772,6 +4746,8 @@ _dynamic_imports: dict[str, str] = {
"CompletionTokensDetailsTypedDict": ".chatusage",
"PromptTokensDetails": ".chatusage",
"PromptTokensDetailsTypedDict": ".chatusage",
"ServerToolUseDetails": ".chatusage",
"ServerToolUseDetailsTypedDict": ".chatusage",
"ChatUserMessage": ".chatusermessage",
"ChatUserMessageContent": ".chatusermessage",
"ChatUserMessageContentTypedDict": ".chatusermessage",
@@ -5459,6 +5435,9 @@ _dynamic_imports: dict[str, str] = {
"ModelGroup": ".modelgroup",
"ModelLinks": ".modellinks",
"ModelLinksTypedDict": ".modellinks",
"DefaultEffort": ".modelreasoning",
"ModelReasoning": ".modelreasoning",
"ModelReasoningTypedDict": ".modelreasoning",
"ModelResponse": ".modelresponse",
"ModelResponseTypedDict": ".modelresponse",
"ModelsCountResponse": ".modelscountresponse",
@@ -6127,6 +6106,24 @@ _dynamic_imports: dict[str, str] = {
"Truncation": ".truncation",
"UnauthorizedResponseErrorData": ".unauthorizedresponseerrordata",
"UnauthorizedResponseErrorDataTypedDict": ".unauthorizedresponseerrordata",
"UnifiedBenchmarkPricing": ".unifiedbenchmarkpricing",
"UnifiedBenchmarkPricingTypedDict": ".unifiedbenchmarkpricing",
"UnifiedBenchmarksAAItem": ".unifiedbenchmarksaaitem",
"UnifiedBenchmarksAAItemSource": ".unifiedbenchmarksaaitem",
"UnifiedBenchmarksAAItemTypedDict": ".unifiedbenchmarksaaitem",
"TournamentStats": ".unifiedbenchmarksdaitem",
"TournamentStatsTypedDict": ".unifiedbenchmarksdaitem",
"UnifiedBenchmarksDAItem": ".unifiedbenchmarksdaitem",
"UnifiedBenchmarksDAItemSource": ".unifiedbenchmarksdaitem",
"UnifiedBenchmarksDAItemTypedDict": ".unifiedbenchmarksdaitem",
"UnifiedBenchmarksMeta": ".unifiedbenchmarksmeta",
"UnifiedBenchmarksMetaSource": ".unifiedbenchmarksmeta",
"UnifiedBenchmarksMetaTypedDict": ".unifiedbenchmarksmeta",
"UnifiedBenchmarksMetaVersion": ".unifiedbenchmarksmeta",
"Data": ".unifiedbenchmarksresponse",
"DataTypedDict": ".unifiedbenchmarksresponse",
"UnifiedBenchmarksResponse": ".unifiedbenchmarksresponse",
"UnifiedBenchmarksResponseTypedDict": ".unifiedbenchmarksresponse",
"UnprocessableEntityResponseErrorData": ".unprocessableentityresponseerrordata",
"UnprocessableEntityResponseErrorDataTypedDict": ".unprocessableentityresponseerrordata",
"UpdateBYOKKeyRequest": ".updatebyokkeyrequest",
@@ -10,6 +10,7 @@ from typing_extensions import Annotated, NotRequired, TypedDict
AdvisorReasoningEffort = Union[
Literal[
"max",
"xhigh",
"high",
"medium",
@@ -1,53 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing import Literal
from typing_extensions import TypedDict
BenchmarksAAMetaSource = Literal["artificial-analysis",]
r"""Data source identifier."""
BenchmarksAAMetaSourceURL = Literal["https://artificialanalysis.ai",]
r"""URL of the upstream data source."""
BenchmarksAAMetaVersion = Literal["v1",]
r"""Dataset version."""
class BenchmarksAAMetaTypedDict(TypedDict):
as_of: str
r"""ISO-8601 timestamp of when this data was last updated."""
citation: str
r"""Required attribution when republishing this data."""
model_count: int
r"""Number of unique models in the response."""
source: BenchmarksAAMetaSource
r"""Data source identifier."""
source_url: BenchmarksAAMetaSourceURL
r"""URL of the upstream data source."""
version: BenchmarksAAMetaVersion
r"""Dataset version."""
class BenchmarksAAMeta(BaseModel):
as_of: str
r"""ISO-8601 timestamp of when this data was last updated."""
citation: str
r"""Required attribution when republishing this data."""
model_count: int
r"""Number of unique models in the response."""
source: BenchmarksAAMetaSource
r"""Data source identifier."""
source_url: BenchmarksAAMetaSourceURL
r"""URL of the upstream data source."""
version: BenchmarksAAMetaVersion
r"""Dataset version."""
@@ -1,19 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .benchmarksaaitem import BenchmarksAAItem, BenchmarksAAItemTypedDict
from .benchmarksaameta import BenchmarksAAMeta, BenchmarksAAMetaTypedDict
from openrouter.types import BaseModel
from typing import List
from typing_extensions import TypedDict
class BenchmarksAAResponseTypedDict(TypedDict):
data: List[BenchmarksAAItemTypedDict]
meta: BenchmarksAAMetaTypedDict
class BenchmarksAAResponse(BaseModel):
data: List[BenchmarksAAItem]
meta: BenchmarksAAMeta
@@ -1,118 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
from pydantic import model_serializer
from typing import Literal
from typing_extensions import TypedDict
class EloBoundsTypedDict(TypedDict):
r"""ELO range across all returned models for normalization."""
max: float
r"""Maximum ELO in the result set."""
min: float
r"""Minimum ELO in the result set."""
class EloBounds(BaseModel):
r"""ELO range across all returned models for normalization."""
max: float
r"""Maximum ELO in the result set."""
min: float
r"""Minimum ELO in the result set."""
BenchmarksDAMetaSource = Literal["design-arena",]
r"""Data source identifier."""
BenchmarksDAMetaSourceURL = Literal["https://www.designarena.ai",]
r"""URL of the upstream data source."""
BenchmarksDAMetaVersion = Literal["v1",]
r"""Dataset version."""
class BenchmarksDAMetaTypedDict(TypedDict):
arena: str
r"""The arena filter applied."""
as_of: str
r"""ISO-8601 timestamp of when this data was generated."""
category: Nullable[str]
r"""The category filter applied, or null if showing all."""
citation: str
r"""Required attribution when republishing this data."""
elo_bounds: EloBoundsTypedDict
r"""ELO range across all returned models for normalization."""
model_count: int
r"""Number of unique models in the response."""
source: BenchmarksDAMetaSource
r"""Data source identifier."""
source_url: BenchmarksDAMetaSourceURL
r"""URL of the upstream data source."""
version: BenchmarksDAMetaVersion
r"""Dataset version."""
class BenchmarksDAMeta(BaseModel):
arena: str
r"""The arena filter applied."""
as_of: str
r"""ISO-8601 timestamp of when this data was generated."""
category: Nullable[str]
r"""The category filter applied, or null if showing all."""
citation: str
r"""Required attribution when republishing this data."""
elo_bounds: EloBounds
r"""ELO range across all returned models for normalization."""
model_count: int
r"""Number of unique models in the response."""
source: BenchmarksDAMetaSource
r"""Data source identifier."""
source_url: BenchmarksDAMetaSourceURL
r"""URL of the upstream data source."""
version: BenchmarksDAMetaVersion
r"""Dataset version."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["category"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -1,19 +0,0 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .benchmarksdaitem import BenchmarksDAItem, BenchmarksDAItemTypedDict
from .benchmarksdameta import BenchmarksDAMeta, BenchmarksDAMetaTypedDict
from openrouter.types import BaseModel
from typing import List
from typing_extensions import TypedDict
class BenchmarksDAResponseTypedDict(TypedDict):
data: List[BenchmarksDAItemTypedDict]
meta: BenchmarksDAMetaTypedDict
class BenchmarksDAResponse(BaseModel):
data: List[BenchmarksDAItem]
meta: BenchmarksDAMeta
+2
View File
@@ -106,6 +106,7 @@ ChatRequestPlugin = Annotated[
ChatRequestEffort = Union[
Literal[
"max",
"xhigh",
"high",
"medium",
@@ -172,6 +173,7 @@ class ChatRequestReasoning(BaseModel):
ChatRequestReasoningEffort = Union[
Literal[
"max",
"xhigh",
"high",
"medium",
+69
View File
@@ -112,6 +112,68 @@ class PromptTokensDetails(BaseModel):
r"""Video input tokens"""
class ServerToolUseDetailsTypedDict(TypedDict):
r"""Usage for server-side tool execution (e.g., web search)"""
tool_calls_executed: NotRequired[Nullable[int]]
r"""Number of OpenRouter server tool calls that executed and produced a result"""
tool_calls_requested: NotRequired[Nullable[int]]
r"""Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here."""
web_search_requests: NotRequired[Nullable[int]]
r"""Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two."""
class ServerToolUseDetails(BaseModel):
r"""Usage for server-side tool execution (e.g., web search)"""
tool_calls_executed: OptionalNullable[int] = UNSET
r"""Number of OpenRouter server tool calls that executed and produced a result"""
tool_calls_requested: OptionalNullable[int] = UNSET
r"""Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here."""
web_search_requests: OptionalNullable[int] = UNSET
r"""Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"tool_calls_executed",
"tool_calls_requested",
"web_search_requests",
]
nullable_fields = [
"tool_calls_executed",
"tool_calls_requested",
"web_search_requests",
]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class ChatUsageTypedDict(TypedDict):
r"""Token usage statistics"""
@@ -131,6 +193,8 @@ class ChatUsageTypedDict(TypedDict):
r"""Whether a request was made using a Bring Your Own Key configuration"""
prompt_tokens_details: NotRequired[Nullable[PromptTokensDetailsTypedDict]]
r"""Detailed prompt token usage"""
server_tool_use_details: NotRequired[Nullable[ServerToolUseDetailsTypedDict]]
r"""Usage for server-side tool execution (e.g., web search)"""
class ChatUsage(BaseModel):
@@ -160,6 +224,9 @@ class ChatUsage(BaseModel):
prompt_tokens_details: OptionalNullable[PromptTokensDetails] = UNSET
r"""Detailed prompt token usage"""
server_tool_use_details: OptionalNullable[ServerToolUseDetails] = UNSET
r"""Usage for server-side tool execution (e.g., web search)"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
@@ -168,12 +235,14 @@ class ChatUsage(BaseModel):
"cost_details",
"is_byok",
"prompt_tokens_details",
"server_tool_use_details",
]
nullable_fields = [
"completion_tokens_details",
"cost",
"cost_details",
"prompt_tokens_details",
"server_tool_use_details",
]
null_default_fields = []
@@ -10,6 +10,7 @@ from typing_extensions import Annotated, NotRequired, TypedDict
FusionServerToolConfigEffort = Union[
Literal[
"max",
"xhigh",
"high",
"medium",
+7
View File
@@ -5,6 +5,7 @@ from .defaultparameters import DefaultParameters, DefaultParametersTypedDict
from .modelarchitecture import ModelArchitecture, ModelArchitectureTypedDict
from .modelbenchmarks import ModelBenchmarks, ModelBenchmarksTypedDict
from .modellinks import ModelLinks, ModelLinksTypedDict
from .modelreasoning import ModelReasoning, ModelReasoningTypedDict
from .parameter import Parameter
from .perrequestlimits import PerRequestLimits, PerRequestLimitsTypedDict
from .publicpricing import PublicPricing, PublicPricingTypedDict
@@ -62,6 +63,8 @@ class ModelTypedDict(TypedDict):
r"""Hugging Face model identifier, if applicable"""
knowledge_cutoff: NotRequired[Nullable[str]]
r"""The date up to which the model was trained on data. ISO 8601 date string (YYYY-MM-DD) or null if unknown."""
reasoning: NotRequired[ModelReasoningTypedDict]
r"""Reasoning effort configuration. Omitted for non-reasoning models and dynamic router models."""
class Model(BaseModel):
@@ -123,6 +126,9 @@ class Model(BaseModel):
knowledge_cutoff: OptionalNullable[str] = UNSET
r"""The date up to which the model was trained on data. ISO 8601 date string (YYYY-MM-DD) or null if unknown."""
reasoning: Optional[ModelReasoning] = None
r"""Reasoning effort configuration. Omitted for non-reasoning models and dynamic router models."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
@@ -131,6 +137,7 @@ class Model(BaseModel):
"expiration_date",
"hugging_face_id",
"knowledge_cutoff",
"reasoning",
]
nullable_fields = [
"context_length",
+107
View File
@@ -0,0 +1,107 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .reasoningeffort import ReasoningEffort
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
DefaultEffort = Union[
Literal[
"max",
"xhigh",
"high",
"medium",
"low",
"minimal",
"none",
],
UnrecognizedStr,
]
r"""Default reasoning effort when the client enables reasoning without specifying effort. Maps to `reasoning.effort` in chat requests. When `\"none\"`, prefer omitting effort unless the user explicitly disables reasoning."""
class ModelReasoningTypedDict(TypedDict):
r"""Reasoning effort configuration. Omitted for non-reasoning models and dynamic router models."""
mandatory: bool
r"""When true, reasoning cannot be disabled and effort \"none\" is rejected."""
default_effort: NotRequired[Nullable[DefaultEffort]]
default_enabled: NotRequired[bool]
r"""Default reasoning enabled state when the client does not set `reasoning.enabled`."""
supported_efforts: NotRequired[Nullable[List[Nullable[ReasoningEffort]]]]
r"""Allowed reasoning effort values for this model, in descending effort order (highest first). Null means no allowlist — all gateway effort values are accepted."""
supports_max_tokens: NotRequired[bool]
r"""Present and `true` when the model accepts `reasoning.max_tokens` in requests (Anthropic-style) instead of or in addition to `reasoning.effort`. Omitted otherwise."""
class ModelReasoning(BaseModel):
r"""Reasoning effort configuration. Omitted for non-reasoning models and dynamic router models."""
mandatory: bool
r"""When true, reasoning cannot be disabled and effort \"none\" is rejected."""
default_effort: Annotated[
OptionalNullable[DefaultEffort], PlainValidator(validate_open_enum(False))
] = UNSET
default_enabled: Optional[bool] = None
r"""Default reasoning enabled state when the client does not set `reasoning.enabled`."""
supported_efforts: OptionalNullable[
List[
Annotated[
Nullable[ReasoningEffort], PlainValidator(validate_open_enum(False))
]
]
] = UNSET
r"""Allowed reasoning effort values for this model, in descending effort order (highest first). Null means no allowlist — all gateway effort values are accepted."""
supports_max_tokens: Optional[bool] = None
r"""Present and `true` when the model accepts `reasoning.max_tokens` in requests (Anthropic-style) instead of or in addition to `reasoning.effort`. Omitted otherwise."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"default_effort",
"default_enabled",
"supported_efforts",
"supports_max_tokens",
]
nullable_fields = ["default_effort", "supported_efforts"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -7,6 +7,7 @@ from typing import Literal, Union
ReasoningEffort = Union[
Literal[
"max",
"xhigh",
"high",
"medium",
@@ -10,6 +10,7 @@ from typing_extensions import Annotated, NotRequired, TypedDict
SubagentReasoningEffort = Union[
Literal[
"max",
"xhigh",
"high",
"medium",
@@ -5,7 +5,7 @@ from openrouter.types import BaseModel
from typing_extensions import TypedDict
class BenchmarkPricingTypedDict(TypedDict):
class UnifiedBenchmarkPricingTypedDict(TypedDict):
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
completion: str
@@ -14,7 +14,7 @@ class BenchmarkPricingTypedDict(TypedDict):
r"""Cost per input token (USD, decimal string)."""
class BenchmarkPricing(BaseModel):
class UnifiedBenchmarkPricing(BaseModel):
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
completion: str
@@ -1,46 +1,59 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict
from .unifiedbenchmarkpricing import (
UnifiedBenchmarkPricing,
UnifiedBenchmarkPricingTypedDict,
)
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
from pydantic import model_serializer
from typing import Literal
from typing_extensions import TypedDict
class BenchmarksAAItemTypedDict(TypedDict):
aa_name: str
r"""Model name as listed on Artificial Analysis."""
UnifiedBenchmarksAAItemSource = Literal["artificial-analysis",]
r"""Benchmark source discriminator."""
class UnifiedBenchmarksAAItemTypedDict(TypedDict):
agentic_index: Nullable[float]
r"""Artificial Analysis Agentic Index composite score. Higher is better."""
coding_index: Nullable[float]
r"""Artificial Analysis Coding Index composite score. Higher is better."""
display_name: str
r"""Model name as listed on Artificial Analysis."""
intelligence_index: Nullable[float]
r"""Artificial Analysis Intelligence Index composite score. Higher is better."""
model_permaslug: str
r"""Stable OpenRouter model identifier."""
pricing: Nullable[BenchmarkPricingTypedDict]
pricing: Nullable[UnifiedBenchmarkPricingTypedDict]
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
source: UnifiedBenchmarksAAItemSource
r"""Benchmark source discriminator."""
class BenchmarksAAItem(BaseModel):
aa_name: str
r"""Model name as listed on Artificial Analysis."""
class UnifiedBenchmarksAAItem(BaseModel):
agentic_index: Nullable[float]
r"""Artificial Analysis Agentic Index composite score. Higher is better."""
coding_index: Nullable[float]
r"""Artificial Analysis Coding Index composite score. Higher is better."""
display_name: str
r"""Model name as listed on Artificial Analysis."""
intelligence_index: Nullable[float]
r"""Artificial Analysis Intelligence Index composite score. Higher is better."""
model_permaslug: str
r"""Stable OpenRouter model identifier."""
pricing: Nullable[BenchmarkPricing]
pricing: Nullable[UnifiedBenchmarkPricing]
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
source: UnifiedBenchmarksAAItemSource
r"""Benchmark source discriminator."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
@@ -1,12 +1,20 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict
from .unifiedbenchmarkpricing import (
UnifiedBenchmarkPricing,
UnifiedBenchmarkPricingTypedDict,
)
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
from pydantic import model_serializer
from typing import Literal
from typing_extensions import TypedDict
UnifiedBenchmarksDAItemSource = Literal["design-arena",]
r"""Benchmark source discriminator."""
class TournamentStatsTypedDict(TypedDict):
r"""Placement distribution from tournament matches."""
@@ -67,7 +75,7 @@ class TournamentStats(BaseModel):
return m
class BenchmarksDAItemTypedDict(TypedDict):
class UnifiedBenchmarksDAItemTypedDict(TypedDict):
arena: str
r"""Arena this ranking belongs to."""
avg_generation_time_ms: Nullable[float]
@@ -79,16 +87,18 @@ class BenchmarksDAItemTypedDict(TypedDict):
elo: float
r"""ELO rating from head-to-head arena battles."""
model_permaslug: str
r"""Stable OpenRouter model identifier when the model is on OpenRouter; otherwise the upstream Design Arena model id. Use pricing != null to detect OpenRouter-mapped models."""
pricing: Nullable[BenchmarkPricingTypedDict]
r"""Stable OpenRouter model identifier when mapped; otherwise the upstream Design Arena model id."""
pricing: Nullable[UnifiedBenchmarkPricingTypedDict]
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
source: UnifiedBenchmarksDAItemSource
r"""Benchmark source discriminator."""
tournament_stats: TournamentStatsTypedDict
r"""Placement distribution from tournament matches."""
win_rate: float
r"""Win rate as a percentage (0100)."""
class BenchmarksDAItem(BaseModel):
class UnifiedBenchmarksDAItem(BaseModel):
arena: str
r"""Arena this ranking belongs to."""
@@ -105,11 +115,14 @@ class BenchmarksDAItem(BaseModel):
r"""ELO rating from head-to-head arena battles."""
model_permaslug: str
r"""Stable OpenRouter model identifier when the model is on OpenRouter; otherwise the upstream Design Arena model id. Use pricing != null to detect OpenRouter-mapped models."""
r"""Stable OpenRouter model identifier when mapped; otherwise the upstream Design Arena model id."""
pricing: Nullable[BenchmarkPricing]
pricing: Nullable[UnifiedBenchmarkPricing]
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
source: UnifiedBenchmarksDAItemSource
r"""Benchmark source discriminator."""
tournament_stats: TournamentStats
r"""Placement distribution from tournament matches."""
@@ -0,0 +1,95 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Literal, Union
from typing_extensions import Annotated, TypedDict
UnifiedBenchmarksMetaSource = Union[
Literal[
"artificial-analysis",
"design-arena",
],
UnrecognizedStr,
]
r"""The source filter applied."""
UnifiedBenchmarksMetaVersion = Literal["v1",]
r"""Dataset version."""
class UnifiedBenchmarksMetaTypedDict(TypedDict):
as_of: str
r"""ISO-8601 timestamp of when this data was last updated."""
citation: str
r"""Required attribution when republishing this data."""
model_count: int
r"""Number of unique models in the response."""
source: UnifiedBenchmarksMetaSource
r"""The source filter applied."""
source_url: str
r"""URL of the upstream data source."""
task_type: Nullable[str]
r"""The task_type filter applied, or null if showing all."""
version: UnifiedBenchmarksMetaVersion
r"""Dataset version."""
class UnifiedBenchmarksMeta(BaseModel):
as_of: str
r"""ISO-8601 timestamp of when this data was last updated."""
citation: str
r"""Required attribution when republishing this data."""
model_count: int
r"""Number of unique models in the response."""
source: Annotated[
UnifiedBenchmarksMetaSource, PlainValidator(validate_open_enum(False))
]
r"""The source filter applied."""
source_url: str
r"""URL of the upstream data source."""
task_type: Nullable[str]
r"""The task_type filter applied, or null if showing all."""
version: UnifiedBenchmarksMetaVersion
r"""Dataset version."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["task_type"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
@@ -0,0 +1,43 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .unifiedbenchmarksaaitem import (
UnifiedBenchmarksAAItem,
UnifiedBenchmarksAAItemTypedDict,
)
from .unifiedbenchmarksdaitem import (
UnifiedBenchmarksDAItem,
UnifiedBenchmarksDAItemTypedDict,
)
from .unifiedbenchmarksmeta import UnifiedBenchmarksMeta, UnifiedBenchmarksMetaTypedDict
from openrouter.types import BaseModel
from openrouter.utils import get_discriminator
from pydantic import Discriminator, Tag
from typing import List, Union
from typing_extensions import Annotated, TypeAliasType, TypedDict
DataTypedDict = TypeAliasType(
"DataTypedDict",
Union[UnifiedBenchmarksAAItemTypedDict, UnifiedBenchmarksDAItemTypedDict],
)
Data = Annotated[
Union[
Annotated[UnifiedBenchmarksAAItem, Tag("artificial-analysis")],
Annotated[UnifiedBenchmarksDAItem, Tag("design-arena")],
],
Discriminator(lambda m: get_discriminator(m, "source", "source")),
]
class UnifiedBenchmarksResponseTypedDict(TypedDict):
data: List[DataTypedDict]
meta: UnifiedBenchmarksMetaTypedDict
class UnifiedBenchmarksResponse(BaseModel):
data: List[Data]
meta: UnifiedBenchmarksMeta