chore: 🐝 Update SDK - Generate (spec change merged) 0.11.7 (#402)

Co-authored-by: speakeasybot <bot@speakeasyapi.dev>
Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2026-07-07 21:50:31 +00:00
committed by GitHub
co-authored by speakeasybot speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com>
parent 2c673c0ca3
commit d81cd563db
41 changed files with 1163 additions and 147 deletions
+2 -2
View File
@@ -3,10 +3,10 @@
import importlib.metadata
__title__: str = "openrouter"
__version__: str = "0.11.6"
__version__: str = "0.11.7"
__openapi_doc_version__: str = "1.0.0"
__gen_version__: str = "2.914.0"
__user_agent__: str = "speakeasy-sdk/python 0.11.6 2.914.0 1.0.0 openrouter"
__user_agent__: str = "speakeasy-sdk/python 0.11.7 2.914.0 1.0.0 openrouter"
try:
if __package__ is not None:
+19 -3
View File
@@ -2366,10 +2366,10 @@ if TYPE_CHECKING:
ShellServerToolEnvironmentTypedDict,
)
from .speechrequest import (
ResponseFormatEnum,
SpeechRequest,
SpeechRequestProvider,
SpeechRequestProviderTypedDict,
SpeechRequestResponseFormat,
SpeechRequestTypedDict,
)
from .stopservertoolswhencondition import (
@@ -2443,10 +2443,14 @@ if TYPE_CHECKING:
STTRequest,
STTRequestProvider,
STTRequestProviderTypedDict,
STTRequestResponseFormat,
STTRequestTypedDict,
)
from .sttresponse import STTResponse, STTResponseTypedDict
from .sttsegment import STTSegment, STTSegmentTypedDict
from .stttimestampgranularity import STTTimestampGranularity
from .sttusage import STTUsage, STTUsageTypedDict
from .sttword import STTWord, STTWordTypedDict
from .subagentnestedtool import SubagentNestedTool, SubagentNestedToolTypedDict
from .subagentreasoning import (
SubagentReasoning,
@@ -4296,7 +4300,6 @@ __all__ = [
"ResetInterval",
"Response",
"ResponseFormat",
"ResponseFormatEnum",
"ResponseFormatTypedDict",
"ResponseHealingPlugin",
"ResponseHealingPluginID",
@@ -4334,11 +4337,17 @@ __all__ = [
"STTRequest",
"STTRequestProvider",
"STTRequestProviderTypedDict",
"STTRequestResponseFormat",
"STTRequestTypedDict",
"STTResponse",
"STTResponseTypedDict",
"STTSegment",
"STTSegmentTypedDict",
"STTTimestampGranularity",
"STTUsage",
"STTUsageTypedDict",
"STTWord",
"STTWordTypedDict",
"SearchContextSizeEnum",
"SearchModelsServerToolConfig",
"SearchModelsServerToolConfigTypedDict",
@@ -4384,6 +4393,7 @@ __all__ = [
"SpeechRequest",
"SpeechRequestProvider",
"SpeechRequestProviderTypedDict",
"SpeechRequestResponseFormat",
"SpeechRequestTypedDict",
"Speed",
"Stance",
@@ -6471,10 +6481,10 @@ _dynamic_imports: dict[str, str] = {
"ShellServerToolEngine": ".shellservertoolengine",
"ShellServerToolEnvironment": ".shellservertoolenvironment",
"ShellServerToolEnvironmentTypedDict": ".shellservertoolenvironment",
"ResponseFormatEnum": ".speechrequest",
"SpeechRequest": ".speechrequest",
"SpeechRequestProvider": ".speechrequest",
"SpeechRequestProviderTypedDict": ".speechrequest",
"SpeechRequestResponseFormat": ".speechrequest",
"SpeechRequestTypedDict": ".speechrequest",
"StopServerToolsWhenCondition": ".stopservertoolswhencondition",
"StopServerToolsWhenConditionTypedDict": ".stopservertoolswhencondition",
@@ -6524,11 +6534,17 @@ _dynamic_imports: dict[str, str] = {
"STTRequest": ".sttrequest",
"STTRequestProvider": ".sttrequest",
"STTRequestProviderTypedDict": ".sttrequest",
"STTRequestResponseFormat": ".sttrequest",
"STTRequestTypedDict": ".sttrequest",
"STTResponse": ".sttresponse",
"STTResponseTypedDict": ".sttresponse",
"STTSegment": ".sttsegment",
"STTSegmentTypedDict": ".sttsegment",
"STTTimestampGranularity": ".stttimestampgranularity",
"STTUsage": ".sttusage",
"STTUsageTypedDict": ".sttusage",
"STTWord": ".sttword",
"STTWordTypedDict": ".sttword",
"SubagentNestedTool": ".subagentnestedtool",
"SubagentNestedToolTypedDict": ".subagentnestedtool",
"SubagentReasoning": ".subagentreasoning",
+3 -3
View File
@@ -38,7 +38,7 @@ class SpeechRequestProvider(BaseModel):
return m
ResponseFormatEnum = Union[
SpeechRequestResponseFormat = Union[
Literal[
"mp3",
"pcm",
@@ -59,7 +59,7 @@ class SpeechRequestTypedDict(TypedDict):
r"""Voice identifier (provider-specific)."""
provider: NotRequired[SpeechRequestProviderTypedDict]
r"""Provider-specific passthrough configuration"""
response_format: NotRequired[ResponseFormatEnum]
response_format: NotRequired[SpeechRequestResponseFormat]
r"""Audio output format"""
speed: NotRequired[float]
r"""Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers."""
@@ -80,7 +80,7 @@ class SpeechRequest(BaseModel):
provider: Optional[SpeechRequestProvider] = None
r"""Provider-specific passthrough configuration"""
response_format: Optional[ResponseFormatEnum] = "pcm"
response_format: Optional[SpeechRequestResponseFormat] = "pcm"
r"""Audio output format"""
speed: Optional[float] = None
+32 -3
View File
@@ -3,9 +3,10 @@
from __future__ import annotations
from .provideroptions import ProviderOptions, ProviderOptionsTypedDict
from .sttinputaudio import STTInputAudio, STTInputAudioTypedDict
from openrouter.types import BaseModel, UNSET_SENTINEL
from .stttimestampgranularity import STTTimestampGranularity
from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr
from pydantic import model_serializer
from typing import Optional
from typing import List, Literal, Optional, Union
from typing_extensions import NotRequired, TypedDict
@@ -39,6 +40,16 @@ class STTRequestProvider(BaseModel):
return m
STTRequestResponseFormat = Union[
Literal[
"json",
"verbose_json",
],
UnrecognizedStr,
]
r"""Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers."""
class STTRequestTypedDict(TypedDict):
r"""Speech-to-text request input. Accepts a JSON body with input_audio containing base64-encoded audio."""
@@ -50,8 +61,12 @@ class STTRequestTypedDict(TypedDict):
r"""ISO-639-1 language code (e.g., \"en\", \"ja\"). Auto-detected if omitted."""
provider: NotRequired[STTRequestProviderTypedDict]
r"""Provider-specific passthrough configuration"""
response_format: NotRequired[STTRequestResponseFormat]
r"""Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers."""
temperature: NotRequired[float]
r"""Sampling temperature for transcription"""
timestamp_granularities: NotRequired[List[STTTimestampGranularity]]
r"""Timestamp detail levels to include when response_format is \"verbose_json\". \"segment\" returns segment-level timestamps; \"word\" additionally returns word-level timestamps in the words array. Ignored unless response_format is \"verbose_json\"."""
class STTRequest(BaseModel):
@@ -69,12 +84,26 @@ class STTRequest(BaseModel):
provider: Optional[STTRequestProvider] = None
r"""Provider-specific passthrough configuration"""
response_format: Optional[STTRequestResponseFormat] = None
r"""Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers."""
temperature: Optional[float] = None
r"""Sampling temperature for transcription"""
timestamp_granularities: Optional[List[STTTimestampGranularity]] = None
r"""Timestamp detail levels to include when response_format is \"verbose_json\". \"segment\" returns segment-level timestamps; \"word\" additionally returns word-level timestamps in the words array. Ignored unless response_format is \"verbose_json\"."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(["language", "provider", "temperature"])
optional_fields = set(
[
"language",
"provider",
"response_format",
"temperature",
"timestamp_granularities",
]
)
serialized = handler(self)
m = {}
+31 -2
View File
@@ -1,10 +1,12 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .sttsegment import STTSegment, STTSegmentTypedDict
from .sttusage import STTUsage, STTUsageTypedDict
from .sttword import STTWord, STTWordTypedDict
from openrouter.types import BaseModel, UNSET_SENTINEL
from pydantic import model_serializer
from typing import Optional
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
@@ -13,8 +15,18 @@ class STTResponseTypedDict(TypedDict):
text: str
r"""The transcribed text"""
duration: NotRequired[float]
r"""Duration of the input audio in seconds, present when response_format is verbose_json"""
language: NotRequired[str]
r"""Detected or forced language, present when response_format is verbose_json"""
segments: NotRequired[List[STTSegmentTypedDict]]
r"""Timestamped transcript segments, present when response_format is verbose_json"""
task: NotRequired[str]
r"""The task performed, present when response_format is verbose_json"""
usage: NotRequired[STTUsageTypedDict]
r"""Aggregated usage statistics for the request"""
words: NotRequired[List[STTWordTypedDict]]
r"""Timestamped words, present when the provider returns word-level timestamps"""
class STTResponse(BaseModel):
@@ -23,12 +35,29 @@ class STTResponse(BaseModel):
text: str
r"""The transcribed text"""
duration: Optional[float] = None
r"""Duration of the input audio in seconds, present when response_format is verbose_json"""
language: Optional[str] = None
r"""Detected or forced language, present when response_format is verbose_json"""
segments: Optional[List[STTSegment]] = None
r"""Timestamped transcript segments, present when response_format is verbose_json"""
task: Optional[str] = None
r"""The task performed, present when response_format is verbose_json"""
usage: Optional[STTUsage] = None
r"""Aggregated usage statistics for the request"""
words: Optional[List[STTWord]] = None
r"""Timestamped words, present when the provider returns word-level timestamps"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(["usage"])
optional_fields = set(
["duration", "language", "segments", "task", "usage", "words"]
)
serialized = handler(self)
m = {}
+91
View File
@@ -0,0 +1,91 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, UNSET_SENTINEL
from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict
class STTSegmentTypedDict(TypedDict):
r"""A timestamped transcript segment, returned when response_format is verbose_json"""
end: float
r"""Segment end time in seconds"""
id: int
r"""Segment index within the transcript"""
start: float
r"""Segment start time in seconds"""
text: str
r"""Transcribed text of the segment"""
avg_logprob: NotRequired[float]
r"""Average log probability of the segment"""
compression_ratio: NotRequired[float]
r"""Compression ratio of the segment"""
no_speech_prob: NotRequired[float]
r"""Probability the segment contains no speech"""
seek: NotRequired[int]
r"""Seek offset of the segment"""
temperature: NotRequired[float]
r"""Temperature used for the segment"""
tokens: NotRequired[List[int]]
r"""Token IDs of the segment"""
class STTSegment(BaseModel):
r"""A timestamped transcript segment, returned when response_format is verbose_json"""
end: float
r"""Segment end time in seconds"""
id: int
r"""Segment index within the transcript"""
start: float
r"""Segment start time in seconds"""
text: str
r"""Transcribed text of the segment"""
avg_logprob: Optional[float] = None
r"""Average log probability of the segment"""
compression_ratio: Optional[float] = None
r"""Compression ratio of the segment"""
no_speech_prob: Optional[float] = None
r"""Probability the segment contains no speech"""
seek: Optional[int] = None
r"""Seek offset of the segment"""
temperature: Optional[float] = None
r"""Temperature used for the segment"""
tokens: Optional[List[int]] = None
r"""Token IDs of the segment"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(
[
"avg_logprob",
"compression_ratio",
"no_speech_prob",
"seek",
"temperature",
"tokens",
]
)
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))
if val != UNSET_SENTINEL:
if val is not None or k not in optional_fields:
m[k] = val
return m
@@ -0,0 +1,15 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
STTTimestampGranularity = Union[
Literal[
"word",
"segment",
],
UnrecognizedStr,
]
r"""A timestamp detail level for verbose_json transcription responses."""
+29
View File
@@ -0,0 +1,29 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel
from typing_extensions import TypedDict
class STTWordTypedDict(TypedDict):
r"""A timestamped word, returned when the provider includes word-level timestamps"""
end: float
r"""Word end time in seconds"""
start: float
r"""Word start time in seconds"""
word: str
r"""The transcribed word"""
class STTWord(BaseModel):
r"""A timestamped word, returned when the provider includes word-level timestamps"""
end: float
r"""Word end time in seconds"""
start: float
r"""Word start time in seconds"""
word: str
r"""The transcribed word"""
+44
View File
@@ -444,6 +444,11 @@ class Datasets(BaseSDK):
x_open_router_categories: Optional[str] = None,
start_date: Optional[str] = None,
end_date: Optional[str] = None,
period: Optional[operations.Period] = None,
modality: Optional[operations.Modality] = None,
context_bucket: Optional[operations.ContextBucket] = None,
category: Optional[operations.GetRankingsDailyCategory] = None,
language_type: Optional[operations.LanguageType] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -460,6 +465,13 @@ class Datasets(BaseSDK):
reserved permaslug `other` and is always returned last within its date, so callers
can compute `top-50 traffic / total daily traffic` without a second request.
Optional filters slice the dataset. `period` (`day`/`week`/`month`) sets the time
grain. `modality` and `context_bucket` narrow the exact dataset by output/input
modality (or tool-calling activity) and request context length. `category` and
`language_type` instead read a sampled, upsampled dataset whose `total_tokens` are
weekly-grain estimates — they cannot be combined with each other or with the exact
filters, and reject `period=day` with a 400.
Authenticate with any valid OpenRouter API key (same key used for inference).
Rate-limited to 30 requests/minute per key and 500 requests/day per account.
@@ -480,6 +492,11 @@ class Datasets(BaseSDK):
:param start_date: Start of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to 30 days before `end_date`. The dataset begins at 2025-01-01; earlier values are clamped forward to that floor and the resolved value is echoed in `meta.start_date`.
:param end_date: End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400.
:param period: Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries.
:param modality: Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`.
:param context_bucket: Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`.
:param category: Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`.
:param language_type: Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -501,6 +518,11 @@ class Datasets(BaseSDK):
x_open_router_categories=x_open_router_categories,
start_date=start_date,
end_date=end_date,
period=period,
modality=modality,
context_bucket=context_bucket,
category=category,
language_type=language_type,
)
req = self._build_request(
@@ -598,6 +620,11 @@ class Datasets(BaseSDK):
x_open_router_categories: Optional[str] = None,
start_date: Optional[str] = None,
end_date: Optional[str] = None,
period: Optional[operations.Period] = None,
modality: Optional[operations.Modality] = None,
context_bucket: Optional[operations.ContextBucket] = None,
category: Optional[operations.GetRankingsDailyCategory] = None,
language_type: Optional[operations.LanguageType] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -614,6 +641,13 @@ class Datasets(BaseSDK):
reserved permaslug `other` and is always returned last within its date, so callers
can compute `top-50 traffic / total daily traffic` without a second request.
Optional filters slice the dataset. `period` (`day`/`week`/`month`) sets the time
grain. `modality` and `context_bucket` narrow the exact dataset by output/input
modality (or tool-calling activity) and request context length. `category` and
`language_type` instead read a sampled, upsampled dataset whose `total_tokens` are
weekly-grain estimates — they cannot be combined with each other or with the exact
filters, and reject `period=day` with a 400.
Authenticate with any valid OpenRouter API key (same key used for inference).
Rate-limited to 30 requests/minute per key and 500 requests/day per account.
@@ -634,6 +668,11 @@ class Datasets(BaseSDK):
:param start_date: Start of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to 30 days before `end_date`. The dataset begins at 2025-01-01; earlier values are clamped forward to that floor and the resolved value is echoed in `meta.start_date`.
:param end_date: End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400.
:param period: Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries.
:param modality: Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`.
:param context_bucket: Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`.
:param category: Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`.
:param language_type: Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -655,6 +694,11 @@ class Datasets(BaseSDK):
x_open_router_categories=x_open_router_categories,
start_date=start_date,
end_date=end_date,
period=period,
modality=modality,
context_bucket=context_bucket,
category=category,
language_type=language_type,
)
req = self._build_request_async(
+18
View File
@@ -63,6 +63,7 @@ if TYPE_CHECKING:
CreateAudioTranscriptionsMultipartRequestBodyTypedDict,
CreateAudioTranscriptionsMultipartRequestTypedDict,
ResponseFormat,
TimestampGranularities,
)
from .createauthkeyscode import (
CreateAuthKeysCodeCodeChallengeMethod,
@@ -411,10 +412,15 @@ if TYPE_CHECKING:
GetPresetVersionRequestTypedDict,
)
from .getrankingsdaily import (
ContextBucket,
GetRankingsDailyCategory,
GetRankingsDailyGlobals,
GetRankingsDailyGlobalsTypedDict,
GetRankingsDailyRequest,
GetRankingsDailyRequestTypedDict,
LanguageType,
Modality,
Period,
)
from .gettaskclassifications import (
GetTaskClassificationsGlobals,
@@ -766,6 +772,7 @@ __all__ = [
"ContentText",
"ContentTextTypedDict",
"ContentTypedDict",
"ContextBucket",
"CostDetails",
"CostDetailsTypedDict",
"CreateAudioSpeechGlobals",
@@ -1018,6 +1025,7 @@ __all__ = [
"GetPresetVersionGlobalsTypedDict",
"GetPresetVersionRequest",
"GetPresetVersionRequestTypedDict",
"GetRankingsDailyCategory",
"GetRankingsDailyGlobals",
"GetRankingsDailyGlobalsTypedDict",
"GetRankingsDailyRequest",
@@ -1048,6 +1056,7 @@ __all__ = [
"InputTypedDict",
"InputUnion",
"InputUnionTypedDict",
"LanguageType",
"ListBYOKKeysGlobals",
"ListBYOKKeysGlobalsTypedDict",
"ListBYOKKeysRequest",
@@ -1200,6 +1209,7 @@ __all__ = [
"MetadataTypedDict",
"Metric",
"MetricTypedDict",
"Modality",
"Object",
"ObjectEmbedding",
"Operator",
@@ -1207,6 +1217,7 @@ __all__ = [
"OperatorTypedDict",
"OrderBy",
"OrderByTypedDict",
"Period",
"PromptTokensDetails",
"PromptTokensDetailsTypedDict",
"Provider",
@@ -1240,6 +1251,7 @@ __all__ = [
"TaskType",
"TimeRange",
"TimeRangeTypedDict",
"TimestampGranularities",
"TypeImageURL",
"TypeText",
"UpdateBYOKKeyGlobals",
@@ -1333,6 +1345,7 @@ _dynamic_imports: dict[str, str] = {
"CreateAudioTranscriptionsMultipartRequestBodyTypedDict": ".createaudiotranscriptions_multipart",
"CreateAudioTranscriptionsMultipartRequestTypedDict": ".createaudiotranscriptions_multipart",
"ResponseFormat": ".createaudiotranscriptions_multipart",
"TimestampGranularities": ".createaudiotranscriptions_multipart",
"CreateAuthKeysCodeCodeChallengeMethod": ".createauthkeyscode",
"CreateAuthKeysCodeData": ".createauthkeyscode",
"CreateAuthKeysCodeDataTypedDict": ".createauthkeyscode",
@@ -1603,10 +1616,15 @@ _dynamic_imports: dict[str, str] = {
"GetPresetVersionGlobalsTypedDict": ".getpresetversion",
"GetPresetVersionRequest": ".getpresetversion",
"GetPresetVersionRequestTypedDict": ".getpresetversion",
"ContextBucket": ".getrankingsdaily",
"GetRankingsDailyCategory": ".getrankingsdaily",
"GetRankingsDailyGlobals": ".getrankingsdaily",
"GetRankingsDailyGlobalsTypedDict": ".getrankingsdaily",
"GetRankingsDailyRequest": ".getrankingsdaily",
"GetRankingsDailyRequestTypedDict": ".getrankingsdaily",
"LanguageType": ".getrankingsdaily",
"Modality": ".getrankingsdaily",
"Period": ".getrankingsdaily",
"GetTaskClassificationsGlobals": ".gettaskclassifications",
"GetTaskClassificationsGlobalsTypedDict": ".gettaskclassifications",
"GetTaskClassificationsRequest": ".gettaskclassifications",
@@ -2,7 +2,7 @@
from __future__ import annotations
import io
from openrouter.types import BaseModel, UNSET_SENTINEL
from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr
from openrouter.utils import (
FieldMetadata,
HeaderMetadata,
@@ -11,7 +11,7 @@ from openrouter.utils import (
)
import pydantic
from pydantic import model_serializer
from typing import IO, Literal, Optional, Union
from typing import IO, List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -119,8 +119,23 @@ class CreateAudioTranscriptionsMultipartFile(BaseModel):
return m
ResponseFormat = Literal["json",]
r"""The response format. Only \"json\" is supported."""
ResponseFormat = Union[
Literal[
"json",
"verbose_json",
],
UnrecognizedStr,
]
r"""The response format. \"json\" (default) returns { text, usage }; \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only)."""
TimestampGranularities = Union[
Literal[
"word",
"segment",
],
UnrecognizedStr,
]
class CreateAudioTranscriptionsMultipartRequestBodyTypedDict(TypedDict):
@@ -131,9 +146,11 @@ class CreateAudioTranscriptionsMultipartRequestBodyTypedDict(TypedDict):
language: NotRequired[str]
r"""The language of the input audio (ISO-639-1)."""
response_format: NotRequired[ResponseFormat]
r"""The response format. Only \"json\" is supported."""
r"""The response format. \"json\" (default) returns { text, usage }; \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only)."""
temperature: NotRequired[float]
r"""The sampling temperature."""
timestamp_granularities: NotRequired[List[TimestampGranularities]]
r"""Timestamp detail levels to include when response_format is \"verbose_json\". \"word\" additionally returns word-level timestamps in the words array."""
class CreateAudioTranscriptionsMultipartRequestBody(BaseModel):
@@ -152,14 +169,23 @@ class CreateAudioTranscriptionsMultipartRequestBody(BaseModel):
response_format: Annotated[
Optional[ResponseFormat], FieldMetadata(multipart=True)
] = None
r"""The response format. Only \"json\" is supported."""
r"""The response format. \"json\" (default) returns { text, usage }; \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only)."""
temperature: Annotated[Optional[float], FieldMetadata(multipart=True)] = None
r"""The sampling temperature."""
timestamp_granularities: Annotated[
Optional[List[TimestampGranularities]],
pydantic.Field(alias="timestamp_granularities[]"),
FieldMetadata(multipart=True),
] = None
r"""Timestamp detail levels to include when response_format is \"verbose_json\". \"word\" additionally returns word-level timestamps in the words array."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(["language", "response_format", "temperature"])
optional_fields = set(
["language", "response_format", "temperature", "timestamp_granularities[]"]
)
serialized = handler(self)
m = {}
+114 -2
View File
@@ -1,11 +1,11 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, UNSET_SENTINEL
from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr
from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata
import pydantic
from pydantic import model_serializer
from typing import Optional
from typing import Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -73,6 +73,73 @@ class GetRankingsDailyGlobals(BaseModel):
return m
Period = Union[
Literal[
"day",
"week",
"month",
],
UnrecognizedStr,
]
r"""Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries."""
Modality = Union[
Literal[
"text",
"image",
"image_output",
"audio",
"tool_calling",
],
UnrecognizedStr,
]
r"""Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`."""
ContextBucket = Union[
Literal[
"1K",
"10K",
"100K",
"1M",
"10M",
],
UnrecognizedStr,
]
r"""Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`."""
GetRankingsDailyCategory = Union[
Literal[
"programming",
"roleplay",
"marketing",
"marketing/seo",
"technology",
"science",
"translation",
"legal",
"finance",
"health",
"trivia",
"academia",
],
UnrecognizedStr,
]
r"""Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`."""
LanguageType = Union[
Literal[
"natural",
"programming",
],
UnrecognizedStr,
]
r"""Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`."""
class GetRankingsDailyRequestTypedDict(TypedDict):
http_referer: NotRequired[str]
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
@@ -91,6 +158,16 @@ class GetRankingsDailyRequestTypedDict(TypedDict):
r"""Start of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to 30 days before `end_date`. The dataset begins at 2025-01-01; earlier values are clamped forward to that floor and the resolved value is echoed in `meta.start_date`."""
end_date: NotRequired[str]
r"""End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400."""
period: NotRequired[Period]
r"""Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries."""
modality: NotRequired[Modality]
r"""Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`."""
context_bucket: NotRequired[ContextBucket]
r"""Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`."""
category: NotRequired[GetRankingsDailyCategory]
r"""Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`."""
language_type: NotRequired[LanguageType]
r"""Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`."""
class GetRankingsDailyRequest(BaseModel):
@@ -134,6 +211,36 @@ class GetRankingsDailyRequest(BaseModel):
] = None
r"""End of the date window in YYYY-MM-DD (UTC), inclusive. Defaults to the most recent completed UTC day. Must be on or after 2025-01-01; earlier values are rejected with a 400."""
period: Annotated[
Optional[Period],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Time grain of each row. `day` (default) returns the per-UTC-day series; `week` buckets by ISO week start; `month` buckets by month start. With `category` or `language_type` only `week` (default) and `month` are available — `day` is rejected with a 400 because those datasets are aggregated weekly. For those sampled datasets `period=month` buckets each week by its week-start month, so totals are approximate at month boundaries."""
modality: Annotated[
Optional[Modality],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Restrict to models for a modality surface: `text` / `image_output` match output modality, `image` / `audio` match input modality, and `tool_calling` keeps only rows that recorded at least one tool call. Exact dataset — cannot be combined with `category` or `language_type`."""
context_bucket: Annotated[
Optional[ContextBucket],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Restrict to requests whose context length falls in this bucket (`1K`, `10K`, `100K`, `1M`, or `10M`). Exact dataset — cannot be combined with `category` or `language_type`."""
category: Annotated[
Optional[GetRankingsDailyCategory],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Restrict to a use-case category (e.g. `programming`, `roleplay`). Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `language_type`."""
language_type: Annotated[
Optional[LanguageType],
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
] = None
r"""Restrict to natural-language or programming-language tagged activity. Sourced from a sampled, upsampled dataset, so `total_tokens` is an estimate and is aggregated weekly (the trailing weekly bucket may include traffic past `end_date`). Cannot be combined with `modality`, `context_bucket`, or `category`."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(
@@ -143,6 +250,11 @@ class GetRankingsDailyRequest(BaseModel):
"X-OpenRouter-Categories",
"start_date",
"end_date",
"period",
"modality",
"context_bucket",
"category",
"language_type",
]
)
serialized = handler(self)
+41 -3
View File
@@ -6,7 +6,7 @@ from openrouter._hooks import HookContext
from openrouter.types import OptionalNullable, UNSET
from openrouter.utils import get_security_from_env
from openrouter.utils.unmarshal_json_response import unmarshal_json_response
from typing import Any, Mapping, Optional, Union
from typing import Any, Iterable, List, Mapping, Optional, Union
class Stt(BaseSDK):
@@ -24,7 +24,11 @@ class Stt(BaseSDK):
provider: Optional[
Union[components.STTRequestProvider, components.STTRequestProviderTypedDict]
] = None,
response_format: Optional[components.STTRequestResponseFormat] = None,
temperature: Optional[float] = None,
timestamp_granularities: Optional[
Iterable[components.STTTimestampGranularity]
] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -45,7 +49,9 @@ class Stt(BaseSDK):
:param language: ISO-639-1 language code (e.g., \"en\", \"ja\"). Auto-detected if omitted.
:param provider: Provider-specific passthrough configuration
:param response_format: Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers.
:param temperature: Sampling temperature for transcription
:param timestamp_granularities: Timestamp detail levels to include when response_format is \"verbose_json\". \"segment\" returns segment-level timestamps; \"word\" additionally returns word-level timestamps in the words array. Ignored unless response_format is \"verbose_json\".
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -74,7 +80,12 @@ class Stt(BaseSDK):
provider=utils.get_pydantic_model(
provider, Optional[components.STTRequestProvider]
),
response_format=response_format,
temperature=temperature,
timestamp_granularities=utils.unmarshal(
timestamp_granularities,
Optional[List[components.STTTimestampGranularity]],
),
),
)
@@ -210,7 +221,11 @@ class Stt(BaseSDK):
provider: Optional[
Union[components.STTRequestProvider, components.STTRequestProviderTypedDict]
] = None,
response_format: Optional[components.STTRequestResponseFormat] = None,
temperature: Optional[float] = None,
timestamp_granularities: Optional[
Iterable[components.STTTimestampGranularity]
] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -231,7 +246,9 @@ class Stt(BaseSDK):
:param language: ISO-639-1 language code (e.g., \"en\", \"ja\"). Auto-detected if omitted.
:param provider: Provider-specific passthrough configuration
:param response_format: Output format. \"json\" (default) returns { text, usage }. \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps; only supported by OpenAI-compatible providers.
:param temperature: Sampling temperature for transcription
:param timestamp_granularities: Timestamp detail levels to include when response_format is \"verbose_json\". \"segment\" returns segment-level timestamps; \"word\" additionally returns word-level timestamps in the words array. Ignored unless response_format is \"verbose_json\".
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -260,7 +277,12 @@ class Stt(BaseSDK):
provider=utils.get_pydantic_model(
provider, Optional[components.STTRequestProvider]
),
response_format=response_format,
temperature=temperature,
timestamp_granularities=utils.unmarshal(
timestamp_granularities,
Optional[List[components.STTTimestampGranularity]],
),
),
)
@@ -398,6 +420,9 @@ class Stt(BaseSDK):
language: Optional[str] = None,
response_format: Optional[operations.ResponseFormat] = None,
temperature: Optional[float] = None,
timestamp_granularities: Optional[
Iterable[operations.TimestampGranularities]
] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -417,8 +442,9 @@ class Stt(BaseSDK):
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
:param language: The language of the input audio (ISO-639-1).
:param response_format: The response format. Only \"json\" is supported.
:param response_format: The response format. \"json\" (default) returns { text, usage }; \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only).
:param temperature: The sampling temperature.
:param timestamp_granularities: Timestamp detail levels to include when response_format is \"verbose_json\". \"word\" additionally returns word-level timestamps in the words array.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -446,6 +472,10 @@ class Stt(BaseSDK):
model=model,
response_format=response_format,
temperature=temperature,
timestamp_granularities=utils.unmarshal(
timestamp_granularities,
Optional[List[operations.TimestampGranularities]],
),
),
)
@@ -587,6 +617,9 @@ class Stt(BaseSDK):
language: Optional[str] = None,
response_format: Optional[operations.ResponseFormat] = None,
temperature: Optional[float] = None,
timestamp_granularities: Optional[
Iterable[operations.TimestampGranularities]
] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -606,8 +639,9 @@ class Stt(BaseSDK):
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
:param language: The language of the input audio (ISO-639-1).
:param response_format: The response format. Only \"json\" is supported.
:param response_format: The response format. \"json\" (default) returns { text, usage }; \"verbose_json\" additionally returns task, language, duration, and segment-level timestamps (OpenAI-compatible providers only).
:param temperature: The sampling temperature.
:param timestamp_granularities: Timestamp detail levels to include when response_format is \"verbose_json\". \"word\" additionally returns word-level timestamps in the words array.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -635,6 +669,10 @@ class Stt(BaseSDK):
model=model,
response_format=response_format,
temperature=temperature,
timestamp_granularities=utils.unmarshal(
timestamp_granularities,
Optional[List[operations.TimestampGranularities]],
),
),
)
+2 -2
View File
@@ -28,7 +28,7 @@ class Tts(BaseSDK):
components.SpeechRequestProviderTypedDict,
]
] = None,
response_format: Optional[components.ResponseFormatEnum] = "pcm",
response_format: Optional[components.SpeechRequestResponseFormat] = "pcm",
speed: Optional[float] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
@@ -246,7 +246,7 @@ class Tts(BaseSDK):
components.SpeechRequestProviderTypedDict,
]
] = None,
response_format: Optional[components.ResponseFormatEnum] = "pcm",
response_format: Optional[components.SpeechRequestResponseFormat] = "pcm",
speed: Optional[float] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,