fix: update OpenAPI spec with router field (#32)

This commit is contained in:
Matt Apperson
2026-01-13 20:40:08 -05:00
committed by GitHub
parent f190e3f950
commit 3a40848aab
92 changed files with 2569 additions and 511 deletions
+171 -30
View File
@@ -38,8 +38,12 @@ if TYPE_CHECKING:
from .chatgenerationparams import (
ChatGenerationParams,
ChatGenerationParamsDataCollection,
ChatGenerationParamsImageConfig,
ChatGenerationParamsImageConfigTypedDict,
ChatGenerationParamsMaxPrice,
ChatGenerationParamsMaxPriceTypedDict,
ChatGenerationParamsPluginAutoRouter,
ChatGenerationParamsPluginAutoRouterTypedDict,
ChatGenerationParamsPluginFileParser,
ChatGenerationParamsPluginFileParserTypedDict,
ChatGenerationParamsPluginModeration,
@@ -50,6 +54,14 @@ if TYPE_CHECKING:
ChatGenerationParamsPluginUnionTypedDict,
ChatGenerationParamsPluginWeb,
ChatGenerationParamsPluginWebTypedDict,
ChatGenerationParamsPreferredMaxLatency,
ChatGenerationParamsPreferredMaxLatencyTypedDict,
ChatGenerationParamsPreferredMaxLatencyUnion,
ChatGenerationParamsPreferredMaxLatencyUnionTypedDict,
ChatGenerationParamsPreferredMinThroughput,
ChatGenerationParamsPreferredMinThroughputTypedDict,
ChatGenerationParamsPreferredMinThroughputUnion,
ChatGenerationParamsPreferredMinThroughputUnionTypedDict,
ChatGenerationParamsProvider,
ChatGenerationParamsProviderTypedDict,
ChatGenerationParamsResponseFormatJSONObject,
@@ -67,6 +79,7 @@ if TYPE_CHECKING:
DebugTypedDict,
Effort,
Engine,
Modality,
Pdf,
PdfEngine,
PdfTypedDict,
@@ -123,9 +136,9 @@ if TYPE_CHECKING:
)
from .chatmessagetokenlogprob import (
ChatMessageTokenLogprob,
ChatMessageTokenLogprobTopLogprob,
ChatMessageTokenLogprobTopLogprobTypedDict,
ChatMessageTokenLogprobTypedDict,
TopLogprob,
TopLogprobTypedDict,
)
from .chatmessagetokenlogprobs import (
ChatMessageTokenLogprobs,
@@ -333,17 +346,21 @@ if TYPE_CHECKING:
from .openairesponsestruncation import OpenAIResponsesTruncation
from .openresponseseasyinputmessage import (
OpenResponsesEasyInputMessage,
OpenResponsesEasyInputMessageContent1,
OpenResponsesEasyInputMessageContent1TypedDict,
OpenResponsesEasyInputMessageContent2,
OpenResponsesEasyInputMessageContent2TypedDict,
OpenResponsesEasyInputMessageContentInputImage,
OpenResponsesEasyInputMessageContentInputImageTypedDict,
OpenResponsesEasyInputMessageContentType,
OpenResponsesEasyInputMessageContentUnion1,
OpenResponsesEasyInputMessageContentUnion1TypedDict,
OpenResponsesEasyInputMessageContentUnion2,
OpenResponsesEasyInputMessageContentUnion2TypedDict,
OpenResponsesEasyInputMessageDetail,
OpenResponsesEasyInputMessageRoleAssistant,
OpenResponsesEasyInputMessageRoleDeveloper,
OpenResponsesEasyInputMessageRoleSystem,
OpenResponsesEasyInputMessageRoleUnion,
OpenResponsesEasyInputMessageRoleUnionTypedDict,
OpenResponsesEasyInputMessageRoleUser,
OpenResponsesEasyInputMessageType,
OpenResponsesEasyInputMessageTypeMessage,
OpenResponsesEasyInputMessageTypedDict,
)
from .openresponseserrorevent import (
@@ -389,14 +406,18 @@ if TYPE_CHECKING:
)
from .openresponsesinputmessageitem import (
OpenResponsesInputMessageItem,
OpenResponsesInputMessageItemContent,
OpenResponsesInputMessageItemContentTypedDict,
OpenResponsesInputMessageItemContentInputImage,
OpenResponsesInputMessageItemContentInputImageTypedDict,
OpenResponsesInputMessageItemContentType,
OpenResponsesInputMessageItemContentUnion,
OpenResponsesInputMessageItemContentUnionTypedDict,
OpenResponsesInputMessageItemDetail,
OpenResponsesInputMessageItemRoleDeveloper,
OpenResponsesInputMessageItemRoleSystem,
OpenResponsesInputMessageItemRoleUnion,
OpenResponsesInputMessageItemRoleUnionTypedDict,
OpenResponsesInputMessageItemRoleUser,
OpenResponsesInputMessageItemType,
OpenResponsesInputMessageItemTypeMessage,
OpenResponsesInputMessageItemTypedDict,
)
from .openresponseslogprobs import (
@@ -454,6 +475,7 @@ if TYPE_CHECKING:
OpenResponsesReasoningSummaryTextDoneEventTypedDict,
)
from .openresponsesrequest import (
IDAutoRouter,
IDFileParser,
IDModeration,
IDResponseHealing,
@@ -461,12 +483,16 @@ if TYPE_CHECKING:
OpenResponsesRequest,
OpenResponsesRequestIgnore,
OpenResponsesRequestIgnoreTypedDict,
OpenResponsesRequestImageConfig,
OpenResponsesRequestImageConfigTypedDict,
OpenResponsesRequestMaxPrice,
OpenResponsesRequestMaxPriceTypedDict,
OpenResponsesRequestOnly,
OpenResponsesRequestOnlyTypedDict,
OpenResponsesRequestOrder,
OpenResponsesRequestOrderTypedDict,
OpenResponsesRequestPluginAutoRouter,
OpenResponsesRequestPluginAutoRouterTypedDict,
OpenResponsesRequestPluginFileParser,
OpenResponsesRequestPluginFileParserTypedDict,
OpenResponsesRequestPluginModeration,
@@ -622,7 +648,21 @@ if TYPE_CHECKING:
)
from .pdfparserengine import PDFParserEngine
from .pdfparseroptions import PDFParserOptions, PDFParserOptionsTypedDict
from .percentilelatencycutoffs import (
PercentileLatencyCutoffs,
PercentileLatencyCutoffsTypedDict,
)
from .percentilestats import PercentileStats, PercentileStatsTypedDict
from .percentilethroughputcutoffs import (
PercentileThroughputCutoffs,
PercentileThroughputCutoffsTypedDict,
)
from .perrequestlimits import PerRequestLimits, PerRequestLimitsTypedDict
from .preferredmaxlatency import PreferredMaxLatency, PreferredMaxLatencyTypedDict
from .preferredminthroughput import (
PreferredMinThroughput,
PreferredMinThroughputTypedDict,
)
from .providername import ProviderName
from .provideroverloadedresponseerrordata import (
ProviderOverloadedResponseErrorData,
@@ -717,8 +757,17 @@ if TYPE_CHECKING:
ResponseInputTextType,
ResponseInputTextTypedDict,
)
from .responseinputvideo import (
ResponseInputVideo,
ResponseInputVideoType,
ResponseInputVideoTypedDict,
)
from .responseoutputtext import (
Logprob,
LogprobTypedDict,
ResponseOutputText,
ResponseOutputTextTopLogprob,
ResponseOutputTextTopLogprobTypedDict,
ResponseOutputTextType,
ResponseOutputTextTypedDict,
)
@@ -765,6 +814,7 @@ if TYPE_CHECKING:
)
from .responsesoutputitemreasoning import (
ResponsesOutputItemReasoning,
ResponsesOutputItemReasoningFormat,
ResponsesOutputItemReasoningStatusCompleted,
ResponsesOutputItemReasoningStatusInProgress,
ResponsesOutputItemReasoningStatusIncomplete,
@@ -786,6 +836,7 @@ if TYPE_CHECKING:
ResponsesOutputMessageType,
ResponsesOutputMessageTypedDict,
)
from .responsesoutputmodality import ResponsesOutputModality
from .responsessearchcontextsize import ResponsesSearchContextSize
from .responseswebsearchcalloutput import (
ResponsesWebSearchCallOutput,
@@ -873,8 +924,12 @@ __all__ = [
"ChatErrorErrorTypedDict",
"ChatGenerationParams",
"ChatGenerationParamsDataCollection",
"ChatGenerationParamsImageConfig",
"ChatGenerationParamsImageConfigTypedDict",
"ChatGenerationParamsMaxPrice",
"ChatGenerationParamsMaxPriceTypedDict",
"ChatGenerationParamsPluginAutoRouter",
"ChatGenerationParamsPluginAutoRouterTypedDict",
"ChatGenerationParamsPluginFileParser",
"ChatGenerationParamsPluginFileParserTypedDict",
"ChatGenerationParamsPluginModeration",
@@ -885,6 +940,14 @@ __all__ = [
"ChatGenerationParamsPluginUnionTypedDict",
"ChatGenerationParamsPluginWeb",
"ChatGenerationParamsPluginWebTypedDict",
"ChatGenerationParamsPreferredMaxLatency",
"ChatGenerationParamsPreferredMaxLatencyTypedDict",
"ChatGenerationParamsPreferredMaxLatencyUnion",
"ChatGenerationParamsPreferredMaxLatencyUnionTypedDict",
"ChatGenerationParamsPreferredMinThroughput",
"ChatGenerationParamsPreferredMinThroughputTypedDict",
"ChatGenerationParamsPreferredMinThroughputUnion",
"ChatGenerationParamsPreferredMinThroughputUnionTypedDict",
"ChatGenerationParamsProvider",
"ChatGenerationParamsProviderTypedDict",
"ChatGenerationParamsResponseFormatJSONObject",
@@ -920,6 +983,8 @@ __all__ = [
"ChatMessageContentItemVideoVideoURL",
"ChatMessageContentItemVideoVideoURLTypedDict",
"ChatMessageTokenLogprob",
"ChatMessageTokenLogprobTopLogprob",
"ChatMessageTokenLogprobTopLogprobTypedDict",
"ChatMessageTokenLogprobTypedDict",
"ChatMessageTokenLogprobs",
"ChatMessageTokenLogprobsTypedDict",
@@ -996,6 +1061,7 @@ __all__ = [
"FilePathTypedDict",
"ForbiddenResponseErrorData",
"ForbiddenResponseErrorDataTypedDict",
"IDAutoRouter",
"IDFileParser",
"IDModeration",
"IDResponseHealing",
@@ -1013,12 +1079,15 @@ __all__ = [
"JSONSchemaConfigTypedDict",
"ListEndpointsResponse",
"ListEndpointsResponseTypedDict",
"Logprob",
"LogprobTypedDict",
"Message",
"MessageContent",
"MessageContentTypedDict",
"MessageDeveloper",
"MessageDeveloperTypedDict",
"MessageTypedDict",
"Modality",
"Model",
"ModelArchitecture",
"ModelArchitectureInstructType",
@@ -1100,17 +1169,21 @@ __all__ = [
"OpenAIResponsesToolChoiceUnionTypedDict",
"OpenAIResponsesTruncation",
"OpenResponsesEasyInputMessage",
"OpenResponsesEasyInputMessageContent1",
"OpenResponsesEasyInputMessageContent1TypedDict",
"OpenResponsesEasyInputMessageContent2",
"OpenResponsesEasyInputMessageContent2TypedDict",
"OpenResponsesEasyInputMessageContentInputImage",
"OpenResponsesEasyInputMessageContentInputImageTypedDict",
"OpenResponsesEasyInputMessageContentType",
"OpenResponsesEasyInputMessageContentUnion1",
"OpenResponsesEasyInputMessageContentUnion1TypedDict",
"OpenResponsesEasyInputMessageContentUnion2",
"OpenResponsesEasyInputMessageContentUnion2TypedDict",
"OpenResponsesEasyInputMessageDetail",
"OpenResponsesEasyInputMessageRoleAssistant",
"OpenResponsesEasyInputMessageRoleDeveloper",
"OpenResponsesEasyInputMessageRoleSystem",
"OpenResponsesEasyInputMessageRoleUnion",
"OpenResponsesEasyInputMessageRoleUnionTypedDict",
"OpenResponsesEasyInputMessageRoleUser",
"OpenResponsesEasyInputMessageType",
"OpenResponsesEasyInputMessageTypeMessage",
"OpenResponsesEasyInputMessageTypedDict",
"OpenResponsesErrorEvent",
"OpenResponsesErrorEventType",
@@ -1137,14 +1210,18 @@ __all__ = [
"OpenResponsesInput1",
"OpenResponsesInput1TypedDict",
"OpenResponsesInputMessageItem",
"OpenResponsesInputMessageItemContent",
"OpenResponsesInputMessageItemContentTypedDict",
"OpenResponsesInputMessageItemContentInputImage",
"OpenResponsesInputMessageItemContentInputImageTypedDict",
"OpenResponsesInputMessageItemContentType",
"OpenResponsesInputMessageItemContentUnion",
"OpenResponsesInputMessageItemContentUnionTypedDict",
"OpenResponsesInputMessageItemDetail",
"OpenResponsesInputMessageItemRoleDeveloper",
"OpenResponsesInputMessageItemRoleSystem",
"OpenResponsesInputMessageItemRoleUnion",
"OpenResponsesInputMessageItemRoleUnionTypedDict",
"OpenResponsesInputMessageItemRoleUser",
"OpenResponsesInputMessageItemType",
"OpenResponsesInputMessageItemTypeMessage",
"OpenResponsesInputMessageItemTypedDict",
"OpenResponsesInputTypedDict",
"OpenResponsesLogProbs",
@@ -1185,12 +1262,16 @@ __all__ = [
"OpenResponsesRequest",
"OpenResponsesRequestIgnore",
"OpenResponsesRequestIgnoreTypedDict",
"OpenResponsesRequestImageConfig",
"OpenResponsesRequestImageConfigTypedDict",
"OpenResponsesRequestMaxPrice",
"OpenResponsesRequestMaxPriceTypedDict",
"OpenResponsesRequestOnly",
"OpenResponsesRequestOnlyTypedDict",
"OpenResponsesRequestOrder",
"OpenResponsesRequestOrderTypedDict",
"OpenResponsesRequestPluginAutoRouter",
"OpenResponsesRequestPluginAutoRouterTypedDict",
"OpenResponsesRequestPluginFileParser",
"OpenResponsesRequestPluginFileParserTypedDict",
"OpenResponsesRequestPluginModeration",
@@ -1305,6 +1386,16 @@ __all__ = [
"PdfTypedDict",
"PerRequestLimits",
"PerRequestLimitsTypedDict",
"PercentileLatencyCutoffs",
"PercentileLatencyCutoffsTypedDict",
"PercentileStats",
"PercentileStatsTypedDict",
"PercentileThroughputCutoffs",
"PercentileThroughputCutoffsTypedDict",
"PreferredMaxLatency",
"PreferredMaxLatencyTypedDict",
"PreferredMinThroughput",
"PreferredMinThroughputTypedDict",
"Pricing",
"PricingTypedDict",
"Prompt",
@@ -1379,7 +1470,12 @@ __all__ = [
"ResponseInputText",
"ResponseInputTextType",
"ResponseInputTextTypedDict",
"ResponseInputVideo",
"ResponseInputVideoType",
"ResponseInputVideoTypedDict",
"ResponseOutputText",
"ResponseOutputTextTopLogprob",
"ResponseOutputTextTopLogprobTypedDict",
"ResponseOutputTextType",
"ResponseOutputTextTypedDict",
"ResponseTextConfig",
@@ -1412,6 +1508,7 @@ __all__ = [
"ResponsesOutputItemFunctionCallType",
"ResponsesOutputItemFunctionCallTypedDict",
"ResponsesOutputItemReasoning",
"ResponsesOutputItemReasoningFormat",
"ResponsesOutputItemReasoningStatusCompleted",
"ResponsesOutputItemReasoningStatusInProgress",
"ResponsesOutputItemReasoningStatusIncomplete",
@@ -1431,6 +1528,7 @@ __all__ = [
"ResponsesOutputMessageStatusUnionTypedDict",
"ResponsesOutputMessageType",
"ResponsesOutputMessageTypedDict",
"ResponsesOutputModality",
"ResponsesSearchContextSize",
"ResponsesWebSearchCallOutput",
"ResponsesWebSearchCallOutputType",
@@ -1476,8 +1574,6 @@ __all__ = [
"ToolResponseMessageContent",
"ToolResponseMessageContentTypedDict",
"ToolResponseMessageTypedDict",
"TopLogprob",
"TopLogprobTypedDict",
"TopProviderInfo",
"TopProviderInfoTypedDict",
"Truncation",
@@ -1554,8 +1650,12 @@ _dynamic_imports: dict[str, str] = {
"CodeTypedDict": ".chaterror",
"ChatGenerationParams": ".chatgenerationparams",
"ChatGenerationParamsDataCollection": ".chatgenerationparams",
"ChatGenerationParamsImageConfig": ".chatgenerationparams",
"ChatGenerationParamsImageConfigTypedDict": ".chatgenerationparams",
"ChatGenerationParamsMaxPrice": ".chatgenerationparams",
"ChatGenerationParamsMaxPriceTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginAutoRouter": ".chatgenerationparams",
"ChatGenerationParamsPluginAutoRouterTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginFileParser": ".chatgenerationparams",
"ChatGenerationParamsPluginFileParserTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginModeration": ".chatgenerationparams",
@@ -1566,6 +1666,14 @@ _dynamic_imports: dict[str, str] = {
"ChatGenerationParamsPluginUnionTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginWeb": ".chatgenerationparams",
"ChatGenerationParamsPluginWebTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPreferredMaxLatency": ".chatgenerationparams",
"ChatGenerationParamsPreferredMaxLatencyTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPreferredMaxLatencyUnion": ".chatgenerationparams",
"ChatGenerationParamsPreferredMaxLatencyUnionTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPreferredMinThroughput": ".chatgenerationparams",
"ChatGenerationParamsPreferredMinThroughputTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPreferredMinThroughputUnion": ".chatgenerationparams",
"ChatGenerationParamsPreferredMinThroughputUnionTypedDict": ".chatgenerationparams",
"ChatGenerationParamsProvider": ".chatgenerationparams",
"ChatGenerationParamsProviderTypedDict": ".chatgenerationparams",
"ChatGenerationParamsResponseFormatJSONObject": ".chatgenerationparams",
@@ -1583,6 +1691,7 @@ _dynamic_imports: dict[str, str] = {
"DebugTypedDict": ".chatgenerationparams",
"Effort": ".chatgenerationparams",
"Engine": ".chatgenerationparams",
"Modality": ".chatgenerationparams",
"Pdf": ".chatgenerationparams",
"PdfEngine": ".chatgenerationparams",
"PdfTypedDict": ".chatgenerationparams",
@@ -1623,9 +1732,9 @@ _dynamic_imports: dict[str, str] = {
"VideoURL2": ".chatmessagecontentitemvideo",
"VideoURL2TypedDict": ".chatmessagecontentitemvideo",
"ChatMessageTokenLogprob": ".chatmessagetokenlogprob",
"ChatMessageTokenLogprobTopLogprob": ".chatmessagetokenlogprob",
"ChatMessageTokenLogprobTopLogprobTypedDict": ".chatmessagetokenlogprob",
"ChatMessageTokenLogprobTypedDict": ".chatmessagetokenlogprob",
"TopLogprob": ".chatmessagetokenlogprob",
"TopLogprobTypedDict": ".chatmessagetokenlogprob",
"ChatMessageTokenLogprobs": ".chatmessagetokenlogprobs",
"ChatMessageTokenLogprobsTypedDict": ".chatmessagetokenlogprobs",
"ChatMessageToolCall": ".chatmessagetoolcall",
@@ -1798,17 +1907,21 @@ _dynamic_imports: dict[str, str] = {
"TypeTypedDict": ".openairesponsestoolchoice_union",
"OpenAIResponsesTruncation": ".openairesponsestruncation",
"OpenResponsesEasyInputMessage": ".openresponseseasyinputmessage",
"OpenResponsesEasyInputMessageContent1": ".openresponseseasyinputmessage",
"OpenResponsesEasyInputMessageContent1TypedDict": ".openresponseseasyinputmessage",
"OpenResponsesEasyInputMessageContent2": ".openresponseseasyinputmessage",
"OpenResponsesEasyInputMessageContent2TypedDict": ".openresponseseasyinputmessage",
"OpenResponsesEasyInputMessageContentInputImage": ".openresponseseasyinputmessage",
"OpenResponsesEasyInputMessageContentInputImageTypedDict": ".openresponseseasyinputmessage",
"OpenResponsesEasyInputMessageContentType": ".openresponseseasyinputmessage",
"OpenResponsesEasyInputMessageContentUnion1": ".openresponseseasyinputmessage",
"OpenResponsesEasyInputMessageContentUnion1TypedDict": ".openresponseseasyinputmessage",
"OpenResponsesEasyInputMessageContentUnion2": ".openresponseseasyinputmessage",
"OpenResponsesEasyInputMessageContentUnion2TypedDict": ".openresponseseasyinputmessage",
"OpenResponsesEasyInputMessageDetail": ".openresponseseasyinputmessage",
"OpenResponsesEasyInputMessageRoleAssistant": ".openresponseseasyinputmessage",
"OpenResponsesEasyInputMessageRoleDeveloper": ".openresponseseasyinputmessage",
"OpenResponsesEasyInputMessageRoleSystem": ".openresponseseasyinputmessage",
"OpenResponsesEasyInputMessageRoleUnion": ".openresponseseasyinputmessage",
"OpenResponsesEasyInputMessageRoleUnionTypedDict": ".openresponseseasyinputmessage",
"OpenResponsesEasyInputMessageRoleUser": ".openresponseseasyinputmessage",
"OpenResponsesEasyInputMessageType": ".openresponseseasyinputmessage",
"OpenResponsesEasyInputMessageTypeMessage": ".openresponseseasyinputmessage",
"OpenResponsesEasyInputMessageTypedDict": ".openresponseseasyinputmessage",
"OpenResponsesErrorEvent": ".openresponseserrorevent",
"OpenResponsesErrorEventType": ".openresponseserrorevent",
@@ -1836,14 +1949,18 @@ _dynamic_imports: dict[str, str] = {
"OpenResponsesInput1TypedDict": ".openresponsesinput",
"OpenResponsesInputTypedDict": ".openresponsesinput",
"OpenResponsesInputMessageItem": ".openresponsesinputmessageitem",
"OpenResponsesInputMessageItemContent": ".openresponsesinputmessageitem",
"OpenResponsesInputMessageItemContentTypedDict": ".openresponsesinputmessageitem",
"OpenResponsesInputMessageItemContentInputImage": ".openresponsesinputmessageitem",
"OpenResponsesInputMessageItemContentInputImageTypedDict": ".openresponsesinputmessageitem",
"OpenResponsesInputMessageItemContentType": ".openresponsesinputmessageitem",
"OpenResponsesInputMessageItemContentUnion": ".openresponsesinputmessageitem",
"OpenResponsesInputMessageItemContentUnionTypedDict": ".openresponsesinputmessageitem",
"OpenResponsesInputMessageItemDetail": ".openresponsesinputmessageitem",
"OpenResponsesInputMessageItemRoleDeveloper": ".openresponsesinputmessageitem",
"OpenResponsesInputMessageItemRoleSystem": ".openresponsesinputmessageitem",
"OpenResponsesInputMessageItemRoleUnion": ".openresponsesinputmessageitem",
"OpenResponsesInputMessageItemRoleUnionTypedDict": ".openresponsesinputmessageitem",
"OpenResponsesInputMessageItemRoleUser": ".openresponsesinputmessageitem",
"OpenResponsesInputMessageItemType": ".openresponsesinputmessageitem",
"OpenResponsesInputMessageItemTypeMessage": ".openresponsesinputmessageitem",
"OpenResponsesInputMessageItemTypedDict": ".openresponsesinputmessageitem",
"OpenResponsesLogProbs": ".openresponseslogprobs",
"OpenResponsesLogProbsTypedDict": ".openresponseslogprobs",
@@ -1881,6 +1998,7 @@ _dynamic_imports: dict[str, str] = {
"OpenResponsesReasoningSummaryTextDoneEvent": ".openresponsesreasoningsummarytextdoneevent",
"OpenResponsesReasoningSummaryTextDoneEventType": ".openresponsesreasoningsummarytextdoneevent",
"OpenResponsesReasoningSummaryTextDoneEventTypedDict": ".openresponsesreasoningsummarytextdoneevent",
"IDAutoRouter": ".openresponsesrequest",
"IDFileParser": ".openresponsesrequest",
"IDModeration": ".openresponsesrequest",
"IDResponseHealing": ".openresponsesrequest",
@@ -1888,12 +2006,16 @@ _dynamic_imports: dict[str, str] = {
"OpenResponsesRequest": ".openresponsesrequest",
"OpenResponsesRequestIgnore": ".openresponsesrequest",
"OpenResponsesRequestIgnoreTypedDict": ".openresponsesrequest",
"OpenResponsesRequestImageConfig": ".openresponsesrequest",
"OpenResponsesRequestImageConfigTypedDict": ".openresponsesrequest",
"OpenResponsesRequestMaxPrice": ".openresponsesrequest",
"OpenResponsesRequestMaxPriceTypedDict": ".openresponsesrequest",
"OpenResponsesRequestOnly": ".openresponsesrequest",
"OpenResponsesRequestOnlyTypedDict": ".openresponsesrequest",
"OpenResponsesRequestOrder": ".openresponsesrequest",
"OpenResponsesRequestOrderTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginAutoRouter": ".openresponsesrequest",
"OpenResponsesRequestPluginAutoRouterTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginFileParser": ".openresponsesrequest",
"OpenResponsesRequestPluginFileParserTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginModeration": ".openresponsesrequest",
@@ -2025,8 +2147,18 @@ _dynamic_imports: dict[str, str] = {
"PDFParserEngine": ".pdfparserengine",
"PDFParserOptions": ".pdfparseroptions",
"PDFParserOptionsTypedDict": ".pdfparseroptions",
"PercentileLatencyCutoffs": ".percentilelatencycutoffs",
"PercentileLatencyCutoffsTypedDict": ".percentilelatencycutoffs",
"PercentileStats": ".percentilestats",
"PercentileStatsTypedDict": ".percentilestats",
"PercentileThroughputCutoffs": ".percentilethroughputcutoffs",
"PercentileThroughputCutoffsTypedDict": ".percentilethroughputcutoffs",
"PerRequestLimits": ".perrequestlimits",
"PerRequestLimitsTypedDict": ".perrequestlimits",
"PreferredMaxLatency": ".preferredmaxlatency",
"PreferredMaxLatencyTypedDict": ".preferredmaxlatency",
"PreferredMinThroughput": ".preferredminthroughput",
"PreferredMinThroughputTypedDict": ".preferredminthroughput",
"ProviderName": ".providername",
"ProviderOverloadedResponseErrorData": ".provideroverloadedresponseerrordata",
"ProviderOverloadedResponseErrorDataTypedDict": ".provideroverloadedresponseerrordata",
@@ -2095,7 +2227,14 @@ _dynamic_imports: dict[str, str] = {
"ResponseInputText": ".responseinputtext",
"ResponseInputTextType": ".responseinputtext",
"ResponseInputTextTypedDict": ".responseinputtext",
"ResponseInputVideo": ".responseinputvideo",
"ResponseInputVideoType": ".responseinputvideo",
"ResponseInputVideoTypedDict": ".responseinputvideo",
"Logprob": ".responseoutputtext",
"LogprobTypedDict": ".responseoutputtext",
"ResponseOutputText": ".responseoutputtext",
"ResponseOutputTextTopLogprob": ".responseoutputtext",
"ResponseOutputTextTopLogprobTypedDict": ".responseoutputtext",
"ResponseOutputTextType": ".responseoutputtext",
"ResponseOutputTextTypedDict": ".responseoutputtext",
"CodeEnum": ".responseserrorfield",
@@ -2127,6 +2266,7 @@ _dynamic_imports: dict[str, str] = {
"ResponsesOutputItemFunctionCallType": ".responsesoutputitemfunctioncall",
"ResponsesOutputItemFunctionCallTypedDict": ".responsesoutputitemfunctioncall",
"ResponsesOutputItemReasoning": ".responsesoutputitemreasoning",
"ResponsesOutputItemReasoningFormat": ".responsesoutputitemreasoning",
"ResponsesOutputItemReasoningStatusCompleted": ".responsesoutputitemreasoning",
"ResponsesOutputItemReasoningStatusInProgress": ".responsesoutputitemreasoning",
"ResponsesOutputItemReasoningStatusIncomplete": ".responsesoutputitemreasoning",
@@ -2145,6 +2285,7 @@ _dynamic_imports: dict[str, str] = {
"ResponsesOutputMessageStatusUnionTypedDict": ".responsesoutputmessage",
"ResponsesOutputMessageType": ".responsesoutputmessage",
"ResponsesOutputMessageTypedDict": ".responsesoutputmessage",
"ResponsesOutputModality": ".responsesoutputmodality",
"ResponsesSearchContextSize": ".responsessearchcontextsize",
"ResponsesWebSearchCallOutput": ".responseswebsearchcalloutput",
"ResponsesWebSearchCallOutputType": ".responseswebsearchcalloutput",
+3 -2
View File
@@ -36,12 +36,12 @@ Schema0Enum = Union[
"Fireworks",
"Friendli",
"GMICloud",
"GoPomelo",
"Google",
"Google AI Studio",
"Groq",
"Hyperbolic",
"Inception",
"Inceptron",
"InferenceNet",
"Infermatic",
"Inflection",
@@ -66,13 +66,14 @@ Schema0Enum = Union[
"Phala",
"Relace",
"SambaNova",
"Seed",
"SiliconFlow",
"Sourceful",
"Stealth",
"StreamLake",
"Switchpoint",
"Targon",
"Together",
"Upstage",
"Venice",
"WandB",
"Xiaomi",
+1
View File
@@ -21,6 +21,7 @@ Schema5 = Union[
Literal[
"unknown",
"openai-responses-v1",
"azure-openai-responses-v1",
"xai-responses-v1",
"anthropic-claude-v1",
"google-gemini-v1",
+184 -14
View File
@@ -80,6 +80,124 @@ class ChatGenerationParamsMaxPrice(BaseModel):
request: Optional[Any] = None
class ChatGenerationParamsPreferredMinThroughputTypedDict(TypedDict):
p50: NotRequired[Nullable[float]]
p75: NotRequired[Nullable[float]]
p90: NotRequired[Nullable[float]]
p99: NotRequired[Nullable[float]]
class ChatGenerationParamsPreferredMinThroughput(BaseModel):
p50: OptionalNullable[float] = UNSET
p75: OptionalNullable[float] = UNSET
p90: OptionalNullable[float] = UNSET
p99: OptionalNullable[float] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["p50", "p75", "p90", "p99"]
nullable_fields = ["p50", "p75", "p90", "p99"]
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
ChatGenerationParamsPreferredMinThroughputUnionTypedDict = TypeAliasType(
"ChatGenerationParamsPreferredMinThroughputUnionTypedDict",
Union[ChatGenerationParamsPreferredMinThroughputTypedDict, float],
)
ChatGenerationParamsPreferredMinThroughputUnion = TypeAliasType(
"ChatGenerationParamsPreferredMinThroughputUnion",
Union[ChatGenerationParamsPreferredMinThroughput, float],
)
class ChatGenerationParamsPreferredMaxLatencyTypedDict(TypedDict):
p50: NotRequired[Nullable[float]]
p75: NotRequired[Nullable[float]]
p90: NotRequired[Nullable[float]]
p99: NotRequired[Nullable[float]]
class ChatGenerationParamsPreferredMaxLatency(BaseModel):
p50: OptionalNullable[float] = UNSET
p75: OptionalNullable[float] = UNSET
p90: OptionalNullable[float] = UNSET
p99: OptionalNullable[float] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["p50", "p75", "p90", "p99"]
nullable_fields = ["p50", "p75", "p90", "p99"]
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
ChatGenerationParamsPreferredMaxLatencyUnionTypedDict = TypeAliasType(
"ChatGenerationParamsPreferredMaxLatencyUnionTypedDict",
Union[ChatGenerationParamsPreferredMaxLatencyTypedDict, float],
)
ChatGenerationParamsPreferredMaxLatencyUnion = TypeAliasType(
"ChatGenerationParamsPreferredMaxLatencyUnion",
Union[ChatGenerationParamsPreferredMaxLatency, float],
)
class ChatGenerationParamsProviderTypedDict(TypedDict):
allow_fallbacks: NotRequired[Nullable[bool]]
r"""Whether to allow backup providers to serve requests
@@ -109,10 +227,14 @@ class ChatGenerationParamsProviderTypedDict(TypedDict):
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
max_price: NotRequired[ChatGenerationParamsMaxPriceTypedDict]
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
preferred_min_throughput: NotRequired[Nullable[float]]
preferred_max_latency: NotRequired[Nullable[float]]
min_throughput: NotRequired[Nullable[float]]
max_latency: NotRequired[Nullable[float]]
preferred_min_throughput: NotRequired[
Nullable[ChatGenerationParamsPreferredMinThroughputUnionTypedDict]
]
r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
preferred_max_latency: NotRequired[
Nullable[ChatGenerationParamsPreferredMaxLatencyUnionTypedDict]
]
r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
class ChatGenerationParamsProvider(BaseModel):
@@ -160,13 +282,15 @@ class ChatGenerationParamsProvider(BaseModel):
max_price: Optional[ChatGenerationParamsMaxPrice] = None
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
preferred_min_throughput: OptionalNullable[float] = UNSET
preferred_min_throughput: OptionalNullable[
ChatGenerationParamsPreferredMinThroughputUnion
] = UNSET
r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
preferred_max_latency: OptionalNullable[float] = UNSET
min_throughput: OptionalNullable[float] = UNSET
max_latency: OptionalNullable[float] = UNSET
preferred_max_latency: OptionalNullable[
ChatGenerationParamsPreferredMaxLatencyUnion
] = UNSET
r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
@@ -184,8 +308,6 @@ class ChatGenerationParamsProvider(BaseModel):
"max_price",
"preferred_min_throughput",
"preferred_max_latency",
"min_throughput",
"max_latency",
]
nullable_fields = [
"allow_fallbacks",
@@ -200,8 +322,6 @@ class ChatGenerationParamsProvider(BaseModel):
"sort",
"preferred_min_throughput",
"preferred_max_latency",
"min_throughput",
"max_latency",
]
null_default_fields = []
@@ -331,11 +451,31 @@ class ChatGenerationParamsPluginModeration(BaseModel):
] = "moderation"
class ChatGenerationParamsPluginAutoRouterTypedDict(TypedDict):
id: Literal["auto-router"]
enabled: NotRequired[bool]
allowed_models: NotRequired[List[str]]
class ChatGenerationParamsPluginAutoRouter(BaseModel):
ID: Annotated[
Annotated[
Literal["auto-router"], AfterValidator(validate_const("auto-router"))
],
pydantic.Field(alias="id"),
] = "auto-router"
enabled: Optional[bool] = None
allowed_models: Optional[List[str]] = None
ChatGenerationParamsPluginUnionTypedDict = TypeAliasType(
"ChatGenerationParamsPluginUnionTypedDict",
Union[
ChatGenerationParamsPluginModerationTypedDict,
ChatGenerationParamsPluginResponseHealingTypedDict,
ChatGenerationParamsPluginAutoRouterTypedDict,
ChatGenerationParamsPluginFileParserTypedDict,
ChatGenerationParamsPluginWebTypedDict,
],
@@ -344,6 +484,7 @@ ChatGenerationParamsPluginUnionTypedDict = TypeAliasType(
ChatGenerationParamsPluginUnion = Annotated[
Union[
Annotated[ChatGenerationParamsPluginAutoRouter, Tag("auto-router")],
Annotated[ChatGenerationParamsPluginModeration, Tag("moderation")],
Annotated[ChatGenerationParamsPluginWeb, Tag("web")],
Annotated[ChatGenerationParamsPluginFileParser, Tag("file-parser")],
@@ -498,6 +639,25 @@ class Debug(BaseModel):
echo_upstream_body: Optional[bool] = None
ChatGenerationParamsImageConfigTypedDict = TypeAliasType(
"ChatGenerationParamsImageConfigTypedDict", Union[str, float]
)
ChatGenerationParamsImageConfig = TypeAliasType(
"ChatGenerationParamsImageConfig", Union[str, float]
)
Modality = Union[
Literal[
"text",
"image",
],
UnrecognizedStr,
]
class ChatGenerationParamsTypedDict(TypedDict):
messages: List[MessageTypedDict]
provider: NotRequired[Nullable[ChatGenerationParamsProviderTypedDict]]
@@ -529,6 +689,8 @@ class ChatGenerationParamsTypedDict(TypedDict):
tools: NotRequired[List[ToolDefinitionJSONTypedDict]]
top_p: NotRequired[Nullable[float]]
debug: NotRequired[DebugTypedDict]
image_config: NotRequired[Dict[str, ChatGenerationParamsImageConfigTypedDict]]
modalities: NotRequired[List[Modality]]
class ChatGenerationParams(BaseModel):
@@ -591,6 +753,12 @@ class ChatGenerationParams(BaseModel):
debug: Optional[Debug] = None
image_config: Optional[Dict[str, ChatGenerationParamsImageConfig]] = None
modalities: Optional[
List[Annotated[Modality, PlainValidator(validate_open_enum(False))]]
] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
@@ -620,6 +788,8 @@ class ChatGenerationParams(BaseModel):
"tools",
"top_p",
"debug",
"image_config",
"modalities",
]
nullable_fields = [
"provider",
@@ -72,6 +72,7 @@ class CompletionTokensDetails(BaseModel):
class PromptTokensDetailsTypedDict(TypedDict):
cached_tokens: NotRequired[float]
cache_write_tokens: NotRequired[float]
audio_tokens: NotRequired[float]
video_tokens: NotRequired[float]
@@ -79,6 +80,8 @@ class PromptTokensDetailsTypedDict(TypedDict):
class PromptTokensDetails(BaseModel):
cached_tokens: Optional[float] = None
cache_write_tokens: Optional[float] = None
audio_tokens: Optional[float] = None
video_tokens: Optional[float] = None
@@ -8,13 +8,13 @@ from typing import List
from typing_extensions import Annotated, TypedDict
class TopLogprobTypedDict(TypedDict):
class ChatMessageTokenLogprobTopLogprobTypedDict(TypedDict):
token: str
logprob: float
bytes_: Nullable[List[float]]
class TopLogprob(BaseModel):
class ChatMessageTokenLogprobTopLogprob(BaseModel):
token: str
logprob: float
@@ -56,7 +56,7 @@ class ChatMessageTokenLogprobTypedDict(TypedDict):
token: str
logprob: float
bytes_: Nullable[List[float]]
top_logprobs: List[TopLogprobTypedDict]
top_logprobs: List[ChatMessageTokenLogprobTopLogprobTypedDict]
class ChatMessageTokenLogprob(BaseModel):
@@ -66,7 +66,7 @@ class ChatMessageTokenLogprob(BaseModel):
bytes_: Annotated[Nullable[List[float]], pydantic.Field(alias="bytes")]
top_logprobs: List[TopLogprob]
top_logprobs: List[ChatMessageTokenLogprobTopLogprob]
@model_serializer(mode="wrap")
def serialize_model(self, handler):
@@ -3,16 +3,24 @@
from __future__ import annotations
from .responseinputaudio import ResponseInputAudio, ResponseInputAudioTypedDict
from .responseinputfile import ResponseInputFile, ResponseInputFileTypedDict
from .responseinputimage import ResponseInputImage, ResponseInputImageTypedDict
from .responseinputtext import ResponseInputText, ResponseInputTextTypedDict
from openrouter.types import BaseModel
from openrouter.utils import get_discriminator
from pydantic import Discriminator, Tag
from .responseinputvideo import ResponseInputVideo, ResponseInputVideoTypedDict
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import get_discriminator, validate_open_enum
from pydantic import Discriminator, Tag, model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
OpenResponsesEasyInputMessageType = Literal["message",]
OpenResponsesEasyInputMessageTypeMessage = Literal["message",]
OpenResponsesEasyInputMessageRoleDeveloper = Literal["developer",]
@@ -49,49 +57,114 @@ OpenResponsesEasyInputMessageRoleUnion = TypeAliasType(
)
OpenResponsesEasyInputMessageContent1TypedDict = TypeAliasType(
"OpenResponsesEasyInputMessageContent1TypedDict",
OpenResponsesEasyInputMessageContentType = Literal["input_image",]
OpenResponsesEasyInputMessageDetail = Union[
Literal[
"auto",
"high",
"low",
],
UnrecognizedStr,
]
class OpenResponsesEasyInputMessageContentInputImageTypedDict(TypedDict):
r"""Image input content item"""
type: OpenResponsesEasyInputMessageContentType
detail: OpenResponsesEasyInputMessageDetail
image_url: NotRequired[Nullable[str]]
class OpenResponsesEasyInputMessageContentInputImage(BaseModel):
r"""Image input content item"""
type: OpenResponsesEasyInputMessageContentType
detail: Annotated[
OpenResponsesEasyInputMessageDetail, PlainValidator(validate_open_enum(False))
]
image_url: OptionalNullable[str] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["image_url"]
nullable_fields = ["image_url"]
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
OpenResponsesEasyInputMessageContentUnion1TypedDict = TypeAliasType(
"OpenResponsesEasyInputMessageContentUnion1TypedDict",
Union[
ResponseInputTextTypedDict,
ResponseInputAudioTypedDict,
ResponseInputImageTypedDict,
ResponseInputVideoTypedDict,
OpenResponsesEasyInputMessageContentInputImageTypedDict,
ResponseInputFileTypedDict,
],
)
OpenResponsesEasyInputMessageContent1 = Annotated[
OpenResponsesEasyInputMessageContentUnion1 = Annotated[
Union[
Annotated[ResponseInputText, Tag("input_text")],
Annotated[ResponseInputImage, Tag("input_image")],
Annotated[OpenResponsesEasyInputMessageContentInputImage, Tag("input_image")],
Annotated[ResponseInputFile, Tag("input_file")],
Annotated[ResponseInputAudio, Tag("input_audio")],
Annotated[ResponseInputVideo, Tag("input_video")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
OpenResponsesEasyInputMessageContent2TypedDict = TypeAliasType(
"OpenResponsesEasyInputMessageContent2TypedDict",
Union[List[OpenResponsesEasyInputMessageContent1TypedDict], str],
OpenResponsesEasyInputMessageContentUnion2TypedDict = TypeAliasType(
"OpenResponsesEasyInputMessageContentUnion2TypedDict",
Union[List[OpenResponsesEasyInputMessageContentUnion1TypedDict], str],
)
OpenResponsesEasyInputMessageContent2 = TypeAliasType(
"OpenResponsesEasyInputMessageContent2",
Union[List[OpenResponsesEasyInputMessageContent1], str],
OpenResponsesEasyInputMessageContentUnion2 = TypeAliasType(
"OpenResponsesEasyInputMessageContentUnion2",
Union[List[OpenResponsesEasyInputMessageContentUnion1], str],
)
class OpenResponsesEasyInputMessageTypedDict(TypedDict):
role: OpenResponsesEasyInputMessageRoleUnionTypedDict
content: OpenResponsesEasyInputMessageContent2TypedDict
type: NotRequired[OpenResponsesEasyInputMessageType]
content: OpenResponsesEasyInputMessageContentUnion2TypedDict
type: NotRequired[OpenResponsesEasyInputMessageTypeMessage]
class OpenResponsesEasyInputMessage(BaseModel):
role: OpenResponsesEasyInputMessageRoleUnion
content: OpenResponsesEasyInputMessageContent2
content: OpenResponsesEasyInputMessageContentUnion2
type: Optional[OpenResponsesEasyInputMessageType] = None
type: Optional[OpenResponsesEasyInputMessageTypeMessage] = None
@@ -60,9 +60,9 @@ OpenResponsesInput1TypedDict = TypeAliasType(
OpenResponsesFunctionCallOutputTypedDict,
ResponsesOutputMessageTypedDict,
OpenResponsesFunctionToolCallTypedDict,
ResponsesOutputItemReasoningTypedDict,
ResponsesOutputItemFunctionCallTypedDict,
OpenResponsesReasoningTypedDict,
ResponsesOutputItemReasoningTypedDict,
],
)
@@ -78,9 +78,9 @@ OpenResponsesInput1 = TypeAliasType(
OpenResponsesFunctionCallOutput,
ResponsesOutputMessage,
OpenResponsesFunctionToolCall,
ResponsesOutputItemReasoning,
ResponsesOutputItemFunctionCall,
OpenResponsesReasoning,
ResponsesOutputItemReasoning,
],
)
@@ -3,16 +3,24 @@
from __future__ import annotations
from .responseinputaudio import ResponseInputAudio, ResponseInputAudioTypedDict
from .responseinputfile import ResponseInputFile, ResponseInputFileTypedDict
from .responseinputimage import ResponseInputImage, ResponseInputImageTypedDict
from .responseinputtext import ResponseInputText, ResponseInputTextTypedDict
from openrouter.types import BaseModel
from openrouter.utils import get_discriminator
from pydantic import Discriminator, Tag
from .responseinputvideo import ResponseInputVideo, ResponseInputVideoTypedDict
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import get_discriminator, validate_open_enum
from pydantic import Discriminator, Tag, model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
OpenResponsesInputMessageItemType = Literal["message",]
OpenResponsesInputMessageItemTypeMessage = Literal["message",]
OpenResponsesInputMessageItemRoleDeveloper = Literal["developer",]
@@ -44,23 +52,88 @@ OpenResponsesInputMessageItemRoleUnion = TypeAliasType(
)
OpenResponsesInputMessageItemContentTypedDict = TypeAliasType(
"OpenResponsesInputMessageItemContentTypedDict",
OpenResponsesInputMessageItemContentType = Literal["input_image",]
OpenResponsesInputMessageItemDetail = Union[
Literal[
"auto",
"high",
"low",
],
UnrecognizedStr,
]
class OpenResponsesInputMessageItemContentInputImageTypedDict(TypedDict):
r"""Image input content item"""
type: OpenResponsesInputMessageItemContentType
detail: OpenResponsesInputMessageItemDetail
image_url: NotRequired[Nullable[str]]
class OpenResponsesInputMessageItemContentInputImage(BaseModel):
r"""Image input content item"""
type: OpenResponsesInputMessageItemContentType
detail: Annotated[
OpenResponsesInputMessageItemDetail, PlainValidator(validate_open_enum(False))
]
image_url: OptionalNullable[str] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["image_url"]
nullable_fields = ["image_url"]
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
OpenResponsesInputMessageItemContentUnionTypedDict = TypeAliasType(
"OpenResponsesInputMessageItemContentUnionTypedDict",
Union[
ResponseInputTextTypedDict,
ResponseInputAudioTypedDict,
ResponseInputImageTypedDict,
ResponseInputVideoTypedDict,
OpenResponsesInputMessageItemContentInputImageTypedDict,
ResponseInputFileTypedDict,
],
)
OpenResponsesInputMessageItemContent = Annotated[
OpenResponsesInputMessageItemContentUnion = Annotated[
Union[
Annotated[ResponseInputText, Tag("input_text")],
Annotated[ResponseInputImage, Tag("input_image")],
Annotated[OpenResponsesInputMessageItemContentInputImage, Tag("input_image")],
Annotated[ResponseInputFile, Tag("input_file")],
Annotated[ResponseInputAudio, Tag("input_audio")],
Annotated[ResponseInputVideo, Tag("input_video")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
@@ -68,16 +141,16 @@ OpenResponsesInputMessageItemContent = Annotated[
class OpenResponsesInputMessageItemTypedDict(TypedDict):
role: OpenResponsesInputMessageItemRoleUnionTypedDict
content: List[OpenResponsesInputMessageItemContentTypedDict]
content: List[OpenResponsesInputMessageItemContentUnionTypedDict]
id: NotRequired[str]
type: NotRequired[OpenResponsesInputMessageItemType]
type: NotRequired[OpenResponsesInputMessageItemTypeMessage]
class OpenResponsesInputMessageItem(BaseModel):
role: OpenResponsesInputMessageItemRoleUnion
content: List[OpenResponsesInputMessageItemContent]
content: List[OpenResponsesInputMessageItemContentUnion]
id: Optional[str] = None
type: Optional[OpenResponsesInputMessageItemType] = None
type: Optional[OpenResponsesInputMessageItemTypeMessage] = None
@@ -149,24 +149,27 @@ class OpenResponsesNonStreamingResponseTypedDict(TypedDict):
object: Object
created_at: float
model: str
status: OpenAIResponsesResponseStatus
completed_at: Nullable[float]
output: List[ResponsesOutputItemTypedDict]
error: Nullable[ResponsesErrorFieldTypedDict]
r"""Error information returned from the API"""
incomplete_details: Nullable[OpenAIResponsesIncompleteDetailsTypedDict]
temperature: Nullable[float]
top_p: Nullable[float]
presence_penalty: Nullable[float]
frequency_penalty: Nullable[float]
instructions: Nullable[OpenAIResponsesInputUnionTypedDict]
metadata: Nullable[Dict[str, str]]
r"""Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed."""
tools: List[OpenResponsesNonStreamingResponseToolUnionTypedDict]
tool_choice: OpenAIResponsesToolChoiceUnionTypedDict
parallel_tool_calls: bool
status: NotRequired[OpenAIResponsesResponseStatus]
user: NotRequired[Nullable[str]]
output_text: NotRequired[str]
prompt_cache_key: NotRequired[Nullable[str]]
safety_identifier: NotRequired[Nullable[str]]
usage: NotRequired[OpenResponsesUsageTypedDict]
usage: NotRequired[Nullable[OpenResponsesUsageTypedDict]]
r"""Token usage information for the response"""
max_tool_calls: NotRequired[Nullable[float]]
top_logprobs: NotRequired[float]
@@ -193,6 +196,12 @@ class OpenResponsesNonStreamingResponse(BaseModel):
model: str
status: Annotated[
OpenAIResponsesResponseStatus, PlainValidator(validate_open_enum(False))
]
completed_at: Nullable[float]
output: List[ResponsesOutputItem]
error: Nullable[ResponsesErrorField]
@@ -204,6 +213,10 @@ class OpenResponsesNonStreamingResponse(BaseModel):
top_p: Nullable[float]
presence_penalty: Nullable[float]
frequency_penalty: Nullable[float]
instructions: Nullable[OpenAIResponsesInputUnion]
metadata: Nullable[Dict[str, str]]
@@ -215,11 +228,6 @@ class OpenResponsesNonStreamingResponse(BaseModel):
parallel_tool_calls: bool
status: Annotated[
Optional[OpenAIResponsesResponseStatus],
PlainValidator(validate_open_enum(False)),
] = None
user: OptionalNullable[str] = UNSET
output_text: Optional[str] = None
@@ -228,7 +236,7 @@ class OpenResponsesNonStreamingResponse(BaseModel):
safety_identifier: OptionalNullable[str] = UNSET
usage: Optional[OpenResponsesUsage] = None
usage: OptionalNullable[OpenResponsesUsage] = UNSET
r"""Token usage information for the response"""
max_tool_calls: OptionalNullable[float] = UNSET
@@ -263,7 +271,6 @@ class OpenResponsesNonStreamingResponse(BaseModel):
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
"status",
"user",
"output_text",
"prompt_cache_key",
@@ -282,15 +289,19 @@ class OpenResponsesNonStreamingResponse(BaseModel):
"text",
]
nullable_fields = [
"completed_at",
"user",
"prompt_cache_key",
"safety_identifier",
"error",
"incomplete_details",
"usage",
"max_tool_calls",
"max_output_tokens",
"temperature",
"top_p",
"presence_penalty",
"frequency_penalty",
"instructions",
"metadata",
"prompt",
@@ -55,6 +55,7 @@ OpenResponsesReasoningFormat = Union[
Literal[
"unknown",
"openai-responses-v1",
"azure-openai-responses-v1",
"xai-responses-v1",
"anthropic-claude-v1",
"google-gemini-v1",
@@ -34,10 +34,16 @@ from .openresponseswebsearchtool import (
OpenResponsesWebSearchToolTypedDict,
)
from .pdfparseroptions import PDFParserOptions, PDFParserOptionsTypedDict
from .preferredmaxlatency import PreferredMaxLatency, PreferredMaxLatencyTypedDict
from .preferredminthroughput import (
PreferredMinThroughput,
PreferredMinThroughputTypedDict,
)
from .providername import ProviderName
from .providersort import ProviderSort
from .providersortconfig import ProviderSortConfig, ProviderSortConfigTypedDict
from .quantization import Quantization
from .responsesoutputmodality import ResponsesOutputModality
from .websearchengine import WebSearchEngine
from openrouter.types import (
BaseModel,
@@ -139,6 +145,16 @@ OpenResponsesRequestToolUnion = Annotated[
]
OpenResponsesRequestImageConfigTypedDict = TypeAliasType(
"OpenResponsesRequestImageConfigTypedDict", Union[str, float]
)
OpenResponsesRequestImageConfig = TypeAliasType(
"OpenResponsesRequestImageConfig", Union[str, float]
)
ServiceTier = Literal["auto",]
@@ -269,14 +285,10 @@ class OpenResponsesRequestProviderTypedDict(TypedDict):
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
max_price: NotRequired[OpenResponsesRequestMaxPriceTypedDict]
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
preferred_min_throughput: NotRequired[Nullable[float]]
r"""Preferred minimum throughput (in tokens per second). Endpoints below this threshold may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
preferred_max_latency: NotRequired[Nullable[float]]
r"""Preferred maximum latency (in seconds). Endpoints above this threshold may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
min_throughput: NotRequired[Nullable[float]]
r"""**DEPRECATED** Use preferred_min_throughput instead. Backwards-compatible alias for preferred_min_throughput."""
max_latency: NotRequired[Nullable[float]]
r"""**DEPRECATED** Use preferred_max_latency instead. Backwards-compatible alias for preferred_max_latency."""
preferred_min_throughput: NotRequired[Nullable[PreferredMinThroughputTypedDict]]
r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
preferred_max_latency: NotRequired[Nullable[PreferredMaxLatencyTypedDict]]
r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
class OpenResponsesRequestProvider(BaseModel):
@@ -327,27 +339,11 @@ class OpenResponsesRequestProvider(BaseModel):
max_price: Optional[OpenResponsesRequestMaxPrice] = None
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
preferred_min_throughput: OptionalNullable[float] = UNSET
r"""Preferred minimum throughput (in tokens per second). Endpoints below this threshold may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
preferred_min_throughput: OptionalNullable[PreferredMinThroughput] = UNSET
r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
preferred_max_latency: OptionalNullable[float] = UNSET
r"""Preferred maximum latency (in seconds). Endpoints above this threshold may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
min_throughput: Annotated[
OptionalNullable[float],
pydantic.Field(
deprecated="warning: ** DEPRECATED ** - Use preferred_min_throughput instead.."
),
] = UNSET
r"""**DEPRECATED** Use preferred_min_throughput instead. Backwards-compatible alias for preferred_min_throughput."""
max_latency: Annotated[
OptionalNullable[float],
pydantic.Field(
deprecated="warning: ** DEPRECATED ** - Use preferred_max_latency instead.."
),
] = UNSET
r"""**DEPRECATED** Use preferred_max_latency instead. Backwards-compatible alias for preferred_max_latency."""
preferred_max_latency: OptionalNullable[PreferredMaxLatency] = UNSET
r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
@@ -365,8 +361,6 @@ class OpenResponsesRequestProvider(BaseModel):
"max_price",
"preferred_min_throughput",
"preferred_max_latency",
"min_throughput",
"max_latency",
]
nullable_fields = [
"allow_fallbacks",
@@ -381,8 +375,6 @@ class OpenResponsesRequestProvider(BaseModel):
"sort",
"preferred_min_throughput",
"preferred_max_latency",
"min_throughput",
"max_latency",
]
null_default_fields = []
@@ -488,11 +480,33 @@ class OpenResponsesRequestPluginModeration(BaseModel):
id: IDModeration
IDAutoRouter = Literal["auto-router",]
class OpenResponsesRequestPluginAutoRouterTypedDict(TypedDict):
id: IDAutoRouter
enabled: NotRequired[bool]
r"""Set to false to disable the auto-router plugin for this request. Defaults to true."""
allowed_models: NotRequired[List[str]]
r"""List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list."""
class OpenResponsesRequestPluginAutoRouter(BaseModel):
id: IDAutoRouter
enabled: Optional[bool] = None
r"""Set to false to disable the auto-router plugin for this request. Defaults to true."""
allowed_models: Optional[List[str]] = None
r"""List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list."""
OpenResponsesRequestPluginUnionTypedDict = TypeAliasType(
"OpenResponsesRequestPluginUnionTypedDict",
Union[
OpenResponsesRequestPluginModerationTypedDict,
OpenResponsesRequestPluginResponseHealingTypedDict,
OpenResponsesRequestPluginAutoRouterTypedDict,
OpenResponsesRequestPluginFileParserTypedDict,
OpenResponsesRequestPluginWebTypedDict,
],
@@ -501,6 +515,7 @@ OpenResponsesRequestPluginUnionTypedDict = TypeAliasType(
OpenResponsesRequestPluginUnion = Annotated[
Union[
Annotated[OpenResponsesRequestPluginAutoRouter, Tag("auto-router")],
Annotated[OpenResponsesRequestPluginModeration, Tag("moderation")],
Annotated[OpenResponsesRequestPluginWeb, Tag("web")],
Annotated[OpenResponsesRequestPluginFileParser, Tag("file-parser")],
@@ -530,7 +545,15 @@ class OpenResponsesRequestTypedDict(TypedDict):
max_output_tokens: NotRequired[Nullable[float]]
temperature: NotRequired[Nullable[float]]
top_p: NotRequired[Nullable[float]]
top_logprobs: NotRequired[Nullable[int]]
max_tool_calls: NotRequired[Nullable[int]]
presence_penalty: NotRequired[Nullable[float]]
frequency_penalty: NotRequired[Nullable[float]]
top_k: NotRequired[float]
image_config: NotRequired[Dict[str, OpenResponsesRequestImageConfigTypedDict]]
r"""Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/features/multimodal/image-generation for more details."""
modalities: NotRequired[List[ResponsesOutputModality]]
r"""Output modalities for the response. Supported values are \"text\" and \"image\"."""
prompt_cache_key: NotRequired[Nullable[str]]
previous_response_id: NotRequired[Nullable[str]]
prompt: NotRequired[Nullable[OpenAIResponsesPromptTypedDict]]
@@ -584,8 +607,28 @@ class OpenResponsesRequest(BaseModel):
top_p: OptionalNullable[float] = UNSET
top_logprobs: OptionalNullable[int] = UNSET
max_tool_calls: OptionalNullable[int] = UNSET
presence_penalty: OptionalNullable[float] = UNSET
frequency_penalty: OptionalNullable[float] = UNSET
top_k: Optional[float] = None
image_config: Optional[Dict[str, OpenResponsesRequestImageConfig]] = None
r"""Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/features/multimodal/image-generation for more details."""
modalities: Optional[
List[
Annotated[
ResponsesOutputModality, PlainValidator(validate_open_enum(False))
]
]
] = None
r"""Output modalities for the response. Supported values are \"text\" and \"image\"."""
prompt_cache_key: OptionalNullable[str] = UNSET
previous_response_id: OptionalNullable[str] = UNSET
@@ -645,7 +688,13 @@ class OpenResponsesRequest(BaseModel):
"max_output_tokens",
"temperature",
"top_p",
"top_logprobs",
"max_tool_calls",
"presence_penalty",
"frequency_penalty",
"top_k",
"image_config",
"modalities",
"prompt_cache_key",
"previous_response_id",
"prompt",
@@ -669,6 +718,10 @@ class OpenResponsesRequest(BaseModel):
"max_output_tokens",
"temperature",
"top_p",
"top_logprobs",
"max_tool_calls",
"presence_penalty",
"frequency_penalty",
"prompt_cache_key",
"previous_response_id",
"prompt",
@@ -0,0 +1,71 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing_extensions import NotRequired, TypedDict
class PercentileLatencyCutoffsTypedDict(TypedDict):
r"""Percentile-based latency cutoffs. All specified cutoffs must be met for an endpoint to be preferred."""
p50: NotRequired[Nullable[float]]
r"""Maximum p50 latency (seconds)"""
p75: NotRequired[Nullable[float]]
r"""Maximum p75 latency (seconds)"""
p90: NotRequired[Nullable[float]]
r"""Maximum p90 latency (seconds)"""
p99: NotRequired[Nullable[float]]
r"""Maximum p99 latency (seconds)"""
class PercentileLatencyCutoffs(BaseModel):
r"""Percentile-based latency cutoffs. All specified cutoffs must be met for an endpoint to be preferred."""
p50: OptionalNullable[float] = UNSET
r"""Maximum p50 latency (seconds)"""
p75: OptionalNullable[float] = UNSET
r"""Maximum p75 latency (seconds)"""
p90: OptionalNullable[float] = UNSET
r"""Maximum p90 latency (seconds)"""
p99: OptionalNullable[float] = UNSET
r"""Maximum p99 latency (seconds)"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["p50", "p75", "p90", "p99"]
nullable_fields = ["p50", "p75", "p90", "p99"]
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,34 @@
"""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 PercentileStatsTypedDict(TypedDict):
r"""Latency percentiles in milliseconds over the last 30 minutes. Latency measures time to first token. Only visible when authenticated with an API key or cookie; returns null for unauthenticated requests."""
p50: float
r"""Median (50th percentile)"""
p75: float
r"""75th percentile"""
p90: float
r"""90th percentile"""
p99: float
r"""99th percentile"""
class PercentileStats(BaseModel):
r"""Latency percentiles in milliseconds over the last 30 minutes. Latency measures time to first token. Only visible when authenticated with an API key or cookie; returns null for unauthenticated requests."""
p50: float
r"""Median (50th percentile)"""
p75: float
r"""75th percentile"""
p90: float
r"""90th percentile"""
p99: float
r"""99th percentile"""
@@ -0,0 +1,71 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing_extensions import NotRequired, TypedDict
class PercentileThroughputCutoffsTypedDict(TypedDict):
r"""Percentile-based throughput cutoffs. All specified cutoffs must be met for an endpoint to be preferred."""
p50: NotRequired[Nullable[float]]
r"""Minimum p50 throughput (tokens/sec)"""
p75: NotRequired[Nullable[float]]
r"""Minimum p75 throughput (tokens/sec)"""
p90: NotRequired[Nullable[float]]
r"""Minimum p90 throughput (tokens/sec)"""
p99: NotRequired[Nullable[float]]
r"""Minimum p99 throughput (tokens/sec)"""
class PercentileThroughputCutoffs(BaseModel):
r"""Percentile-based throughput cutoffs. All specified cutoffs must be met for an endpoint to be preferred."""
p50: OptionalNullable[float] = UNSET
r"""Minimum p50 throughput (tokens/sec)"""
p75: OptionalNullable[float] = UNSET
r"""Minimum p75 throughput (tokens/sec)"""
p90: OptionalNullable[float] = UNSET
r"""Minimum p90 throughput (tokens/sec)"""
p99: OptionalNullable[float] = UNSET
r"""Minimum p99 throughput (tokens/sec)"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["p50", "p75", "p90", "p99"]
nullable_fields = ["p50", "p75", "p90", "p99"]
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,21 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .percentilelatencycutoffs import (
PercentileLatencyCutoffs,
PercentileLatencyCutoffsTypedDict,
)
from typing import Any, Union
from typing_extensions import TypeAliasType
PreferredMaxLatencyTypedDict = TypeAliasType(
"PreferredMaxLatencyTypedDict", Union[PercentileLatencyCutoffsTypedDict, float, Any]
)
r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
PreferredMaxLatency = TypeAliasType(
"PreferredMaxLatency", Union[PercentileLatencyCutoffs, float, Any]
)
r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
@@ -0,0 +1,22 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .percentilethroughputcutoffs import (
PercentileThroughputCutoffs,
PercentileThroughputCutoffsTypedDict,
)
from typing import Any, Union
from typing_extensions import TypeAliasType
PreferredMinThroughputTypedDict = TypeAliasType(
"PreferredMinThroughputTypedDict",
Union[PercentileThroughputCutoffsTypedDict, float, Any],
)
r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
PreferredMinThroughput = TypeAliasType(
"PreferredMinThroughput", Union[PercentileThroughputCutoffs, float, Any]
)
r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
+3 -2
View File
@@ -33,12 +33,12 @@ ProviderName = Union[
"Fireworks",
"Friendli",
"GMICloud",
"GoPomelo",
"Google",
"Google AI Studio",
"Groq",
"Hyperbolic",
"Inception",
"Inceptron",
"InferenceNet",
"Infermatic",
"Inflection",
@@ -63,13 +63,14 @@ ProviderName = Union[
"Phala",
"Relace",
"SambaNova",
"Seed",
"SiliconFlow",
"Sourceful",
"Stealth",
"StreamLake",
"Switchpoint",
"Targon",
"Together",
"Upstage",
"Venice",
"WandB",
"Xiaomi",
@@ -2,6 +2,11 @@
from __future__ import annotations
from .datacollection import DataCollection
from .preferredmaxlatency import PreferredMaxLatency, PreferredMaxLatencyTypedDict
from .preferredminthroughput import (
PreferredMinThroughput,
PreferredMinThroughputTypedDict,
)
from .providername import ProviderName
from .providersort import ProviderSort
from .quantization import Quantization
@@ -14,7 +19,6 @@ from openrouter.types import (
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
import pydantic
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Optional, Union
@@ -234,14 +238,10 @@ class ProviderPreferencesTypedDict(TypedDict):
sort: NotRequired[Nullable[ProviderPreferencesSortUnionTypedDict]]
max_price: NotRequired[ProviderPreferencesMaxPriceTypedDict]
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
preferred_min_throughput: NotRequired[Nullable[float]]
r"""Preferred minimum throughput (in tokens per second). Endpoints below this threshold may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
preferred_max_latency: NotRequired[Nullable[float]]
r"""Preferred maximum latency (in seconds). Endpoints above this threshold may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
min_throughput: NotRequired[Nullable[float]]
r"""**DEPRECATED** Use preferred_min_throughput instead. Backwards-compatible alias for preferred_min_throughput."""
max_latency: NotRequired[Nullable[float]]
r"""**DEPRECATED** Use preferred_max_latency instead. Backwards-compatible alias for preferred_max_latency."""
preferred_min_throughput: NotRequired[Nullable[PreferredMinThroughputTypedDict]]
r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
preferred_max_latency: NotRequired[Nullable[PreferredMaxLatencyTypedDict]]
r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
class ProviderPreferences(BaseModel):
@@ -291,27 +291,11 @@ class ProviderPreferences(BaseModel):
max_price: Optional[ProviderPreferencesMaxPrice] = None
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
preferred_min_throughput: OptionalNullable[float] = UNSET
r"""Preferred minimum throughput (in tokens per second). Endpoints below this threshold may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
preferred_min_throughput: OptionalNullable[PreferredMinThroughput] = UNSET
r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
preferred_max_latency: OptionalNullable[float] = UNSET
r"""Preferred maximum latency (in seconds). Endpoints above this threshold may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
min_throughput: Annotated[
OptionalNullable[float],
pydantic.Field(
deprecated="warning: ** DEPRECATED ** - Use preferred_min_throughput instead.."
),
] = UNSET
r"""**DEPRECATED** Use preferred_min_throughput instead. Backwards-compatible alias for preferred_min_throughput."""
max_latency: Annotated[
OptionalNullable[float],
pydantic.Field(
deprecated="warning: ** DEPRECATED ** - Use preferred_max_latency instead.."
),
] = UNSET
r"""**DEPRECATED** Use preferred_max_latency instead. Backwards-compatible alias for preferred_max_latency."""
preferred_max_latency: OptionalNullable[PreferredMaxLatency] = UNSET
r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
@@ -329,8 +313,6 @@ class ProviderPreferences(BaseModel):
"max_price",
"preferred_min_throughput",
"preferred_max_latency",
"min_throughput",
"max_latency",
]
nullable_fields = [
"allow_fallbacks",
@@ -345,8 +327,6 @@ class ProviderPreferences(BaseModel):
"sort",
"preferred_min_throughput",
"preferred_max_latency",
"min_throughput",
"max_latency",
]
null_default_fields = []
@@ -3,6 +3,7 @@
from __future__ import annotations
from .endpointstatus import EndpointStatus
from .parameter import Parameter
from .percentilestats import PercentileStats, PercentileStatsTypedDict
from .providername import ProviderName
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr
from openrouter.utils import validate_open_enum
@@ -111,6 +112,9 @@ class PublicEndpointTypedDict(TypedDict):
supported_parameters: List[Parameter]
uptime_last_30m: Nullable[float]
supports_implicit_caching: bool
latency_last_30m: Nullable[PercentileStatsTypedDict]
r"""Latency percentiles in milliseconds over the last 30 minutes. Latency measures time to first token. Only visible when authenticated with an API key or cookie; returns null for unauthenticated requests."""
throughput_last_30m: Nullable[PercentileStatsTypedDict]
status: NotRequired[EndpointStatus]
@@ -145,6 +149,11 @@ class PublicEndpoint(BaseModel):
supports_implicit_caching: bool
latency_last_30m: Nullable[PercentileStats]
r"""Latency percentiles in milliseconds over the last 30 minutes. Latency measures time to first token. Only visible when authenticated with an API key or cookie; returns null for unauthenticated requests."""
throughput_last_30m: Nullable[PercentileStats]
status: Annotated[
Optional[EndpointStatus], PlainValidator(validate_open_enum(True))
] = None
@@ -157,6 +166,8 @@ class PublicEndpoint(BaseModel):
"max_completion_tokens",
"max_prompt_tokens",
"uptime_last_30m",
"latency_last_30m",
"throughput_last_30m",
]
null_default_fields = []
@@ -0,0 +1,26 @@
"""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
ResponseInputVideoType = Literal["input_video",]
class ResponseInputVideoTypedDict(TypedDict):
r"""Video input content item"""
type: ResponseInputVideoType
video_url: str
r"""A base64 data URL or remote URL that resolves to a video file"""
class ResponseInputVideo(BaseModel):
r"""Video input content item"""
type: ResponseInputVideoType
video_url: str
r"""A base64 data URL or remote URL that resolves to a video file"""
@@ -6,17 +6,50 @@ from .openairesponsesannotation import (
OpenAIResponsesAnnotationTypedDict,
)
from openrouter.types import BaseModel
import pydantic
from typing import List, Literal, Optional
from typing_extensions import NotRequired, TypedDict
from typing_extensions import Annotated, NotRequired, TypedDict
ResponseOutputTextType = Literal["output_text",]
class ResponseOutputTextTopLogprobTypedDict(TypedDict):
token: str
bytes_: List[float]
logprob: float
class ResponseOutputTextTopLogprob(BaseModel):
token: str
bytes_: Annotated[List[float], pydantic.Field(alias="bytes")]
logprob: float
class LogprobTypedDict(TypedDict):
token: str
bytes_: List[float]
logprob: float
top_logprobs: List[ResponseOutputTextTopLogprobTypedDict]
class Logprob(BaseModel):
token: str
bytes_: Annotated[List[float], pydantic.Field(alias="bytes")]
logprob: float
top_logprobs: List[ResponseOutputTextTopLogprob]
class ResponseOutputTextTypedDict(TypedDict):
type: ResponseOutputTextType
text: str
annotations: NotRequired[List[OpenAIResponsesAnnotationTypedDict]]
logprobs: NotRequired[List[LogprobTypedDict]]
class ResponseOutputText(BaseModel):
@@ -25,3 +58,5 @@ class ResponseOutputText(BaseModel):
text: str
annotations: Optional[List[OpenAIResponsesAnnotation]] = None
logprobs: Optional[List[Logprob]] = None
@@ -38,8 +38,8 @@ ResponsesOutputItemTypedDict = TypeAliasType(
ResponsesOutputItemFileSearchCallTypedDict,
ResponsesImageGenerationCallTypedDict,
ResponsesOutputMessageTypedDict,
ResponsesOutputItemReasoningTypedDict,
ResponsesOutputItemFunctionCallTypedDict,
ResponsesOutputItemReasoningTypedDict,
],
)
r"""An output item from the response"""
@@ -9,10 +9,14 @@ from openrouter.types import (
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
import pydantic
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Optional, Union
from typing_extensions import NotRequired, TypeAliasType, TypedDict
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
ResponsesOutputItemReasoningType = Literal["reasoning",]
@@ -47,6 +51,20 @@ ResponsesOutputItemReasoningStatusUnion = TypeAliasType(
)
ResponsesOutputItemReasoningFormat = Union[
Literal[
"unknown",
"openai-responses-v1",
"azure-openai-responses-v1",
"xai-responses-v1",
"anthropic-claude-v1",
"google-gemini-v1",
],
UnrecognizedStr,
]
r"""The format of the reasoning content"""
class ResponsesOutputItemReasoningTypedDict(TypedDict):
r"""An output item containing reasoning"""
@@ -56,6 +74,10 @@ class ResponsesOutputItemReasoningTypedDict(TypedDict):
content: NotRequired[List[ReasoningTextContentTypedDict]]
encrypted_content: NotRequired[Nullable[str]]
status: NotRequired[ResponsesOutputItemReasoningStatusUnionTypedDict]
signature: NotRequired[Nullable[str]]
r"""A signature for the reasoning content, used for verification"""
format_: NotRequired[Nullable[ResponsesOutputItemReasoningFormat]]
r"""The format of the reasoning content"""
class ResponsesOutputItemReasoning(BaseModel):
@@ -73,10 +95,28 @@ class ResponsesOutputItemReasoning(BaseModel):
status: Optional[ResponsesOutputItemReasoningStatusUnion] = None
signature: OptionalNullable[str] = UNSET
r"""A signature for the reasoning content, used for verification"""
format_: Annotated[
Annotated[
OptionalNullable[ResponsesOutputItemReasoningFormat],
PlainValidator(validate_open_enum(False)),
],
pydantic.Field(alias="format"),
] = UNSET
r"""The format of the reasoning content"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["content", "encrypted_content", "status"]
nullable_fields = ["encrypted_content"]
optional_fields = [
"content",
"encrypted_content",
"status",
"signature",
"format",
]
nullable_fields = ["encrypted_content", "signature", "format"]
null_default_fields = []
serialized = handler(self)
@@ -0,0 +1,14 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
ResponsesOutputModality = Union[
Literal[
"text",
"image",
],
UnrecognizedStr,
]