Project import generated by Copybara.

GitOrigin-RevId: 849282a42d3b2948d0ca0f7fd1427c31af709bbd
This commit is contained in:
OpenRouter Team
2026-01-09 19:20:21 +00:00
parent a35486030a
commit 9073d38dc1
123 changed files with 3734 additions and 1226 deletions
+251 -51
View File
@@ -7,6 +7,17 @@ import sys
if TYPE_CHECKING:
from ._schema0 import Schema0, Schema0Enum, Schema0TypedDict
from ._schema3 import (
Schema3,
Schema3ReasoningEncrypted,
Schema3ReasoningEncryptedTypedDict,
Schema3ReasoningSummary,
Schema3ReasoningSummaryTypedDict,
Schema3ReasoningText,
Schema3ReasoningTextTypedDict,
Schema3TypedDict,
Schema5,
)
from .activityitem import ActivityItem, ActivityItemTypedDict
from .assistantmessage import (
AssistantMessage,
@@ -27,12 +38,12 @@ if TYPE_CHECKING:
from .chatgenerationparams import (
ChatGenerationParams,
ChatGenerationParamsDataCollection,
ChatGenerationParamsEngine,
ChatGenerationParamsImageConfig,
ChatGenerationParamsImageConfigTypedDict,
ChatGenerationParamsMaxPrice,
ChatGenerationParamsMaxPriceTypedDict,
ChatGenerationParamsPdf,
ChatGenerationParamsPdfEngine,
ChatGenerationParamsPdfTypedDict,
ChatGenerationParamsPluginAutoRouter,
ChatGenerationParamsPluginAutoRouterTypedDict,
ChatGenerationParamsPluginFileParser,
ChatGenerationParamsPluginFileParserTypedDict,
ChatGenerationParamsPluginModeration,
@@ -43,6 +54,14 @@ if TYPE_CHECKING:
ChatGenerationParamsPluginUnionTypedDict,
ChatGenerationParamsPluginWeb,
ChatGenerationParamsPluginWebTypedDict,
ChatGenerationParamsPreferredMaxLatency,
ChatGenerationParamsPreferredMaxLatencyTypedDict,
ChatGenerationParamsPreferredMaxLatencyUnion,
ChatGenerationParamsPreferredMaxLatencyUnionTypedDict,
ChatGenerationParamsPreferredMinThroughput,
ChatGenerationParamsPreferredMinThroughputTypedDict,
ChatGenerationParamsPreferredMinThroughputUnion,
ChatGenerationParamsPreferredMinThroughputUnionTypedDict,
ChatGenerationParamsProvider,
ChatGenerationParamsProviderTypedDict,
ChatGenerationParamsResponseFormatJSONObject,
@@ -53,17 +72,21 @@ if TYPE_CHECKING:
ChatGenerationParamsResponseFormatTextTypedDict,
ChatGenerationParamsResponseFormatUnion,
ChatGenerationParamsResponseFormatUnionTypedDict,
ChatGenerationParamsRoute,
ChatGenerationParamsStop,
ChatGenerationParamsStopTypedDict,
ChatGenerationParamsTypedDict,
Debug,
DebugTypedDict,
Effort,
Engine,
Modality,
Pdf,
PdfEngine,
PdfTypedDict,
Quantizations,
Reasoning,
ReasoningTypedDict,
Sort,
Route,
)
from .chatgenerationtokenusage import (
ChatGenerationTokenUsage,
@@ -444,21 +467,24 @@ if TYPE_CHECKING:
OpenResponsesReasoningSummaryTextDoneEventTypedDict,
)
from .openresponsesrequest import (
IDAutoRouter,
IDFileParser,
IDModeration,
IDResponseHealing,
IDWeb,
Ignore,
IgnoreTypedDict,
Only,
OnlyTypedDict,
OpenResponsesRequest,
OpenResponsesRequestEngine,
OpenResponsesRequestIgnore,
OpenResponsesRequestIgnoreTypedDict,
OpenResponsesRequestImageConfig,
OpenResponsesRequestImageConfigTypedDict,
OpenResponsesRequestMaxPrice,
OpenResponsesRequestMaxPriceTypedDict,
OpenResponsesRequestPdf,
OpenResponsesRequestPdfEngine,
OpenResponsesRequestPdfTypedDict,
OpenResponsesRequestOnly,
OpenResponsesRequestOnlyTypedDict,
OpenResponsesRequestOrder,
OpenResponsesRequestOrderTypedDict,
OpenResponsesRequestPluginAutoRouter,
OpenResponsesRequestPluginAutoRouterTypedDict,
OpenResponsesRequestPluginFileParser,
OpenResponsesRequestPluginFileParserTypedDict,
OpenResponsesRequestPluginModeration,
@@ -471,15 +497,14 @@ if TYPE_CHECKING:
OpenResponsesRequestPluginWebTypedDict,
OpenResponsesRequestProvider,
OpenResponsesRequestProviderTypedDict,
OpenResponsesRequestRoute,
OpenResponsesRequestSort,
OpenResponsesRequestSortTypedDict,
OpenResponsesRequestToolFunction,
OpenResponsesRequestToolFunctionTypedDict,
OpenResponsesRequestToolUnion,
OpenResponsesRequestToolUnionTypedDict,
OpenResponsesRequestType,
OpenResponsesRequestTypedDict,
Order,
OrderTypedDict,
ServiceTier,
Truncation,
)
@@ -613,13 +638,57 @@ if TYPE_CHECKING:
PaymentRequiredResponseErrorData,
PaymentRequiredResponseErrorDataTypedDict,
)
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,
ProviderOverloadedResponseErrorDataTypedDict,
)
from .providerpreferences import (
ProviderPreferences,
ProviderPreferencesIgnore,
ProviderPreferencesIgnoreTypedDict,
ProviderPreferencesMaxPrice,
ProviderPreferencesMaxPriceTypedDict,
ProviderPreferencesOnly,
ProviderPreferencesOnlyTypedDict,
ProviderPreferencesOrder,
ProviderPreferencesOrderTypedDict,
ProviderPreferencesPartition,
ProviderPreferencesProviderSort,
ProviderPreferencesProviderSortConfig,
ProviderPreferencesProviderSortConfigTypedDict,
ProviderPreferencesSortUnion,
ProviderPreferencesSortUnionTypedDict,
ProviderPreferencesTypedDict,
ProviderSortConfigEnum,
ProviderSortConfigUnion,
ProviderSortConfigUnionTypedDict,
SortEnum,
)
from .providersort import ProviderSort
from .providersortconfig import (
Partition,
ProviderSortConfig,
ProviderSortConfigTypedDict,
)
from .providersortunion import ProviderSortUnion, ProviderSortUnionTypedDict
from .publicendpoint import (
Pricing,
PricingTypedDict,
@@ -728,6 +797,7 @@ if TYPE_CHECKING:
)
from .responsesoutputitemreasoning import (
ResponsesOutputItemReasoning,
ResponsesOutputItemReasoningFormat,
ResponsesOutputItemReasoningStatusCompleted,
ResponsesOutputItemReasoningStatusInProgress,
ResponsesOutputItemReasoningStatusIncomplete,
@@ -749,6 +819,7 @@ if TYPE_CHECKING:
ResponsesOutputMessageType,
ResponsesOutputMessageTypedDict,
)
from .responsesoutputmodality import ResponsesOutputModality
from .responsessearchcontextsize import ResponsesSearchContextSize
from .responseswebsearchcalloutput import (
ResponsesWebSearchCallOutput,
@@ -809,6 +880,7 @@ if TYPE_CHECKING:
UserMessageContentTypedDict,
UserMessageTypedDict,
)
from .websearchengine import WebSearchEngine
from .websearchpreviewtooluserlocation import (
WebSearchPreviewToolUserLocation,
WebSearchPreviewToolUserLocationType,
@@ -835,12 +907,12 @@ __all__ = [
"ChatErrorErrorTypedDict",
"ChatGenerationParams",
"ChatGenerationParamsDataCollection",
"ChatGenerationParamsEngine",
"ChatGenerationParamsImageConfig",
"ChatGenerationParamsImageConfigTypedDict",
"ChatGenerationParamsMaxPrice",
"ChatGenerationParamsMaxPriceTypedDict",
"ChatGenerationParamsPdf",
"ChatGenerationParamsPdfEngine",
"ChatGenerationParamsPdfTypedDict",
"ChatGenerationParamsPluginAutoRouter",
"ChatGenerationParamsPluginAutoRouterTypedDict",
"ChatGenerationParamsPluginFileParser",
"ChatGenerationParamsPluginFileParserTypedDict",
"ChatGenerationParamsPluginModeration",
@@ -851,6 +923,14 @@ __all__ = [
"ChatGenerationParamsPluginUnionTypedDict",
"ChatGenerationParamsPluginWeb",
"ChatGenerationParamsPluginWebTypedDict",
"ChatGenerationParamsPreferredMaxLatency",
"ChatGenerationParamsPreferredMaxLatencyTypedDict",
"ChatGenerationParamsPreferredMaxLatencyUnion",
"ChatGenerationParamsPreferredMaxLatencyUnionTypedDict",
"ChatGenerationParamsPreferredMinThroughput",
"ChatGenerationParamsPreferredMinThroughputTypedDict",
"ChatGenerationParamsPreferredMinThroughputUnion",
"ChatGenerationParamsPreferredMinThroughputUnionTypedDict",
"ChatGenerationParamsProvider",
"ChatGenerationParamsProviderTypedDict",
"ChatGenerationParamsResponseFormatJSONObject",
@@ -861,7 +941,6 @@ __all__ = [
"ChatGenerationParamsResponseFormatTextTypedDict",
"ChatGenerationParamsResponseFormatUnion",
"ChatGenerationParamsResponseFormatUnionTypedDict",
"ChatGenerationParamsRoute",
"ChatGenerationParamsStop",
"ChatGenerationParamsStopTypedDict",
"ChatGenerationParamsTypedDict",
@@ -954,6 +1033,7 @@ __all__ = [
"EdgeNetworkTimeoutResponseErrorDataTypedDict",
"Effort",
"EndpointStatus",
"Engine",
"FileCitation",
"FileCitationType",
"FileCitationTypedDict",
@@ -962,12 +1042,11 @@ __all__ = [
"FilePathTypedDict",
"ForbiddenResponseErrorData",
"ForbiddenResponseErrorDataTypedDict",
"IDAutoRouter",
"IDFileParser",
"IDModeration",
"IDResponseHealing",
"IDWeb",
"Ignore",
"IgnoreTypedDict",
"ImageGenerationStatus",
"ImageURL",
"ImageURLTypedDict",
@@ -987,6 +1066,7 @@ __all__ = [
"MessageDeveloper",
"MessageDeveloperTypedDict",
"MessageTypedDict",
"Modality",
"Model",
"ModelArchitecture",
"ModelArchitectureInstructType",
@@ -1006,8 +1086,6 @@ __all__ = [
"NotFoundResponseErrorData",
"NotFoundResponseErrorDataTypedDict",
"Object",
"Only",
"OnlyTypedDict",
"OpenAIResponsesAnnotation",
"OpenAIResponsesAnnotationTypedDict",
"OpenAIResponsesIncludable",
@@ -1153,12 +1231,18 @@ __all__ = [
"OpenResponsesReasoningType",
"OpenResponsesReasoningTypedDict",
"OpenResponsesRequest",
"OpenResponsesRequestEngine",
"OpenResponsesRequestIgnore",
"OpenResponsesRequestIgnoreTypedDict",
"OpenResponsesRequestImageConfig",
"OpenResponsesRequestImageConfigTypedDict",
"OpenResponsesRequestMaxPrice",
"OpenResponsesRequestMaxPriceTypedDict",
"OpenResponsesRequestPdf",
"OpenResponsesRequestPdfEngine",
"OpenResponsesRequestPdfTypedDict",
"OpenResponsesRequestOnly",
"OpenResponsesRequestOnlyTypedDict",
"OpenResponsesRequestOrder",
"OpenResponsesRequestOrderTypedDict",
"OpenResponsesRequestPluginAutoRouter",
"OpenResponsesRequestPluginAutoRouterTypedDict",
"OpenResponsesRequestPluginFileParser",
"OpenResponsesRequestPluginFileParserTypedDict",
"OpenResponsesRequestPluginModeration",
@@ -1171,7 +1255,8 @@ __all__ = [
"OpenResponsesRequestPluginWebTypedDict",
"OpenResponsesRequestProvider",
"OpenResponsesRequestProviderTypedDict",
"OpenResponsesRequestRoute",
"OpenResponsesRequestSort",
"OpenResponsesRequestSortTypedDict",
"OpenResponsesRequestToolFunction",
"OpenResponsesRequestToolFunctionTypedDict",
"OpenResponsesRequestToolUnion",
@@ -1237,8 +1322,6 @@ __all__ = [
"OpenResponsesWebSearchToolFiltersTypedDict",
"OpenResponsesWebSearchToolType",
"OpenResponsesWebSearchToolTypedDict",
"Order",
"OrderTypedDict",
"OutputItemImageGenerationCall",
"OutputItemImageGenerationCallType",
"OutputItemImageGenerationCallTypedDict",
@@ -1256,17 +1339,34 @@ __all__ = [
"OutputModality",
"OutputTokensDetails",
"OutputTokensDetailsTypedDict",
"PDFParserEngine",
"PDFParserOptions",
"PDFParserOptionsTypedDict",
"Parameter",
"Part1",
"Part1TypedDict",
"Part2",
"Part2TypedDict",
"Partition",
"PayloadTooLargeResponseErrorData",
"PayloadTooLargeResponseErrorDataTypedDict",
"PaymentRequiredResponseErrorData",
"PaymentRequiredResponseErrorDataTypedDict",
"Pdf",
"PdfEngine",
"PdfTypedDict",
"PerRequestLimits",
"PerRequestLimitsTypedDict",
"PercentileLatencyCutoffs",
"PercentileLatencyCutoffsTypedDict",
"PercentileStats",
"PercentileStatsTypedDict",
"PercentileThroughputCutoffs",
"PercentileThroughputCutoffsTypedDict",
"PreferredMaxLatency",
"PreferredMaxLatencyTypedDict",
"PreferredMinThroughput",
"PreferredMinThroughputTypedDict",
"Pricing",
"PricingTypedDict",
"Prompt",
@@ -1276,7 +1376,30 @@ __all__ = [
"ProviderName",
"ProviderOverloadedResponseErrorData",
"ProviderOverloadedResponseErrorDataTypedDict",
"ProviderPreferences",
"ProviderPreferencesIgnore",
"ProviderPreferencesIgnoreTypedDict",
"ProviderPreferencesMaxPrice",
"ProviderPreferencesMaxPriceTypedDict",
"ProviderPreferencesOnly",
"ProviderPreferencesOnlyTypedDict",
"ProviderPreferencesOrder",
"ProviderPreferencesOrderTypedDict",
"ProviderPreferencesPartition",
"ProviderPreferencesProviderSort",
"ProviderPreferencesProviderSortConfig",
"ProviderPreferencesProviderSortConfigTypedDict",
"ProviderPreferencesSortUnion",
"ProviderPreferencesSortUnionTypedDict",
"ProviderPreferencesTypedDict",
"ProviderSort",
"ProviderSortConfig",
"ProviderSortConfigEnum",
"ProviderSortConfigTypedDict",
"ProviderSortConfigUnion",
"ProviderSortConfigUnionTypedDict",
"ProviderSortUnion",
"ProviderSortUnionTypedDict",
"PublicEndpoint",
"PublicEndpointQuantization",
"PublicEndpointTypedDict",
@@ -1351,6 +1474,7 @@ __all__ = [
"ResponsesOutputItemFunctionCallType",
"ResponsesOutputItemFunctionCallTypedDict",
"ResponsesOutputItemReasoning",
"ResponsesOutputItemReasoningFormat",
"ResponsesOutputItemReasoningStatusCompleted",
"ResponsesOutputItemReasoningStatusInProgress",
"ResponsesOutputItemReasoningStatusIncomplete",
@@ -1370,6 +1494,7 @@ __all__ = [
"ResponsesOutputMessageStatusUnionTypedDict",
"ResponsesOutputMessageType",
"ResponsesOutputMessageTypedDict",
"ResponsesOutputModality",
"ResponsesSearchContextSize",
"ResponsesWebSearchCallOutput",
"ResponsesWebSearchCallOutputType",
@@ -1377,15 +1502,25 @@ __all__ = [
"ResponsesWebSearchUserLocation",
"ResponsesWebSearchUserLocationType",
"ResponsesWebSearchUserLocationTypedDict",
"Route",
"Schema0",
"Schema0Enum",
"Schema0TypedDict",
"Schema3",
"Schema3ReasoningEncrypted",
"Schema3ReasoningEncryptedTypedDict",
"Schema3ReasoningSummary",
"Schema3ReasoningSummaryTypedDict",
"Schema3ReasoningText",
"Schema3ReasoningTextTypedDict",
"Schema3TypedDict",
"Schema5",
"Security",
"SecurityTypedDict",
"ServiceTier",
"ServiceUnavailableResponseErrorData",
"ServiceUnavailableResponseErrorDataTypedDict",
"Sort",
"SortEnum",
"StreamOptions",
"StreamOptionsTypedDict",
"SystemMessage",
@@ -1446,6 +1581,7 @@ __all__ = [
"VideoURL1TypedDict",
"VideoURL2",
"VideoURL2TypedDict",
"WebSearchEngine",
"WebSearchPreviewToolUserLocation",
"WebSearchPreviewToolUserLocationType",
"WebSearchPreviewToolUserLocationTypedDict",
@@ -1456,6 +1592,15 @@ _dynamic_imports: dict[str, str] = {
"Schema0": "._schema0",
"Schema0Enum": "._schema0",
"Schema0TypedDict": "._schema0",
"Schema3": "._schema3",
"Schema3ReasoningEncrypted": "._schema3",
"Schema3ReasoningEncryptedTypedDict": "._schema3",
"Schema3ReasoningSummary": "._schema3",
"Schema3ReasoningSummaryTypedDict": "._schema3",
"Schema3ReasoningText": "._schema3",
"Schema3ReasoningTextTypedDict": "._schema3",
"Schema3TypedDict": "._schema3",
"Schema5": "._schema3",
"ActivityItem": ".activityitem",
"ActivityItemTypedDict": ".activityitem",
"AssistantMessage": ".assistantmessage",
@@ -1473,12 +1618,12 @@ _dynamic_imports: dict[str, str] = {
"CodeTypedDict": ".chaterror",
"ChatGenerationParams": ".chatgenerationparams",
"ChatGenerationParamsDataCollection": ".chatgenerationparams",
"ChatGenerationParamsEngine": ".chatgenerationparams",
"ChatGenerationParamsImageConfig": ".chatgenerationparams",
"ChatGenerationParamsImageConfigTypedDict": ".chatgenerationparams",
"ChatGenerationParamsMaxPrice": ".chatgenerationparams",
"ChatGenerationParamsMaxPriceTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPdf": ".chatgenerationparams",
"ChatGenerationParamsPdfEngine": ".chatgenerationparams",
"ChatGenerationParamsPdfTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginAutoRouter": ".chatgenerationparams",
"ChatGenerationParamsPluginAutoRouterTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginFileParser": ".chatgenerationparams",
"ChatGenerationParamsPluginFileParserTypedDict": ".chatgenerationparams",
"ChatGenerationParamsPluginModeration": ".chatgenerationparams",
@@ -1489,6 +1634,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",
@@ -1499,17 +1652,21 @@ _dynamic_imports: dict[str, str] = {
"ChatGenerationParamsResponseFormatTextTypedDict": ".chatgenerationparams",
"ChatGenerationParamsResponseFormatUnion": ".chatgenerationparams",
"ChatGenerationParamsResponseFormatUnionTypedDict": ".chatgenerationparams",
"ChatGenerationParamsRoute": ".chatgenerationparams",
"ChatGenerationParamsStop": ".chatgenerationparams",
"ChatGenerationParamsStopTypedDict": ".chatgenerationparams",
"ChatGenerationParamsTypedDict": ".chatgenerationparams",
"Debug": ".chatgenerationparams",
"DebugTypedDict": ".chatgenerationparams",
"Effort": ".chatgenerationparams",
"Engine": ".chatgenerationparams",
"Modality": ".chatgenerationparams",
"Pdf": ".chatgenerationparams",
"PdfEngine": ".chatgenerationparams",
"PdfTypedDict": ".chatgenerationparams",
"Quantizations": ".chatgenerationparams",
"Reasoning": ".chatgenerationparams",
"ReasoningTypedDict": ".chatgenerationparams",
"Sort": ".chatgenerationparams",
"Route": ".chatgenerationparams",
"ChatGenerationTokenUsage": ".chatgenerationtokenusage",
"ChatGenerationTokenUsageTypedDict": ".chatgenerationtokenusage",
"CompletionTokensDetails": ".chatgenerationtokenusage",
@@ -1801,21 +1958,24 @@ _dynamic_imports: dict[str, str] = {
"OpenResponsesReasoningSummaryTextDoneEvent": ".openresponsesreasoningsummarytextdoneevent",
"OpenResponsesReasoningSummaryTextDoneEventType": ".openresponsesreasoningsummarytextdoneevent",
"OpenResponsesReasoningSummaryTextDoneEventTypedDict": ".openresponsesreasoningsummarytextdoneevent",
"IDAutoRouter": ".openresponsesrequest",
"IDFileParser": ".openresponsesrequest",
"IDModeration": ".openresponsesrequest",
"IDResponseHealing": ".openresponsesrequest",
"IDWeb": ".openresponsesrequest",
"Ignore": ".openresponsesrequest",
"IgnoreTypedDict": ".openresponsesrequest",
"Only": ".openresponsesrequest",
"OnlyTypedDict": ".openresponsesrequest",
"OpenResponsesRequest": ".openresponsesrequest",
"OpenResponsesRequestEngine": ".openresponsesrequest",
"OpenResponsesRequestIgnore": ".openresponsesrequest",
"OpenResponsesRequestIgnoreTypedDict": ".openresponsesrequest",
"OpenResponsesRequestImageConfig": ".openresponsesrequest",
"OpenResponsesRequestImageConfigTypedDict": ".openresponsesrequest",
"OpenResponsesRequestMaxPrice": ".openresponsesrequest",
"OpenResponsesRequestMaxPriceTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPdf": ".openresponsesrequest",
"OpenResponsesRequestPdfEngine": ".openresponsesrequest",
"OpenResponsesRequestPdfTypedDict": ".openresponsesrequest",
"OpenResponsesRequestOnly": ".openresponsesrequest",
"OpenResponsesRequestOnlyTypedDict": ".openresponsesrequest",
"OpenResponsesRequestOrder": ".openresponsesrequest",
"OpenResponsesRequestOrderTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginAutoRouter": ".openresponsesrequest",
"OpenResponsesRequestPluginAutoRouterTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginFileParser": ".openresponsesrequest",
"OpenResponsesRequestPluginFileParserTypedDict": ".openresponsesrequest",
"OpenResponsesRequestPluginModeration": ".openresponsesrequest",
@@ -1828,15 +1988,14 @@ _dynamic_imports: dict[str, str] = {
"OpenResponsesRequestPluginWebTypedDict": ".openresponsesrequest",
"OpenResponsesRequestProvider": ".openresponsesrequest",
"OpenResponsesRequestProviderTypedDict": ".openresponsesrequest",
"OpenResponsesRequestRoute": ".openresponsesrequest",
"OpenResponsesRequestSort": ".openresponsesrequest",
"OpenResponsesRequestSortTypedDict": ".openresponsesrequest",
"OpenResponsesRequestToolFunction": ".openresponsesrequest",
"OpenResponsesRequestToolFunctionTypedDict": ".openresponsesrequest",
"OpenResponsesRequestToolUnion": ".openresponsesrequest",
"OpenResponsesRequestToolUnionTypedDict": ".openresponsesrequest",
"OpenResponsesRequestType": ".openresponsesrequest",
"OpenResponsesRequestTypedDict": ".openresponsesrequest",
"Order": ".openresponsesrequest",
"OrderTypedDict": ".openresponsesrequest",
"ServiceTier": ".openresponsesrequest",
"Truncation": ".openresponsesrequest",
"OpenResponsesResponseText": ".openresponsesresponsetext",
@@ -1945,12 +2104,50 @@ _dynamic_imports: dict[str, str] = {
"PayloadTooLargeResponseErrorDataTypedDict": ".payloadtoolargeresponseerrordata",
"PaymentRequiredResponseErrorData": ".paymentrequiredresponseerrordata",
"PaymentRequiredResponseErrorDataTypedDict": ".paymentrequiredresponseerrordata",
"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",
"ProviderPreferences": ".providerpreferences",
"ProviderPreferencesIgnore": ".providerpreferences",
"ProviderPreferencesIgnoreTypedDict": ".providerpreferences",
"ProviderPreferencesMaxPrice": ".providerpreferences",
"ProviderPreferencesMaxPriceTypedDict": ".providerpreferences",
"ProviderPreferencesOnly": ".providerpreferences",
"ProviderPreferencesOnlyTypedDict": ".providerpreferences",
"ProviderPreferencesOrder": ".providerpreferences",
"ProviderPreferencesOrderTypedDict": ".providerpreferences",
"ProviderPreferencesPartition": ".providerpreferences",
"ProviderPreferencesProviderSort": ".providerpreferences",
"ProviderPreferencesProviderSortConfig": ".providerpreferences",
"ProviderPreferencesProviderSortConfigTypedDict": ".providerpreferences",
"ProviderPreferencesSortUnion": ".providerpreferences",
"ProviderPreferencesSortUnionTypedDict": ".providerpreferences",
"ProviderPreferencesTypedDict": ".providerpreferences",
"ProviderSortConfigEnum": ".providerpreferences",
"ProviderSortConfigUnion": ".providerpreferences",
"ProviderSortConfigUnionTypedDict": ".providerpreferences",
"SortEnum": ".providerpreferences",
"ProviderSort": ".providersort",
"Partition": ".providersortconfig",
"ProviderSortConfig": ".providersortconfig",
"ProviderSortConfigTypedDict": ".providersortconfig",
"ProviderSortUnion": ".providersortunion",
"ProviderSortUnionTypedDict": ".providersortunion",
"Pricing": ".publicendpoint",
"PricingTypedDict": ".publicendpoint",
"PublicEndpoint": ".publicendpoint",
@@ -2022,6 +2219,7 @@ _dynamic_imports: dict[str, str] = {
"ResponsesOutputItemFunctionCallType": ".responsesoutputitemfunctioncall",
"ResponsesOutputItemFunctionCallTypedDict": ".responsesoutputitemfunctioncall",
"ResponsesOutputItemReasoning": ".responsesoutputitemreasoning",
"ResponsesOutputItemReasoningFormat": ".responsesoutputitemreasoning",
"ResponsesOutputItemReasoningStatusCompleted": ".responsesoutputitemreasoning",
"ResponsesOutputItemReasoningStatusInProgress": ".responsesoutputitemreasoning",
"ResponsesOutputItemReasoningStatusIncomplete": ".responsesoutputitemreasoning",
@@ -2040,6 +2238,7 @@ _dynamic_imports: dict[str, str] = {
"ResponsesOutputMessageStatusUnionTypedDict": ".responsesoutputmessage",
"ResponsesOutputMessageType": ".responsesoutputmessage",
"ResponsesOutputMessageTypedDict": ".responsesoutputmessage",
"ResponsesOutputModality": ".responsesoutputmodality",
"ResponsesSearchContextSize": ".responsessearchcontextsize",
"ResponsesWebSearchCallOutput": ".responseswebsearchcalloutput",
"ResponsesWebSearchCallOutputType": ".responseswebsearchcalloutput",
@@ -2082,6 +2281,7 @@ _dynamic_imports: dict[str, str] = {
"UserMessageContent": ".usermessage",
"UserMessageContentTypedDict": ".usermessage",
"UserMessageTypedDict": ".usermessage",
"WebSearchEngine": ".websearchengine",
"WebSearchPreviewToolUserLocation": ".websearchpreviewtooluserlocation",
"WebSearchPreviewToolUserLocationType": ".websearchpreviewtooluserlocation",
"WebSearchPreviewToolUserLocationTypedDict": ".websearchpreviewtooluserlocation",
+2 -2
View File
@@ -36,7 +36,6 @@ Schema0Enum = Union[
"Fireworks",
"Friendli",
"GMICloud",
"GoPomelo",
"Google",
"Google AI Studio",
"Groq",
@@ -66,13 +65,14 @@ Schema0Enum = Union[
"Phala",
"Relace",
"SambaNova",
"Seed",
"SiliconFlow",
"Sourceful",
"Stealth",
"StreamLake",
"Switchpoint",
"Targon",
"Together",
"Upstage",
"Venice",
"WandB",
"Xiaomi",
+229
View File
@@ -0,0 +1,229 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import get_discriminator, validate_const, validate_open_enum
import pydantic
from pydantic import Discriminator, Tag, model_serializer
from pydantic.functional_validators import AfterValidator, PlainValidator
from typing import Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
Schema5 = Union[
Literal[
"unknown",
"openai-responses-v1",
"azure-openai-responses-v1",
"xai-responses-v1",
"anthropic-claude-v1",
"google-gemini-v1",
],
UnrecognizedStr,
]
class Schema3ReasoningTextTypedDict(TypedDict):
type: Literal["reasoning.text"]
text: NotRequired[Nullable[str]]
signature: NotRequired[Nullable[str]]
id: NotRequired[Nullable[str]]
format_: NotRequired[Nullable[Schema5]]
index: NotRequired[float]
class Schema3ReasoningText(BaseModel):
TYPE: Annotated[
Annotated[
Literal["reasoning.text"], AfterValidator(validate_const("reasoning.text"))
],
pydantic.Field(alias="type"),
] = "reasoning.text"
text: OptionalNullable[str] = UNSET
signature: OptionalNullable[str] = UNSET
id: OptionalNullable[str] = UNSET
format_: Annotated[
Annotated[OptionalNullable[Schema5], PlainValidator(validate_open_enum(False))],
pydantic.Field(alias="format"),
] = UNSET
index: Optional[float] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["text", "signature", "id", "format", "index"]
nullable_fields = ["text", "signature", "id", "format"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class Schema3ReasoningEncryptedTypedDict(TypedDict):
data: str
type: Literal["reasoning.encrypted"]
id: NotRequired[Nullable[str]]
format_: NotRequired[Nullable[Schema5]]
index: NotRequired[float]
class Schema3ReasoningEncrypted(BaseModel):
data: str
TYPE: Annotated[
Annotated[
Literal["reasoning.encrypted"],
AfterValidator(validate_const("reasoning.encrypted")),
],
pydantic.Field(alias="type"),
] = "reasoning.encrypted"
id: OptionalNullable[str] = UNSET
format_: Annotated[
Annotated[OptionalNullable[Schema5], PlainValidator(validate_open_enum(False))],
pydantic.Field(alias="format"),
] = UNSET
index: Optional[float] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["id", "format", "index"]
nullable_fields = ["id", "format"]
null_default_fields = []
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
serialized.pop(k, None)
optional_nullable = k in optional_fields and k in nullable_fields
is_set = (
self.__pydantic_fields_set__.intersection({n})
or k in null_default_fields
) # pylint: disable=no-member
if val is not None and val != UNSET_SENTINEL:
m[k] = val
elif val != UNSET_SENTINEL and (
not k in optional_fields or (optional_nullable and is_set)
):
m[k] = val
return m
class Schema3ReasoningSummaryTypedDict(TypedDict):
summary: str
type: Literal["reasoning.summary"]
id: NotRequired[Nullable[str]]
format_: NotRequired[Nullable[Schema5]]
index: NotRequired[float]
class Schema3ReasoningSummary(BaseModel):
summary: str
TYPE: Annotated[
Annotated[
Literal["reasoning.summary"],
AfterValidator(validate_const("reasoning.summary")),
],
pydantic.Field(alias="type"),
] = "reasoning.summary"
id: OptionalNullable[str] = UNSET
format_: Annotated[
Annotated[OptionalNullable[Schema5], PlainValidator(validate_open_enum(False))],
pydantic.Field(alias="format"),
] = UNSET
index: Optional[float] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["id", "format", "index"]
nullable_fields = ["id", "format"]
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
Schema3TypedDict = TypeAliasType(
"Schema3TypedDict",
Union[
Schema3ReasoningSummaryTypedDict,
Schema3ReasoningEncryptedTypedDict,
Schema3ReasoningTextTypedDict,
],
)
Schema3 = Annotated[
Union[
Annotated[Schema3ReasoningSummary, Tag("reasoning.summary")],
Annotated[Schema3ReasoningEncrypted, Tag("reasoning.encrypted")],
Annotated[Schema3ReasoningText, Tag("reasoning.text")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
+211 -50
View File
@@ -4,6 +4,7 @@ from __future__ import annotations
from ._schema0 import Schema0, Schema0TypedDict
from .chatstreamoptions import ChatStreamOptions, ChatStreamOptionsTypedDict
from .message import Message, MessageTypedDict
from .providersortunion import ProviderSortUnion, ProviderSortUnionTypedDict
from .reasoningsummaryverbosity import ReasoningSummaryVerbosity
from .responseformatjsonschema import (
ResponseFormatJSONSchema,
@@ -55,16 +56,6 @@ Quantizations = Union[
]
Sort = Union[
Literal[
"price",
"throughput",
"latency",
],
UnrecognizedStr,
]
class ChatGenerationParamsMaxPriceTypedDict(TypedDict):
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
@@ -89,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
@@ -114,14 +223,18 @@ class ChatGenerationParamsProviderTypedDict(TypedDict):
r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
quantizations: NotRequired[Nullable[List[Quantizations]]]
r"""A list of quantization levels to filter the provider by."""
sort: NotRequired[Nullable[Sort]]
sort: NotRequired[Nullable[ProviderSortUnionTypedDict]]
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."""
min_throughput: NotRequired[Nullable[float]]
r"""The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used."""
max_latency: NotRequired[Nullable[float]]
r"""The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used."""
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):
@@ -163,19 +276,21 @@ class ChatGenerationParamsProvider(BaseModel):
] = UNSET
r"""A list of quantization levels to filter the provider by."""
sort: Annotated[
OptionalNullable[Sort], PlainValidator(validate_open_enum(False))
] = UNSET
sort: OptionalNullable[ProviderSortUnion] = UNSET
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
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."""
min_throughput: OptionalNullable[float] = UNSET
r"""The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used."""
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."""
max_latency: OptionalNullable[float] = UNSET
r"""The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used."""
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):
@@ -191,8 +306,8 @@ class ChatGenerationParamsProvider(BaseModel):
"quantizations",
"sort",
"max_price",
"min_throughput",
"max_latency",
"preferred_min_throughput",
"preferred_max_latency",
]
nullable_fields = [
"allow_fallbacks",
@@ -205,8 +320,8 @@ class ChatGenerationParamsProvider(BaseModel):
"ignore",
"quantizations",
"sort",
"min_throughput",
"max_latency",
"preferred_min_throughput",
"preferred_max_latency",
]
null_default_fields = []
@@ -252,7 +367,7 @@ class ChatGenerationParamsPluginResponseHealing(BaseModel):
enabled: Optional[bool] = None
ChatGenerationParamsPdfEngine = Union[
PdfEngine = Union[
Literal[
"mistral-ocr",
"pdf-text",
@@ -262,21 +377,20 @@ ChatGenerationParamsPdfEngine = Union[
]
class ChatGenerationParamsPdfTypedDict(TypedDict):
engine: NotRequired[ChatGenerationParamsPdfEngine]
class PdfTypedDict(TypedDict):
engine: NotRequired[PdfEngine]
class ChatGenerationParamsPdf(BaseModel):
class Pdf(BaseModel):
engine: Annotated[
Optional[ChatGenerationParamsPdfEngine],
PlainValidator(validate_open_enum(False)),
Optional[PdfEngine], PlainValidator(validate_open_enum(False))
] = None
class ChatGenerationParamsPluginFileParserTypedDict(TypedDict):
id: Literal["file-parser"]
enabled: NotRequired[bool]
pdf: NotRequired[ChatGenerationParamsPdfTypedDict]
pdf: NotRequired[PdfTypedDict]
class ChatGenerationParamsPluginFileParser(BaseModel):
@@ -289,10 +403,10 @@ class ChatGenerationParamsPluginFileParser(BaseModel):
enabled: Optional[bool] = None
pdf: Optional[ChatGenerationParamsPdf] = None
pdf: Optional[Pdf] = None
ChatGenerationParamsEngine = Union[
Engine = Union[
Literal[
"native",
"exa",
@@ -306,7 +420,7 @@ class ChatGenerationParamsPluginWebTypedDict(TypedDict):
enabled: NotRequired[bool]
max_results: NotRequired[float]
search_prompt: NotRequired[str]
engine: NotRequired[ChatGenerationParamsEngine]
engine: NotRequired[Engine]
class ChatGenerationParamsPluginWeb(BaseModel):
@@ -321,9 +435,9 @@ class ChatGenerationParamsPluginWeb(BaseModel):
search_prompt: Optional[str] = None
engine: Annotated[
Optional[ChatGenerationParamsEngine], PlainValidator(validate_open_enum(False))
] = None
engine: Annotated[Optional[Engine], PlainValidator(validate_open_enum(False))] = (
None
)
class ChatGenerationParamsPluginModerationTypedDict(TypedDict):
@@ -337,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,
],
@@ -350,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")],
@@ -359,7 +494,7 @@ ChatGenerationParamsPluginUnion = Annotated[
]
ChatGenerationParamsRoute = Union[
Route = Union[
Literal[
"fallback",
"sort",
@@ -370,12 +505,12 @@ ChatGenerationParamsRoute = Union[
Effort = Union[
Literal[
"none",
"minimal",
"low",
"medium",
"high",
"xhigh",
"high",
"medium",
"low",
"minimal",
"none",
],
UnrecognizedStr,
]
@@ -504,14 +639,32 @@ 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]]
r"""When multiple model providers are available, optionally indicate your routing preference."""
plugins: NotRequired[List[ChatGenerationParamsPluginUnionTypedDict]]
r"""Plugins you want to enable for this request, including their settings."""
route: NotRequired[Nullable[ChatGenerationParamsRoute]]
r"""Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria."""
route: NotRequired[Nullable[Route]]
user: NotRequired[str]
session_id: NotRequired[str]
r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters."""
@@ -536,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):
@@ -548,10 +703,8 @@ class ChatGenerationParams(BaseModel):
r"""Plugins you want to enable for this request, including their settings."""
route: Annotated[
OptionalNullable[ChatGenerationParamsRoute],
PlainValidator(validate_open_enum(False)),
OptionalNullable[Route], PlainValidator(validate_open_enum(False))
] = UNSET
r"""Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria."""
user: Optional[str] = None
@@ -600,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 = [
@@ -629,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
@@ -1,6 +1,7 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from ._schema3 import Schema3, Schema3TypedDict
from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
from .chatcompletionfinishreason import ChatCompletionFinishReason
from .chatmessagetokenlogprobs import (
@@ -17,6 +18,7 @@ from openrouter.types import (
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -24,6 +26,7 @@ class ChatResponseChoiceTypedDict(TypedDict):
finish_reason: Nullable[ChatCompletionFinishReason]
index: float
message: AssistantMessageTypedDict
reasoning_details: NotRequired[List[Schema3TypedDict]]
logprobs: NotRequired[Nullable[ChatMessageTokenLogprobsTypedDict]]
@@ -36,11 +39,13 @@ class ChatResponseChoice(BaseModel):
message: AssistantMessage
reasoning_details: Optional[List[Schema3]] = None
logprobs: OptionalNullable[ChatMessageTokenLogprobs] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["logprobs"]
optional_fields = ["reasoning_details", "logprobs"]
nullable_fields = ["finish_reason", "logprobs"]
null_default_fields = []
@@ -1,6 +1,7 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from ._schema3 import Schema3, Schema3TypedDict
from .chatstreamingmessagetoolcall import (
ChatStreamingMessageToolCall,
ChatStreamingMessageToolCallTypedDict,
@@ -26,6 +27,7 @@ class ChatStreamingMessageChunkTypedDict(TypedDict):
reasoning: NotRequired[Nullable[str]]
refusal: NotRequired[Nullable[str]]
tool_calls: NotRequired[List[ChatStreamingMessageToolCallTypedDict]]
reasoning_details: NotRequired[List[Schema3TypedDict]]
class ChatStreamingMessageChunk(BaseModel):
@@ -39,9 +41,18 @@ class ChatStreamingMessageChunk(BaseModel):
tool_calls: Optional[List[ChatStreamingMessageToolCall]] = None
reasoning_details: Optional[List[Schema3]] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["role", "content", "reasoning", "refusal", "tool_calls"]
optional_fields = [
"role",
"content",
"reasoning",
"refusal",
"tool_calls",
"reasoning_details",
]
nullable_fields = ["content", "reasoning", "refusal"]
null_default_fields = []
@@ -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,
],
)
@@ -55,6 +55,7 @@ OpenResponsesReasoningFormat = Union[
Literal[
"unknown",
"openai-responses-v1",
"azure-openai-responses-v1",
"xai-responses-v1",
"anthropic-claude-v1",
"google-gemini-v1",
+121 -85
View File
@@ -33,9 +33,18 @@ from .openresponseswebsearchtool import (
OpenResponsesWebSearchTool,
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,
Nullable,
@@ -136,6 +145,16 @@ OpenResponsesRequestToolUnion = Annotated[
]
OpenResponsesRequestImageConfigTypedDict = TypeAliasType(
"OpenResponsesRequestImageConfigTypedDict", Union[str, float]
)
OpenResponsesRequestImageConfig = TypeAliasType(
"OpenResponsesRequestImageConfig", Union[str, float]
)
ServiceTier = Literal["auto",]
@@ -148,33 +167,57 @@ Truncation = Union[
]
OrderTypedDict = TypeAliasType("OrderTypedDict", Union[ProviderName, str])
OpenResponsesRequestOrderTypedDict = TypeAliasType(
"OpenResponsesRequestOrderTypedDict", Union[ProviderName, str]
)
Order = TypeAliasType(
"Order",
OpenResponsesRequestOrder = TypeAliasType(
"OpenResponsesRequestOrder",
Union[Annotated[ProviderName, PlainValidator(validate_open_enum(False))], str],
)
OnlyTypedDict = TypeAliasType("OnlyTypedDict", Union[ProviderName, str])
OpenResponsesRequestOnlyTypedDict = TypeAliasType(
"OpenResponsesRequestOnlyTypedDict", Union[ProviderName, str]
)
Only = TypeAliasType(
"Only",
OpenResponsesRequestOnly = TypeAliasType(
"OpenResponsesRequestOnly",
Union[Annotated[ProviderName, PlainValidator(validate_open_enum(False))], str],
)
IgnoreTypedDict = TypeAliasType("IgnoreTypedDict", Union[ProviderName, str])
OpenResponsesRequestIgnoreTypedDict = TypeAliasType(
"OpenResponsesRequestIgnoreTypedDict", Union[ProviderName, str]
)
Ignore = TypeAliasType(
"Ignore",
OpenResponsesRequestIgnore = TypeAliasType(
"OpenResponsesRequestIgnore",
Union[Annotated[ProviderName, PlainValidator(validate_open_enum(False))], str],
)
OpenResponsesRequestSortTypedDict = TypeAliasType(
"OpenResponsesRequestSortTypedDict",
Union[ProviderSortConfigTypedDict, ProviderSort, Any],
)
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
OpenResponsesRequestSort = TypeAliasType(
"OpenResponsesRequestSort",
Union[
ProviderSortConfig,
Annotated[ProviderSort, PlainValidator(validate_open_enum(False))],
Any,
],
)
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
class OpenResponsesRequestMaxPriceTypedDict(TypedDict):
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
@@ -230,22 +273,22 @@ class OpenResponsesRequestProviderTypedDict(TypedDict):
r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used."""
enforce_distillable_text: NotRequired[Nullable[bool]]
r"""Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used."""
order: NotRequired[Nullable[List[OrderTypedDict]]]
order: NotRequired[Nullable[List[OpenResponsesRequestOrderTypedDict]]]
r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message."""
only: NotRequired[Nullable[List[OnlyTypedDict]]]
only: NotRequired[Nullable[List[OpenResponsesRequestOnlyTypedDict]]]
r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request."""
ignore: NotRequired[Nullable[List[IgnoreTypedDict]]]
ignore: NotRequired[Nullable[List[OpenResponsesRequestIgnoreTypedDict]]]
r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
quantizations: NotRequired[Nullable[List[Quantization]]]
r"""A list of quantization levels to filter the provider by."""
sort: NotRequired[Nullable[ProviderSort]]
sort: NotRequired[Nullable[OpenResponsesRequestSortTypedDict]]
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."""
min_throughput: NotRequired[Nullable[float]]
r"""The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used."""
max_latency: NotRequired[Nullable[float]]
r"""The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used."""
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):
@@ -276,13 +319,13 @@ class OpenResponsesRequestProvider(BaseModel):
enforce_distillable_text: OptionalNullable[bool] = UNSET
r"""Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used."""
order: OptionalNullable[List[Order]] = UNSET
order: OptionalNullable[List[OpenResponsesRequestOrder]] = UNSET
r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message."""
only: OptionalNullable[List[Only]] = UNSET
only: OptionalNullable[List[OpenResponsesRequestOnly]] = UNSET
r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request."""
ignore: OptionalNullable[List[Ignore]] = UNSET
ignore: OptionalNullable[List[OpenResponsesRequestIgnore]] = UNSET
r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
quantizations: OptionalNullable[
@@ -290,19 +333,17 @@ class OpenResponsesRequestProvider(BaseModel):
] = UNSET
r"""A list of quantization levels to filter the provider by."""
sort: Annotated[
OptionalNullable[ProviderSort], PlainValidator(validate_open_enum(False))
] = UNSET
sort: OptionalNullable[OpenResponsesRequestSort] = UNSET
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
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."""
min_throughput: OptionalNullable[float] = UNSET
r"""The minimum throughput (in tokens per second) required for this request. Only providers serving the model with at least this throughput will be used."""
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."""
max_latency: OptionalNullable[float] = UNSET
r"""The maximum latency (in seconds) allowed for this request. Only providers serving the model with better than this latency will be used."""
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):
@@ -318,8 +359,8 @@ class OpenResponsesRequestProvider(BaseModel):
"quantizations",
"sort",
"max_price",
"min_throughput",
"max_latency",
"preferred_min_throughput",
"preferred_max_latency",
]
nullable_fields = [
"allow_fallbacks",
@@ -332,8 +373,8 @@ class OpenResponsesRequestProvider(BaseModel):
"ignore",
"quantizations",
"sort",
"min_throughput",
"max_latency",
"preferred_min_throughput",
"preferred_max_latency",
]
null_default_fields = []
@@ -381,32 +422,12 @@ class OpenResponsesRequestPluginResponseHealing(BaseModel):
IDFileParser = Literal["file-parser",]
OpenResponsesRequestPdfEngine = Union[
Literal[
"mistral-ocr",
"pdf-text",
"native",
],
UnrecognizedStr,
]
class OpenResponsesRequestPdfTypedDict(TypedDict):
engine: NotRequired[OpenResponsesRequestPdfEngine]
class OpenResponsesRequestPdf(BaseModel):
engine: Annotated[
Optional[OpenResponsesRequestPdfEngine],
PlainValidator(validate_open_enum(False)),
] = None
class OpenResponsesRequestPluginFileParserTypedDict(TypedDict):
id: IDFileParser
enabled: NotRequired[bool]
r"""Set to false to disable the file-parser plugin for this request. Defaults to true."""
pdf: NotRequired[OpenResponsesRequestPdfTypedDict]
pdf: NotRequired[PDFParserOptionsTypedDict]
r"""Options for PDF parsing."""
class OpenResponsesRequestPluginFileParser(BaseModel):
@@ -415,28 +436,21 @@ class OpenResponsesRequestPluginFileParser(BaseModel):
enabled: Optional[bool] = None
r"""Set to false to disable the file-parser plugin for this request. Defaults to true."""
pdf: Optional[OpenResponsesRequestPdf] = None
pdf: Optional[PDFParserOptions] = None
r"""Options for PDF parsing."""
IDWeb = Literal["web",]
OpenResponsesRequestEngine = Union[
Literal[
"native",
"exa",
],
UnrecognizedStr,
]
class OpenResponsesRequestPluginWebTypedDict(TypedDict):
id: IDWeb
enabled: NotRequired[bool]
r"""Set to false to disable the web-search plugin for this request. Defaults to true."""
max_results: NotRequired[float]
search_prompt: NotRequired[str]
engine: NotRequired[OpenResponsesRequestEngine]
engine: NotRequired[WebSearchEngine]
r"""The search engine to use for web search."""
class OpenResponsesRequestPluginWeb(BaseModel):
@@ -450,8 +464,9 @@ class OpenResponsesRequestPluginWeb(BaseModel):
search_prompt: Optional[str] = None
engine: Annotated[
Optional[OpenResponsesRequestEngine], PlainValidator(validate_open_enum(False))
Optional[WebSearchEngine], PlainValidator(validate_open_enum(False))
] = None
r"""The search engine to use for web search."""
IDModeration = Literal["moderation",]
@@ -465,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,
],
@@ -478,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")],
@@ -487,16 +525,6 @@ OpenResponsesRequestPluginUnion = Annotated[
]
OpenResponsesRequestRoute = Union[
Literal[
"fallback",
"sort",
],
UnrecognizedStr,
]
r"""Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria."""
class OpenResponsesRequestTypedDict(TypedDict):
r"""Request schema for Responses endpoint"""
@@ -518,6 +546,10 @@ class OpenResponsesRequestTypedDict(TypedDict):
temperature: NotRequired[Nullable[float]]
top_p: 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]]
@@ -532,8 +564,6 @@ class OpenResponsesRequestTypedDict(TypedDict):
r"""When multiple model providers are available, optionally indicate your routing preference."""
plugins: NotRequired[List[OpenResponsesRequestPluginUnionTypedDict]]
r"""Plugins you want to enable for this request, including their settings."""
route: NotRequired[Nullable[OpenResponsesRequestRoute]]
r"""Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria."""
user: NotRequired[str]
r"""A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters."""
session_id: NotRequired[str]
@@ -575,6 +605,18 @@ class OpenResponsesRequest(BaseModel):
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
@@ -612,12 +654,6 @@ class OpenResponsesRequest(BaseModel):
plugins: Optional[List[OpenResponsesRequestPluginUnion]] = None
r"""Plugins you want to enable for this request, including their settings."""
route: Annotated[
OptionalNullable[OpenResponsesRequestRoute],
PlainValidator(validate_open_enum(False)),
] = UNSET
r"""Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria."""
user: Optional[str] = None
r"""A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters."""
@@ -641,6 +677,8 @@ class OpenResponsesRequest(BaseModel):
"temperature",
"top_p",
"top_k",
"image_config",
"modalities",
"prompt_cache_key",
"previous_response_id",
"prompt",
@@ -653,7 +691,6 @@ class OpenResponsesRequest(BaseModel):
"stream",
"provider",
"plugins",
"route",
"user",
"session_id",
]
@@ -673,7 +710,6 @@ class OpenResponsesRequest(BaseModel):
"safety_identifier",
"truncation",
"provider",
"route",
]
null_default_fields = []
+1
View File
@@ -28,6 +28,7 @@ Parameter = Union[
"parallel_tool_calls",
"include_reasoning",
"reasoning",
"reasoning_effort",
"web_search_options",
"verbosity",
],
@@ -0,0 +1,16 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import UnrecognizedStr
from typing import Literal, Union
PDFParserEngine = Union[
Literal[
"mistral-ocr",
"pdf-text",
"native",
],
UnrecognizedStr,
]
r"""The engine to use for parsing PDF files."""
@@ -0,0 +1,25 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .pdfparserengine import PDFParserEngine
from openrouter.types import BaseModel
from openrouter.utils import validate_open_enum
from pydantic.functional_validators import PlainValidator
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class PDFParserOptionsTypedDict(TypedDict):
r"""Options for PDF parsing."""
engine: NotRequired[PDFParserEngine]
r"""The engine to use for parsing PDF files."""
class PDFParserOptions(BaseModel):
r"""Options for PDF parsing."""
engine: Annotated[
Optional[PDFParserEngine], PlainValidator(validate_open_enum(False))
] = None
r"""The engine to use for parsing PDF files."""
@@ -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 seconds over the last 30 minutes. Latency measures time to first token."""
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 seconds over the last 30 minutes. Latency measures time to first token."""
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."""
+2 -2
View File
@@ -33,7 +33,6 @@ ProviderName = Union[
"Fireworks",
"Friendli",
"GMICloud",
"GoPomelo",
"Google",
"Google AI Studio",
"Groq",
@@ -63,13 +62,14 @@ ProviderName = Union[
"Phala",
"Relace",
"SambaNova",
"Seed",
"SiliconFlow",
"Sourceful",
"Stealth",
"StreamLake",
"Switchpoint",
"Targon",
"Together",
"Upstage",
"Venice",
"WandB",
"Xiaomi",
@@ -0,0 +1,355 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
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
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
ProviderPreferencesOrderTypedDict = TypeAliasType(
"ProviderPreferencesOrderTypedDict", Union[ProviderName, str]
)
ProviderPreferencesOrder = TypeAliasType(
"ProviderPreferencesOrder",
Union[Annotated[ProviderName, PlainValidator(validate_open_enum(False))], str],
)
ProviderPreferencesOnlyTypedDict = TypeAliasType(
"ProviderPreferencesOnlyTypedDict", Union[ProviderName, str]
)
ProviderPreferencesOnly = TypeAliasType(
"ProviderPreferencesOnly",
Union[Annotated[ProviderName, PlainValidator(validate_open_enum(False))], str],
)
ProviderPreferencesIgnoreTypedDict = TypeAliasType(
"ProviderPreferencesIgnoreTypedDict", Union[ProviderName, str]
)
ProviderPreferencesIgnore = TypeAliasType(
"ProviderPreferencesIgnore",
Union[Annotated[ProviderName, PlainValidator(validate_open_enum(False))], str],
)
SortEnum = Union[
Literal[
"price",
"throughput",
"latency",
],
UnrecognizedStr,
]
ProviderSortConfigEnum = Literal[
"price",
"throughput",
"latency",
]
ProviderPreferencesPartition = Union[
Literal[
"model",
"none",
],
UnrecognizedStr,
]
class ProviderPreferencesProviderSortConfigTypedDict(TypedDict):
by: NotRequired[Nullable[ProviderSort]]
partition: NotRequired[Nullable[ProviderPreferencesPartition]]
class ProviderPreferencesProviderSortConfig(BaseModel):
by: Annotated[
OptionalNullable[ProviderSort], PlainValidator(validate_open_enum(False))
] = UNSET
partition: Annotated[
OptionalNullable[ProviderPreferencesPartition],
PlainValidator(validate_open_enum(False)),
] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["by", "partition"]
nullable_fields = ["by", "partition"]
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
ProviderSortConfigUnionTypedDict = TypeAliasType(
"ProviderSortConfigUnionTypedDict",
Union[ProviderPreferencesProviderSortConfigTypedDict, ProviderSortConfigEnum],
)
ProviderSortConfigUnion = TypeAliasType(
"ProviderSortConfigUnion",
Union[ProviderPreferencesProviderSortConfig, ProviderSortConfigEnum],
)
ProviderPreferencesProviderSort = Union[
Literal[
"price",
"throughput",
"latency",
],
UnrecognizedStr,
]
ProviderPreferencesSortUnionTypedDict = TypeAliasType(
"ProviderPreferencesSortUnionTypedDict",
Union[ProviderPreferencesProviderSort, ProviderSortConfigUnionTypedDict, SortEnum],
)
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
ProviderPreferencesSortUnion = TypeAliasType(
"ProviderPreferencesSortUnion",
Union[
Annotated[
ProviderPreferencesProviderSort, PlainValidator(validate_open_enum(False))
],
ProviderSortConfigUnion,
Annotated[SortEnum, PlainValidator(validate_open_enum(False))],
],
)
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
class ProviderPreferencesMaxPriceTypedDict(TypedDict):
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
prompt: NotRequired[str]
r"""A value in string format that is a large number"""
completion: NotRequired[str]
r"""A value in string format that is a large number"""
image: NotRequired[str]
r"""A value in string format that is a large number"""
audio: NotRequired[str]
r"""A value in string format that is a large number"""
request: NotRequired[str]
r"""A value in string format that is a large number"""
class ProviderPreferencesMaxPrice(BaseModel):
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
prompt: Optional[str] = None
r"""A value in string format that is a large number"""
completion: Optional[str] = None
r"""A value in string format that is a large number"""
image: Optional[str] = None
r"""A value in string format that is a large number"""
audio: Optional[str] = None
r"""A value in string format that is a large number"""
request: Optional[str] = None
r"""A value in string format that is a large number"""
class ProviderPreferencesTypedDict(TypedDict):
r"""Provider routing preferences for the request."""
allow_fallbacks: NotRequired[Nullable[bool]]
r"""Whether to allow backup providers to serve requests
- true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
"""
require_parameters: NotRequired[Nullable[bool]]
r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest."""
data_collection: NotRequired[Nullable[DataCollection]]
r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it
- deny: use only providers which do not collect user data.
"""
zdr: NotRequired[Nullable[bool]]
r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used."""
enforce_distillable_text: NotRequired[Nullable[bool]]
r"""Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used."""
order: NotRequired[Nullable[List[ProviderPreferencesOrderTypedDict]]]
r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message."""
only: NotRequired[Nullable[List[ProviderPreferencesOnlyTypedDict]]]
r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request."""
ignore: NotRequired[Nullable[List[ProviderPreferencesIgnoreTypedDict]]]
r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
quantizations: NotRequired[Nullable[List[Quantization]]]
r"""A list of quantization levels to filter the provider by."""
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[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):
r"""Provider routing preferences for the request."""
allow_fallbacks: OptionalNullable[bool] = UNSET
r"""Whether to allow backup providers to serve requests
- true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
"""
require_parameters: OptionalNullable[bool] = UNSET
r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest."""
data_collection: Annotated[
OptionalNullable[DataCollection], PlainValidator(validate_open_enum(False))
] = UNSET
r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it
- deny: use only providers which do not collect user data.
"""
zdr: OptionalNullable[bool] = UNSET
r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used."""
enforce_distillable_text: OptionalNullable[bool] = UNSET
r"""Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used."""
order: OptionalNullable[List[ProviderPreferencesOrder]] = UNSET
r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message."""
only: OptionalNullable[List[ProviderPreferencesOnly]] = UNSET
r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request."""
ignore: OptionalNullable[List[ProviderPreferencesIgnore]] = UNSET
r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
quantizations: OptionalNullable[
List[Annotated[Quantization, PlainValidator(validate_open_enum(False))]]
] = UNSET
r"""A list of quantization levels to filter the provider by."""
sort: OptionalNullable[ProviderPreferencesSortUnion] = UNSET
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[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[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):
optional_fields = [
"allow_fallbacks",
"require_parameters",
"data_collection",
"zdr",
"enforce_distillable_text",
"order",
"only",
"ignore",
"quantizations",
"sort",
"max_price",
"preferred_min_throughput",
"preferred_max_latency",
]
nullable_fields = [
"allow_fallbacks",
"require_parameters",
"data_collection",
"zdr",
"enforce_distillable_text",
"order",
"only",
"ignore",
"quantizations",
"sort",
"preferred_min_throughput",
"preferred_max_latency",
]
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
@@ -13,4 +13,3 @@ ProviderSort = Union[
],
UnrecognizedStr,
]
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
@@ -0,0 +1,71 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .providersort import ProviderSort
from openrouter.types import (
BaseModel,
Nullable,
OptionalNullable,
UNSET,
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import Literal, Union
from typing_extensions import Annotated, NotRequired, TypedDict
Partition = Union[
Literal[
"model",
"none",
],
UnrecognizedStr,
]
class ProviderSortConfigTypedDict(TypedDict):
by: NotRequired[Nullable[ProviderSort]]
partition: NotRequired[Nullable[Partition]]
class ProviderSortConfig(BaseModel):
by: Annotated[
OptionalNullable[ProviderSort], PlainValidator(validate_open_enum(False))
] = UNSET
partition: Annotated[
OptionalNullable[Partition], PlainValidator(validate_open_enum(False))
] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["by", "partition"]
nullable_fields = ["by", "partition"]
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,23 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .providersort import ProviderSort
from .providersortconfig import ProviderSortConfig, ProviderSortConfigTypedDict
from openrouter.utils import validate_open_enum
from pydantic.functional_validators import PlainValidator
from typing import Union
from typing_extensions import Annotated, TypeAliasType
ProviderSortUnionTypedDict = TypeAliasType(
"ProviderSortUnionTypedDict", Union[ProviderSortConfigTypedDict, ProviderSort]
)
ProviderSortUnion = TypeAliasType(
"ProviderSortUnion",
Union[
ProviderSortConfig,
Annotated[ProviderSort, PlainValidator(validate_open_enum(False))],
],
)
@@ -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 seconds over the last 30 minutes. Latency measures time to first token."""
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 seconds over the last 30 minutes. Latency measures time to first token."""
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 = []
@@ -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,
]
@@ -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
WebSearchEngine = Union[
Literal[
"native",
"exa",
],
UnrecognizedStr,
]
r"""The search engine to use for web search."""