mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-29 11:23:49 +08:00
chore: 🐝 Update SDK - Generate (spec change merged) 0.11.24 (#436)
Co-authored-by: speakeasybot <bot@speakeasyapi.dev> Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
speakeasybot
speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com>
parent
cb1b9c5ac6
commit
7010ca5c2e
@@ -3,10 +3,10 @@
|
||||
import importlib.metadata
|
||||
|
||||
__title__: str = "openrouter"
|
||||
__version__: str = "0.11.23"
|
||||
__version__: str = "0.11.24"
|
||||
__openapi_doc_version__: str = "1.0.0"
|
||||
__gen_version__: str = "2.914.0"
|
||||
__user_agent__: str = "speakeasy-sdk/python 0.11.23 2.914.0 1.0.0 openrouter"
|
||||
__user_agent__: str = "speakeasy-sdk/python 0.11.24 2.914.0 1.0.0 openrouter"
|
||||
|
||||
try:
|
||||
if __package__ is not None:
|
||||
|
||||
@@ -19,8 +19,8 @@ class Byok(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
workspace_id: Optional[str] = None,
|
||||
provider: Optional[operations.Provider] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
@@ -129,7 +129,7 @@ class Byok(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return None
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return None
|
||||
next_offset = offset + len(results[0])
|
||||
@@ -185,8 +185,8 @@ class Byok(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
workspace_id: Optional[str] = None,
|
||||
provider: Optional[operations.Provider] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
@@ -298,7 +298,7 @@ class Byok(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return empty_result()
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return empty_result()
|
||||
next_offset = offset + len(results[0])
|
||||
|
||||
@@ -95,15 +95,15 @@ if TYPE_CHECKING:
|
||||
AnthropicCitationPageLocationParamType,
|
||||
AnthropicCitationPageLocationParamTypedDict,
|
||||
)
|
||||
from .anthropiccitationsearchresultlocation import (
|
||||
AnthropicCitationSearchResultLocation,
|
||||
AnthropicCitationSearchResultLocationType,
|
||||
AnthropicCitationSearchResultLocationTypedDict,
|
||||
from .anthropiccitationsearchresultlocationparam import (
|
||||
AnthropicCitationSearchResultLocationParam,
|
||||
AnthropicCitationSearchResultLocationParamType,
|
||||
AnthropicCitationSearchResultLocationParamTypedDict,
|
||||
)
|
||||
from .anthropiccitationwebsearchresultlocation import (
|
||||
AnthropicCitationWebSearchResultLocation,
|
||||
AnthropicCitationWebSearchResultLocationType,
|
||||
AnthropicCitationWebSearchResultLocationTypedDict,
|
||||
from .anthropiccitationwebsearchresultlocationparam import (
|
||||
AnthropicCitationWebSearchResultLocationParam,
|
||||
AnthropicCitationWebSearchResultLocationParamType,
|
||||
AnthropicCitationWebSearchResultLocationParamTypedDict,
|
||||
)
|
||||
from .anthropiccompactionusageiteration import (
|
||||
AnthropicCompactionUsageIteration,
|
||||
@@ -470,6 +470,11 @@ if TYPE_CHECKING:
|
||||
ChatFormatGrammarConfigType,
|
||||
ChatFormatGrammarConfigTypedDict,
|
||||
)
|
||||
from .chatformatjsonobjectconfig import (
|
||||
ChatFormatJSONObjectConfig,
|
||||
ChatFormatJSONObjectConfigType,
|
||||
ChatFormatJSONObjectConfigTypedDict,
|
||||
)
|
||||
from .chatformatjsonschemaconfig import (
|
||||
ChatFormatJSONSchemaConfig,
|
||||
ChatFormatJSONSchemaConfigType,
|
||||
@@ -1217,6 +1222,7 @@ if TYPE_CHECKING:
|
||||
ImageGenTextChunkEventType,
|
||||
ImageGenTextChunkEventTypedDict,
|
||||
)
|
||||
from .imageinputmodality import ImageInputModality
|
||||
from .imagemodelarchitecture import (
|
||||
ImageModelArchitecture,
|
||||
ImageModelArchitectureTypedDict,
|
||||
@@ -1327,6 +1333,10 @@ if TYPE_CHECKING:
|
||||
LegacyChatContentVideoType,
|
||||
LegacyChatContentVideoTypedDict,
|
||||
)
|
||||
from .legacy_chatcontentvideoinput import (
|
||||
LegacyChatContentVideoInput,
|
||||
LegacyChatContentVideoInputTypedDict,
|
||||
)
|
||||
from .legacy_websearchservertool import (
|
||||
LegacyWebSearchServerTool,
|
||||
LegacyWebSearchServerToolType,
|
||||
@@ -1586,13 +1596,14 @@ if TYPE_CHECKING:
|
||||
TypeWebSearch20250305,
|
||||
TypeWebSearch20260209,
|
||||
)
|
||||
from .messagessearchmodelsservertool import (
|
||||
MessagesSearchModelsServerTool,
|
||||
MessagesSearchModelsServerToolType,
|
||||
MessagesSearchModelsServerToolTypedDict,
|
||||
)
|
||||
from .metadatalevel import MetadataLevel
|
||||
from .model import Model, ModelTypedDict
|
||||
from .modelarchitecture import (
|
||||
ModelArchitecture,
|
||||
ModelArchitectureInstructType,
|
||||
ModelArchitectureTypedDict,
|
||||
)
|
||||
from .modelarchitecture import ModelArchitecture, ModelArchitectureTypedDict
|
||||
from .modelbenchmarks import ModelBenchmarks, ModelBenchmarksTypedDict
|
||||
from .modelgroup import ModelGroup
|
||||
from .modellinks import ModelLinks, ModelLinksTypedDict
|
||||
@@ -1604,7 +1615,12 @@ if TYPE_CHECKING:
|
||||
ModelsCountResponseDataTypedDict,
|
||||
ModelsCountResponseTypedDict,
|
||||
)
|
||||
from .modelslistresponse import ModelsListResponse, ModelsListResponseTypedDict
|
||||
from .modelslistresponse import (
|
||||
Links,
|
||||
LinksTypedDict,
|
||||
ModelsListResponse,
|
||||
ModelsListResponseTypedDict,
|
||||
)
|
||||
from .moderationplugin import (
|
||||
ModerationPlugin,
|
||||
ModerationPluginID,
|
||||
@@ -1648,19 +1664,25 @@ if TYPE_CHECKING:
|
||||
ObservabilityDestinationTypedDict,
|
||||
UnknownObservabilityDestination,
|
||||
)
|
||||
from .observabilityfilterrulesconfig import (
|
||||
from .observabilityfilterrulegroup import (
|
||||
FieldT,
|
||||
Group,
|
||||
GroupTypedDict,
|
||||
Logic,
|
||||
ObservabilityFilterRulesConfig,
|
||||
ObservabilityFilterRulesConfigTypedDict,
|
||||
ObservabilityFilterRulesConfigValue,
|
||||
ObservabilityFilterRulesConfigValueTypedDict,
|
||||
ObservabilityFilterRuleGroup,
|
||||
ObservabilityFilterRuleGroupTypedDict,
|
||||
ObservabilityFilterRuleGroupValue,
|
||||
ObservabilityFilterRuleGroupValueTypedDict,
|
||||
Operator,
|
||||
Rule,
|
||||
RuleTypedDict,
|
||||
)
|
||||
from .observabilityfilterrulesconfig import (
|
||||
ObservabilityFilterRulesConfig,
|
||||
ObservabilityFilterRulesConfigTypedDict,
|
||||
)
|
||||
from .observabilityfilterrulesconfignullable import (
|
||||
ObservabilityFilterRulesConfigNullable,
|
||||
ObservabilityFilterRulesConfigNullableTypedDict,
|
||||
)
|
||||
from .observabilitygrafanadestination import (
|
||||
ObservabilityGrafanaDestination,
|
||||
ObservabilityGrafanaDestinationConfig,
|
||||
@@ -2375,6 +2397,11 @@ if TYPE_CHECKING:
|
||||
from .routerparams import RouterParams, RouterParamsTypedDict
|
||||
from .routingstrategy import RoutingStrategy
|
||||
from .searchcontextsizeenum import SearchContextSizeEnum
|
||||
from .searchmodelsservertool_openrouter import (
|
||||
SearchModelsServerToolOpenRouter,
|
||||
SearchModelsServerToolOpenRouterType,
|
||||
SearchModelsServerToolOpenRouterTypedDict,
|
||||
)
|
||||
from .searchmodelsservertoolconfig import (
|
||||
SearchModelsServerToolConfig,
|
||||
SearchModelsServerToolConfigTypedDict,
|
||||
@@ -2866,12 +2893,12 @@ __all__ = [
|
||||
"AnthropicCitationPageLocationParam",
|
||||
"AnthropicCitationPageLocationParamType",
|
||||
"AnthropicCitationPageLocationParamTypedDict",
|
||||
"AnthropicCitationSearchResultLocation",
|
||||
"AnthropicCitationSearchResultLocationType",
|
||||
"AnthropicCitationSearchResultLocationTypedDict",
|
||||
"AnthropicCitationWebSearchResultLocation",
|
||||
"AnthropicCitationWebSearchResultLocationType",
|
||||
"AnthropicCitationWebSearchResultLocationTypedDict",
|
||||
"AnthropicCitationSearchResultLocationParam",
|
||||
"AnthropicCitationSearchResultLocationParamType",
|
||||
"AnthropicCitationSearchResultLocationParamTypedDict",
|
||||
"AnthropicCitationWebSearchResultLocationParam",
|
||||
"AnthropicCitationWebSearchResultLocationParamType",
|
||||
"AnthropicCitationWebSearchResultLocationParamTypedDict",
|
||||
"AnthropicCompactionUsageIteration",
|
||||
"AnthropicCompactionUsageIterationType",
|
||||
"AnthropicCompactionUsageIterationTypedDict",
|
||||
@@ -3112,6 +3139,9 @@ __all__ = [
|
||||
"ChatFormatGrammarConfig",
|
||||
"ChatFormatGrammarConfigType",
|
||||
"ChatFormatGrammarConfigTypedDict",
|
||||
"ChatFormatJSONObjectConfig",
|
||||
"ChatFormatJSONObjectConfigType",
|
||||
"ChatFormatJSONObjectConfigTypedDict",
|
||||
"ChatFormatJSONSchemaConfig",
|
||||
"ChatFormatJSONSchemaConfigType",
|
||||
"ChatFormatJSONSchemaConfigTypedDict",
|
||||
@@ -3592,8 +3622,6 @@ __all__ = [
|
||||
"GetPresetVersionResponseTypedDict",
|
||||
"GetWorkspaceResponse",
|
||||
"GetWorkspaceResponseTypedDict",
|
||||
"Group",
|
||||
"GroupTypedDict",
|
||||
"Guardrail",
|
||||
"GuardrailInterval",
|
||||
"GuardrailTypedDict",
|
||||
@@ -3665,6 +3693,7 @@ __all__ = [
|
||||
"ImageGenerationUsagePromptTokensDetails",
|
||||
"ImageGenerationUsagePromptTokensDetailsTypedDict",
|
||||
"ImageGenerationUsageTypedDict",
|
||||
"ImageInputModality",
|
||||
"ImageModelArchitecture",
|
||||
"ImageModelArchitectureTypedDict",
|
||||
"ImageModelEndpointsResponse",
|
||||
@@ -3774,11 +3803,15 @@ __all__ = [
|
||||
"KeyAssignment",
|
||||
"KeyAssignmentTypedDict",
|
||||
"LegacyChatContentVideo",
|
||||
"LegacyChatContentVideoInput",
|
||||
"LegacyChatContentVideoInputTypedDict",
|
||||
"LegacyChatContentVideoType",
|
||||
"LegacyChatContentVideoTypedDict",
|
||||
"LegacyWebSearchServerTool",
|
||||
"LegacyWebSearchServerToolType",
|
||||
"LegacyWebSearchServerToolTypedDict",
|
||||
"Links",
|
||||
"LinksTypedDict",
|
||||
"ListBYOKKeysResponse",
|
||||
"ListBYOKKeysResponseTypedDict",
|
||||
"ListEndpointsResponse",
|
||||
@@ -3869,6 +3902,9 @@ __all__ = [
|
||||
"MessagesRequestToolUnion",
|
||||
"MessagesRequestToolUnionTypedDict",
|
||||
"MessagesRequestTypedDict",
|
||||
"MessagesSearchModelsServerTool",
|
||||
"MessagesSearchModelsServerToolType",
|
||||
"MessagesSearchModelsServerToolTypedDict",
|
||||
"MetadataLevel",
|
||||
"Method",
|
||||
"Modality",
|
||||
@@ -3878,7 +3914,6 @@ __all__ = [
|
||||
"ModeTypedDict",
|
||||
"Model",
|
||||
"ModelArchitecture",
|
||||
"ModelArchitectureInstructType",
|
||||
"ModelArchitectureTypedDict",
|
||||
"ModelBenchmarks",
|
||||
"ModelBenchmarksTypedDict",
|
||||
@@ -3933,10 +3968,14 @@ __all__ = [
|
||||
"ObservabilityDatadogDestinationTypedDict",
|
||||
"ObservabilityDestination",
|
||||
"ObservabilityDestinationTypedDict",
|
||||
"ObservabilityFilterRuleGroup",
|
||||
"ObservabilityFilterRuleGroupTypedDict",
|
||||
"ObservabilityFilterRuleGroupValue",
|
||||
"ObservabilityFilterRuleGroupValueTypedDict",
|
||||
"ObservabilityFilterRulesConfig",
|
||||
"ObservabilityFilterRulesConfigNullable",
|
||||
"ObservabilityFilterRulesConfigNullableTypedDict",
|
||||
"ObservabilityFilterRulesConfigTypedDict",
|
||||
"ObservabilityFilterRulesConfigValue",
|
||||
"ObservabilityFilterRulesConfigValueTypedDict",
|
||||
"ObservabilityGrafanaDestination",
|
||||
"ObservabilityGrafanaDestinationConfig",
|
||||
"ObservabilityGrafanaDestinationConfigTypedDict",
|
||||
@@ -4459,6 +4498,9 @@ __all__ = [
|
||||
"SearchContextSizeEnum",
|
||||
"SearchModelsServerToolConfig",
|
||||
"SearchModelsServerToolConfigTypedDict",
|
||||
"SearchModelsServerToolOpenRouter",
|
||||
"SearchModelsServerToolOpenRouterType",
|
||||
"SearchModelsServerToolOpenRouterTypedDict",
|
||||
"SearchQualityLevel",
|
||||
"Security",
|
||||
"SecurityTypedDict",
|
||||
@@ -4906,12 +4948,12 @@ _dynamic_imports: dict[str, str] = {
|
||||
"AnthropicCitationPageLocationParam": ".anthropiccitationpagelocationparam",
|
||||
"AnthropicCitationPageLocationParamType": ".anthropiccitationpagelocationparam",
|
||||
"AnthropicCitationPageLocationParamTypedDict": ".anthropiccitationpagelocationparam",
|
||||
"AnthropicCitationSearchResultLocation": ".anthropiccitationsearchresultlocation",
|
||||
"AnthropicCitationSearchResultLocationType": ".anthropiccitationsearchresultlocation",
|
||||
"AnthropicCitationSearchResultLocationTypedDict": ".anthropiccitationsearchresultlocation",
|
||||
"AnthropicCitationWebSearchResultLocation": ".anthropiccitationwebsearchresultlocation",
|
||||
"AnthropicCitationWebSearchResultLocationType": ".anthropiccitationwebsearchresultlocation",
|
||||
"AnthropicCitationWebSearchResultLocationTypedDict": ".anthropiccitationwebsearchresultlocation",
|
||||
"AnthropicCitationSearchResultLocationParam": ".anthropiccitationsearchresultlocationparam",
|
||||
"AnthropicCitationSearchResultLocationParamType": ".anthropiccitationsearchresultlocationparam",
|
||||
"AnthropicCitationSearchResultLocationParamTypedDict": ".anthropiccitationsearchresultlocationparam",
|
||||
"AnthropicCitationWebSearchResultLocationParam": ".anthropiccitationwebsearchresultlocationparam",
|
||||
"AnthropicCitationWebSearchResultLocationParamType": ".anthropiccitationwebsearchresultlocationparam",
|
||||
"AnthropicCitationWebSearchResultLocationParamTypedDict": ".anthropiccitationwebsearchresultlocationparam",
|
||||
"AnthropicCompactionUsageIteration": ".anthropiccompactionusageiteration",
|
||||
"AnthropicCompactionUsageIterationType": ".anthropiccompactionusageiteration",
|
||||
"AnthropicCompactionUsageIterationTypedDict": ".anthropiccompactionusageiteration",
|
||||
@@ -5156,6 +5198,9 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ChatFormatGrammarConfig": ".chatformatgrammarconfig",
|
||||
"ChatFormatGrammarConfigType": ".chatformatgrammarconfig",
|
||||
"ChatFormatGrammarConfigTypedDict": ".chatformatgrammarconfig",
|
||||
"ChatFormatJSONObjectConfig": ".chatformatjsonobjectconfig",
|
||||
"ChatFormatJSONObjectConfigType": ".chatformatjsonobjectconfig",
|
||||
"ChatFormatJSONObjectConfigTypedDict": ".chatformatjsonobjectconfig",
|
||||
"ChatFormatJSONSchemaConfig": ".chatformatjsonschemaconfig",
|
||||
"ChatFormatJSONSchemaConfigType": ".chatformatjsonschemaconfig",
|
||||
"ChatFormatJSONSchemaConfigTypedDict": ".chatformatjsonschemaconfig",
|
||||
@@ -5702,6 +5747,7 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ImageGenTextChunkEventPhase": ".imagegentextchunkevent",
|
||||
"ImageGenTextChunkEventType": ".imagegentextchunkevent",
|
||||
"ImageGenTextChunkEventTypedDict": ".imagegentextchunkevent",
|
||||
"ImageInputModality": ".imageinputmodality",
|
||||
"ImageModelArchitecture": ".imagemodelarchitecture",
|
||||
"ImageModelArchitectureTypedDict": ".imagemodelarchitecture",
|
||||
"ImageModelEndpointsResponse": ".imagemodelendpointsresponse",
|
||||
@@ -5799,6 +5845,8 @@ _dynamic_imports: dict[str, str] = {
|
||||
"LegacyChatContentVideo": ".legacy_chatcontentvideo",
|
||||
"LegacyChatContentVideoType": ".legacy_chatcontentvideo",
|
||||
"LegacyChatContentVideoTypedDict": ".legacy_chatcontentvideo",
|
||||
"LegacyChatContentVideoInput": ".legacy_chatcontentvideoinput",
|
||||
"LegacyChatContentVideoInputTypedDict": ".legacy_chatcontentvideoinput",
|
||||
"LegacyWebSearchServerTool": ".legacy_websearchservertool",
|
||||
"LegacyWebSearchServerToolType": ".legacy_websearchservertool",
|
||||
"LegacyWebSearchServerToolTypedDict": ".legacy_websearchservertool",
|
||||
@@ -6018,11 +6066,13 @@ _dynamic_imports: dict[str, str] = {
|
||||
"TypeTool": ".messagesrequest",
|
||||
"TypeWebSearch20250305": ".messagesrequest",
|
||||
"TypeWebSearch20260209": ".messagesrequest",
|
||||
"MessagesSearchModelsServerTool": ".messagessearchmodelsservertool",
|
||||
"MessagesSearchModelsServerToolType": ".messagessearchmodelsservertool",
|
||||
"MessagesSearchModelsServerToolTypedDict": ".messagessearchmodelsservertool",
|
||||
"MetadataLevel": ".metadatalevel",
|
||||
"Model": ".model",
|
||||
"ModelTypedDict": ".model",
|
||||
"ModelArchitecture": ".modelarchitecture",
|
||||
"ModelArchitectureInstructType": ".modelarchitecture",
|
||||
"ModelArchitectureTypedDict": ".modelarchitecture",
|
||||
"ModelBenchmarks": ".modelbenchmarks",
|
||||
"ModelBenchmarksTypedDict": ".modelbenchmarks",
|
||||
@@ -6038,6 +6088,8 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ModelsCountResponseData": ".modelscountresponse",
|
||||
"ModelsCountResponseDataTypedDict": ".modelscountresponse",
|
||||
"ModelsCountResponseTypedDict": ".modelscountresponse",
|
||||
"Links": ".modelslistresponse",
|
||||
"LinksTypedDict": ".modelslistresponse",
|
||||
"ModelsListResponse": ".modelslistresponse",
|
||||
"ModelsListResponseTypedDict": ".modelslistresponse",
|
||||
"ModerationPlugin": ".moderationplugin",
|
||||
@@ -6070,17 +6122,19 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ObservabilityDestination": ".observabilitydestination",
|
||||
"ObservabilityDestinationTypedDict": ".observabilitydestination",
|
||||
"UnknownObservabilityDestination": ".observabilitydestination",
|
||||
"FieldT": ".observabilityfilterrulesconfig",
|
||||
"Group": ".observabilityfilterrulesconfig",
|
||||
"GroupTypedDict": ".observabilityfilterrulesconfig",
|
||||
"Logic": ".observabilityfilterrulesconfig",
|
||||
"FieldT": ".observabilityfilterrulegroup",
|
||||
"Logic": ".observabilityfilterrulegroup",
|
||||
"ObservabilityFilterRuleGroup": ".observabilityfilterrulegroup",
|
||||
"ObservabilityFilterRuleGroupTypedDict": ".observabilityfilterrulegroup",
|
||||
"ObservabilityFilterRuleGroupValue": ".observabilityfilterrulegroup",
|
||||
"ObservabilityFilterRuleGroupValueTypedDict": ".observabilityfilterrulegroup",
|
||||
"Operator": ".observabilityfilterrulegroup",
|
||||
"Rule": ".observabilityfilterrulegroup",
|
||||
"RuleTypedDict": ".observabilityfilterrulegroup",
|
||||
"ObservabilityFilterRulesConfig": ".observabilityfilterrulesconfig",
|
||||
"ObservabilityFilterRulesConfigTypedDict": ".observabilityfilterrulesconfig",
|
||||
"ObservabilityFilterRulesConfigValue": ".observabilityfilterrulesconfig",
|
||||
"ObservabilityFilterRulesConfigValueTypedDict": ".observabilityfilterrulesconfig",
|
||||
"Operator": ".observabilityfilterrulesconfig",
|
||||
"Rule": ".observabilityfilterrulesconfig",
|
||||
"RuleTypedDict": ".observabilityfilterrulesconfig",
|
||||
"ObservabilityFilterRulesConfigNullable": ".observabilityfilterrulesconfignullable",
|
||||
"ObservabilityFilterRulesConfigNullableTypedDict": ".observabilityfilterrulesconfignullable",
|
||||
"ObservabilityGrafanaDestination": ".observabilitygrafanadestination",
|
||||
"ObservabilityGrafanaDestinationConfig": ".observabilitygrafanadestination",
|
||||
"ObservabilityGrafanaDestinationConfigTypedDict": ".observabilitygrafanadestination",
|
||||
@@ -6608,6 +6662,9 @@ _dynamic_imports: dict[str, str] = {
|
||||
"RouterParamsTypedDict": ".routerparams",
|
||||
"RoutingStrategy": ".routingstrategy",
|
||||
"SearchContextSizeEnum": ".searchcontextsizeenum",
|
||||
"SearchModelsServerToolOpenRouter": ".searchmodelsservertool_openrouter",
|
||||
"SearchModelsServerToolOpenRouterType": ".searchmodelsservertool_openrouter",
|
||||
"SearchModelsServerToolOpenRouterTypedDict": ".searchmodelsservertool_openrouter",
|
||||
"SearchModelsServerToolConfig": ".searchmodelsservertoolconfig",
|
||||
"SearchModelsServerToolConfigTypedDict": ".searchmodelsservertoolconfig",
|
||||
"SearchQualityLevel": ".searchqualitylevel",
|
||||
|
||||
@@ -11,10 +11,6 @@ from .applypatchservertool_openrouter import (
|
||||
ApplyPatchServerToolOpenRouterTypedDict,
|
||||
)
|
||||
from .bashservertool import BashServerTool, BashServerToolTypedDict
|
||||
from .chatsearchmodelsservertool import (
|
||||
ChatSearchModelsServerTool,
|
||||
ChatSearchModelsServerToolTypedDict,
|
||||
)
|
||||
from .codeinterpreterservertool import (
|
||||
CodeInterpreterServerTool,
|
||||
CodeInterpreterServerToolTypedDict,
|
||||
@@ -50,6 +46,10 @@ from .preview_websearchservertool import (
|
||||
PreviewWebSearchServerTool,
|
||||
PreviewWebSearchServerToolTypedDict,
|
||||
)
|
||||
from .searchmodelsservertool_openrouter import (
|
||||
SearchModelsServerToolOpenRouter,
|
||||
SearchModelsServerToolOpenRouterTypedDict,
|
||||
)
|
||||
from .shellservertool import ShellServerTool, ShellServerToolTypedDict
|
||||
from .shellservertool_openrouter import (
|
||||
ShellServerToolOpenRouter,
|
||||
@@ -182,7 +182,7 @@ AdditionalToolsItemToolUnionTypedDict = TypeAliasType(
|
||||
ApplyPatchServerToolOpenRouterTypedDict,
|
||||
WebSearchServerToolOpenRouterTypedDict,
|
||||
WebFetchServerToolTypedDict,
|
||||
ChatSearchModelsServerToolTypedDict,
|
||||
SearchModelsServerToolOpenRouterTypedDict,
|
||||
FilesServerToolTypedDict,
|
||||
AdvisorServerToolOpenRouterTypedDict,
|
||||
SubagentServerToolOpenRouterTypedDict,
|
||||
@@ -216,7 +216,7 @@ AdditionalToolsItemToolUnion = TypeAliasType(
|
||||
ApplyPatchServerToolOpenRouter,
|
||||
WebSearchServerToolOpenRouter,
|
||||
WebFetchServerTool,
|
||||
ChatSearchModelsServerTool,
|
||||
SearchModelsServerToolOpenRouter,
|
||||
FilesServerTool,
|
||||
AdvisorServerToolOpenRouter,
|
||||
SubagentServerToolOpenRouter,
|
||||
|
||||
+5
-5
@@ -7,20 +7,20 @@ from typing import Literal
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
AnthropicCitationSearchResultLocationType = Literal["search_result_location",]
|
||||
AnthropicCitationSearchResultLocationParamType = Literal["search_result_location",]
|
||||
|
||||
|
||||
class AnthropicCitationSearchResultLocationTypedDict(TypedDict):
|
||||
class AnthropicCitationSearchResultLocationParamTypedDict(TypedDict):
|
||||
cited_text: str
|
||||
end_block_index: int
|
||||
search_result_index: int
|
||||
source: str
|
||||
start_block_index: int
|
||||
title: Nullable[str]
|
||||
type: AnthropicCitationSearchResultLocationType
|
||||
type: AnthropicCitationSearchResultLocationParamType
|
||||
|
||||
|
||||
class AnthropicCitationSearchResultLocation(BaseModel):
|
||||
class AnthropicCitationSearchResultLocationParam(BaseModel):
|
||||
cited_text: str
|
||||
|
||||
end_block_index: int
|
||||
@@ -33,7 +33,7 @@ class AnthropicCitationSearchResultLocation(BaseModel):
|
||||
|
||||
title: Nullable[str]
|
||||
|
||||
type: AnthropicCitationSearchResultLocationType
|
||||
type: AnthropicCitationSearchResultLocationParamType
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
+7
-5
@@ -7,25 +7,27 @@ from typing import Literal
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
AnthropicCitationWebSearchResultLocationType = Literal["web_search_result_location",]
|
||||
AnthropicCitationWebSearchResultLocationParamType = Literal[
|
||||
"web_search_result_location",
|
||||
]
|
||||
|
||||
|
||||
class AnthropicCitationWebSearchResultLocationTypedDict(TypedDict):
|
||||
class AnthropicCitationWebSearchResultLocationParamTypedDict(TypedDict):
|
||||
cited_text: str
|
||||
encrypted_index: str
|
||||
title: Nullable[str]
|
||||
type: AnthropicCitationWebSearchResultLocationType
|
||||
type: AnthropicCitationWebSearchResultLocationParamType
|
||||
url: str
|
||||
|
||||
|
||||
class AnthropicCitationWebSearchResultLocation(BaseModel):
|
||||
class AnthropicCitationWebSearchResultLocationParam(BaseModel):
|
||||
cited_text: str
|
||||
|
||||
encrypted_index: str
|
||||
|
||||
title: Nullable[str]
|
||||
|
||||
type: AnthropicCitationWebSearchResultLocationType
|
||||
type: AnthropicCitationWebSearchResultLocationParamType
|
||||
|
||||
url: str
|
||||
|
||||
@@ -17,13 +17,13 @@ from .anthropiccitationpagelocationparam import (
|
||||
AnthropicCitationPageLocationParam,
|
||||
AnthropicCitationPageLocationParamTypedDict,
|
||||
)
|
||||
from .anthropiccitationsearchresultlocation import (
|
||||
AnthropicCitationSearchResultLocation,
|
||||
AnthropicCitationSearchResultLocationTypedDict,
|
||||
from .anthropiccitationsearchresultlocationparam import (
|
||||
AnthropicCitationSearchResultLocationParam,
|
||||
AnthropicCitationSearchResultLocationParamTypedDict,
|
||||
)
|
||||
from .anthropiccitationwebsearchresultlocation import (
|
||||
AnthropicCitationWebSearchResultLocation,
|
||||
AnthropicCitationWebSearchResultLocationTypedDict,
|
||||
from .anthropiccitationwebsearchresultlocationparam import (
|
||||
AnthropicCitationWebSearchResultLocationParam,
|
||||
AnthropicCitationWebSearchResultLocationParamTypedDict,
|
||||
)
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
@@ -41,11 +41,11 @@ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
CitationTypedDict = TypeAliasType(
|
||||
"CitationTypedDict",
|
||||
Union[
|
||||
AnthropicCitationWebSearchResultLocationTypedDict,
|
||||
AnthropicCitationWebSearchResultLocationParamTypedDict,
|
||||
AnthropicCitationCharLocationParamTypedDict,
|
||||
AnthropicCitationPageLocationParamTypedDict,
|
||||
AnthropicCitationContentBlockLocationParamTypedDict,
|
||||
AnthropicCitationSearchResultLocationTypedDict,
|
||||
AnthropicCitationSearchResultLocationParamTypedDict,
|
||||
],
|
||||
)
|
||||
|
||||
@@ -57,9 +57,12 @@ Citation = Annotated[
|
||||
AnthropicCitationContentBlockLocationParam, Tag("content_block_location")
|
||||
],
|
||||
Annotated[AnthropicCitationPageLocationParam, Tag("page_location")],
|
||||
Annotated[AnthropicCitationSearchResultLocation, Tag("search_result_location")],
|
||||
Annotated[
|
||||
AnthropicCitationWebSearchResultLocation, Tag("web_search_result_location")
|
||||
AnthropicCitationSearchResultLocationParam, Tag("search_result_location")
|
||||
],
|
||||
Annotated[
|
||||
AnthropicCitationWebSearchResultLocationParam,
|
||||
Tag("web_search_result_location"),
|
||||
],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel
|
||||
from typing import Literal
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
ChatFormatJSONObjectConfigType = Literal["json_object",]
|
||||
|
||||
|
||||
class ChatFormatJSONObjectConfigTypedDict(TypedDict):
|
||||
r"""JSON object response format"""
|
||||
|
||||
type: ChatFormatJSONObjectConfigType
|
||||
|
||||
|
||||
class ChatFormatJSONObjectConfig(BaseModel):
|
||||
r"""JSON object response format"""
|
||||
|
||||
type: ChatFormatJSONObjectConfigType
|
||||
@@ -11,6 +11,10 @@ from .chatformatgrammarconfig import (
|
||||
ChatFormatGrammarConfig,
|
||||
ChatFormatGrammarConfigTypedDict,
|
||||
)
|
||||
from .chatformatjsonobjectconfig import (
|
||||
ChatFormatJSONObjectConfig,
|
||||
ChatFormatJSONObjectConfigTypedDict,
|
||||
)
|
||||
from .chatformatjsonschemaconfig import (
|
||||
ChatFormatJSONSchemaConfig,
|
||||
ChatFormatJSONSchemaConfigTypedDict,
|
||||
@@ -30,10 +34,6 @@ from .contextcompressionplugin import (
|
||||
ContextCompressionPluginTypedDict,
|
||||
)
|
||||
from .fileparserplugin import FileParserPlugin, FileParserPluginTypedDict
|
||||
from .formatjsonobjectconfig import (
|
||||
FormatJSONObjectConfig,
|
||||
FormatJSONObjectConfigTypedDict,
|
||||
)
|
||||
from .fusionplugin import FusionPlugin, FusionPluginTypedDict
|
||||
from .imageconfig import ImageConfig, ImageConfigTypedDict
|
||||
from .moderationplugin import ModerationPlugin, ModerationPluginTypedDict
|
||||
@@ -179,7 +179,7 @@ ResponseFormatTypedDict = TypeAliasType(
|
||||
"ResponseFormatTypedDict",
|
||||
Union[
|
||||
ChatFormatTextConfigTypedDict,
|
||||
FormatJSONObjectConfigTypedDict,
|
||||
ChatFormatJSONObjectConfigTypedDict,
|
||||
ChatFormatPythonConfigTypedDict,
|
||||
ChatFormatJSONSchemaConfigTypedDict,
|
||||
ChatFormatGrammarConfigTypedDict,
|
||||
@@ -191,7 +191,7 @@ r"""Response format configuration"""
|
||||
ResponseFormat = Annotated[
|
||||
Union[
|
||||
Annotated[ChatFormatGrammarConfig, Tag("grammar")],
|
||||
Annotated[FormatJSONObjectConfig, Tag("json_object")],
|
||||
Annotated[ChatFormatJSONObjectConfig, Tag("json_object")],
|
||||
Annotated[ChatFormatJSONSchemaConfig, Tag("json_schema")],
|
||||
Annotated[ChatFormatPythonConfig, Tag("python")],
|
||||
Annotated[ChatFormatTextConfig, Tag("text")],
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .observabilityfilterrulesconfig import (
|
||||
ObservabilityFilterRulesConfig,
|
||||
ObservabilityFilterRulesConfigTypedDict,
|
||||
from .observabilityfilterrulesconfignullable import (
|
||||
ObservabilityFilterRulesConfigNullable,
|
||||
ObservabilityFilterRulesConfigNullableTypedDict,
|
||||
)
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
@@ -54,7 +54,7 @@ class CreateObservabilityDestinationRequestTypedDict(TypedDict):
|
||||
r"""Optional allowlist of OpenRouter API key hashes whose traffic is forwarded. `null` or omitted means all keys. Must contain at least one hash if provided."""
|
||||
enabled: NotRequired[bool]
|
||||
r"""Whether this destination should be enabled immediately."""
|
||||
filter_rules: NotRequired[Nullable[ObservabilityFilterRulesConfigTypedDict]]
|
||||
filter_rules: NotRequired[Nullable[ObservabilityFilterRulesConfigNullableTypedDict]]
|
||||
r"""Optional structured filter rules controlling which events are forwarded."""
|
||||
privacy_mode: NotRequired[bool]
|
||||
r"""When true, request/response bodies are not forwarded — only metadata."""
|
||||
@@ -80,7 +80,7 @@ class CreateObservabilityDestinationRequest(BaseModel):
|
||||
enabled: Optional[bool] = True
|
||||
r"""Whether this destination should be enabled immediately."""
|
||||
|
||||
filter_rules: OptionalNullable[ObservabilityFilterRulesConfig] = UNSET
|
||||
filter_rules: OptionalNullable[ObservabilityFilterRulesConfigNullable] = UNSET
|
||||
r"""Optional structured filter rules controlling which events are forwarded."""
|
||||
|
||||
privacy_mode: Optional[bool] = False
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import UnrecognizedStr
|
||||
from typing import Literal, Union
|
||||
|
||||
|
||||
ImageInputModality = Union[
|
||||
Literal[
|
||||
"text",
|
||||
"image",
|
||||
"file",
|
||||
"audio",
|
||||
"video",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
@@ -1,22 +1,22 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .imageinputmodality import ImageInputModality
|
||||
from .imageoutputmodality import ImageOutputModality
|
||||
from .inputmodality import InputModality
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class ImageModelArchitectureTypedDict(TypedDict):
|
||||
input_modalities: List[InputModality]
|
||||
input_modalities: List[ImageInputModality]
|
||||
r"""Supported input modalities"""
|
||||
output_modalities: List[ImageOutputModality]
|
||||
r"""Supported output modalities"""
|
||||
|
||||
|
||||
class ImageModelArchitecture(BaseModel):
|
||||
input_modalities: List[InputModality]
|
||||
input_modalities: List[ImageInputModality]
|
||||
r"""Supported input modalities"""
|
||||
|
||||
output_modalities: List[ImageOutputModality]
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .chatcontentvideoinput import ChatContentVideoInput, ChatContentVideoInputTypedDict
|
||||
from .legacy_chatcontentvideoinput import (
|
||||
LegacyChatContentVideoInput,
|
||||
LegacyChatContentVideoInputTypedDict,
|
||||
)
|
||||
from openrouter.types import BaseModel
|
||||
from typing import Literal
|
||||
from typing_extensions import TypedDict, deprecated
|
||||
@@ -17,7 +20,7 @@ class LegacyChatContentVideoTypedDict(TypedDict):
|
||||
r"""Video input content part (legacy format - deprecated)"""
|
||||
|
||||
type: LegacyChatContentVideoType
|
||||
video_url: ChatContentVideoInputTypedDict
|
||||
video_url: LegacyChatContentVideoInputTypedDict
|
||||
r"""Video input object"""
|
||||
|
||||
|
||||
@@ -29,5 +32,5 @@ class LegacyChatContentVideo(BaseModel):
|
||||
|
||||
type: LegacyChatContentVideoType
|
||||
|
||||
video_url: ChatContentVideoInput
|
||||
video_url: LegacyChatContentVideoInput
|
||||
r"""Video input object"""
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
"""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 LegacyChatContentVideoInputTypedDict(TypedDict):
|
||||
r"""Video input object"""
|
||||
|
||||
url: str
|
||||
r"""URL of the video (data: URLs supported)"""
|
||||
|
||||
|
||||
class LegacyChatContentVideoInput(BaseModel):
|
||||
r"""Video input object"""
|
||||
|
||||
url: str
|
||||
r"""URL of the video (data: URLs supported)"""
|
||||
@@ -35,10 +35,6 @@ from .anthropicwebsearchtooluserlocation import (
|
||||
)
|
||||
from .autorouterplugin import AutoRouterPlugin, AutoRouterPluginTypedDict
|
||||
from .bashservertool import BashServerTool, BashServerToolTypedDict
|
||||
from .chatsearchmodelsservertool import (
|
||||
ChatSearchModelsServerTool,
|
||||
ChatSearchModelsServerToolTypedDict,
|
||||
)
|
||||
from .contextcompressionplugin import (
|
||||
ContextCompressionPlugin,
|
||||
ContextCompressionPluginTypedDict,
|
||||
@@ -53,6 +49,10 @@ from .imagegenerationservertool_openrouter import (
|
||||
from .messagesfallbackparam import MessagesFallbackParam, MessagesFallbackParamTypedDict
|
||||
from .messagesmessageparam import MessagesMessageParam, MessagesMessageParamTypedDict
|
||||
from .messagesoutputconfig import MessagesOutputConfig, MessagesOutputConfigTypedDict
|
||||
from .messagessearchmodelsservertool import (
|
||||
MessagesSearchModelsServerTool,
|
||||
MessagesSearchModelsServerToolTypedDict,
|
||||
)
|
||||
from .moderationplugin import ModerationPlugin, ModerationPluginTypedDict
|
||||
from .openrouterwebsearchservertool import (
|
||||
OpenRouterWebSearchServerTool,
|
||||
@@ -1070,7 +1070,7 @@ class ToolCustom(BaseModel):
|
||||
MessagesRequestToolUnionTypedDict = TypeAliasType(
|
||||
"MessagesRequestToolUnionTypedDict",
|
||||
Union[
|
||||
ChatSearchModelsServerToolTypedDict,
|
||||
MessagesSearchModelsServerToolTypedDict,
|
||||
BashServerToolTypedDict,
|
||||
DatetimeServerToolTypedDict,
|
||||
ImageGenerationServerToolOpenRouterTypedDict,
|
||||
@@ -1090,7 +1090,7 @@ MessagesRequestToolUnionTypedDict = TypeAliasType(
|
||||
MessagesRequestToolUnion = TypeAliasType(
|
||||
"MessagesRequestToolUnion",
|
||||
Union[
|
||||
ChatSearchModelsServerTool,
|
||||
MessagesSearchModelsServerTool,
|
||||
BashServerTool,
|
||||
DatetimeServerTool,
|
||||
ImageGenerationServerToolOpenRouter,
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .searchmodelsservertoolconfig import (
|
||||
SearchModelsServerToolConfig,
|
||||
SearchModelsServerToolConfigTypedDict,
|
||||
)
|
||||
from openrouter.types import BaseModel, UNSET_SENTINEL
|
||||
from pydantic import model_serializer
|
||||
from typing import Literal, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
MessagesSearchModelsServerToolType = Literal["openrouter:experimental__search_models",]
|
||||
|
||||
|
||||
class MessagesSearchModelsServerToolTypedDict(TypedDict):
|
||||
r"""OpenRouter built-in server tool: searches and filters AI models available on OpenRouter"""
|
||||
|
||||
type: MessagesSearchModelsServerToolType
|
||||
parameters: NotRequired[SearchModelsServerToolConfigTypedDict]
|
||||
r"""Configuration for the openrouter:experimental__search_models server tool"""
|
||||
|
||||
|
||||
class MessagesSearchModelsServerTool(BaseModel):
|
||||
r"""OpenRouter built-in server tool: searches and filters AI models available on OpenRouter"""
|
||||
|
||||
type: MessagesSearchModelsServerToolType
|
||||
|
||||
parameters: Optional[SearchModelsServerToolConfig] = None
|
||||
r"""Configuration for the openrouter:experimental__search_models server tool"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = set(["parameters"])
|
||||
serialized = handler(self)
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k, serialized.get(n))
|
||||
|
||||
if val != UNSET_SENTINEL:
|
||||
if val is not None or k not in optional_fields:
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
from .inputmodality import InputModality
|
||||
from .instructtype import InstructType
|
||||
from .modelgroup import ModelGroup
|
||||
from .outputmodality import OutputModality
|
||||
from openrouter.types import (
|
||||
@@ -10,43 +11,12 @@ from openrouter.types import (
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
UnrecognizedStr,
|
||||
)
|
||||
from pydantic import model_serializer
|
||||
from typing import List, Literal, Optional, Union
|
||||
from typing import List, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
ModelArchitectureInstructType = Union[
|
||||
Literal[
|
||||
"none",
|
||||
"airoboros",
|
||||
"alpaca",
|
||||
"alpaca-modif",
|
||||
"chatml",
|
||||
"claude",
|
||||
"code-llama",
|
||||
"gemma",
|
||||
"llama2",
|
||||
"llama3",
|
||||
"mistral",
|
||||
"nemotron",
|
||||
"neural",
|
||||
"openchat",
|
||||
"phi3",
|
||||
"rwkv",
|
||||
"vicuna",
|
||||
"zephyr",
|
||||
"deepseek-r1",
|
||||
"deepseek-v3.1",
|
||||
"qwq",
|
||||
"qwen3",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Instruction format type"""
|
||||
|
||||
|
||||
class ModelArchitectureTypedDict(TypedDict):
|
||||
r"""Model architecture information"""
|
||||
|
||||
@@ -56,7 +26,7 @@ class ModelArchitectureTypedDict(TypedDict):
|
||||
r"""Primary modality of the model"""
|
||||
output_modalities: List[OutputModality]
|
||||
r"""Supported output modalities"""
|
||||
instruct_type: NotRequired[Nullable[ModelArchitectureInstructType]]
|
||||
instruct_type: NotRequired[Nullable[InstructType]]
|
||||
r"""Instruction format type"""
|
||||
tokenizer: NotRequired[ModelGroup]
|
||||
r"""Tokenizer type used by the model"""
|
||||
@@ -74,7 +44,7 @@ class ModelArchitecture(BaseModel):
|
||||
output_modalities: List[OutputModality]
|
||||
r"""Supported output modalities"""
|
||||
|
||||
instruct_type: OptionalNullable[ModelArchitectureInstructType] = UNSET
|
||||
instruct_type: OptionalNullable[InstructType] = UNSET
|
||||
r"""Instruction format type"""
|
||||
|
||||
tokenizer: Optional[ModelGroup] = None
|
||||
|
||||
@@ -2,16 +2,49 @@
|
||||
|
||||
from __future__ import annotations
|
||||
from .model import Model, ModelTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
|
||||
from pydantic import model_serializer
|
||||
from typing import List
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class LinksTypedDict(TypedDict):
|
||||
r"""Pagination links"""
|
||||
|
||||
next: Nullable[str]
|
||||
r"""URL for the next page of results, or null if this is the last page"""
|
||||
|
||||
|
||||
class Links(BaseModel):
|
||||
r"""Pagination links"""
|
||||
|
||||
next: Nullable[str]
|
||||
r"""URL for the next page of results, or null if this is the last page"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
serialized = handler(self)
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k, serialized.get(n))
|
||||
|
||||
if val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
class ModelsListResponseTypedDict(TypedDict):
|
||||
r"""List of available models"""
|
||||
|
||||
data: List[ModelTypedDict]
|
||||
r"""List of available models"""
|
||||
links: LinksTypedDict
|
||||
r"""Pagination links"""
|
||||
total_count: int
|
||||
r"""Total number of models matching the query"""
|
||||
|
||||
|
||||
class ModelsListResponse(BaseModel):
|
||||
@@ -19,3 +52,9 @@ class ModelsListResponse(BaseModel):
|
||||
|
||||
data: List[Model]
|
||||
r"""List of available models"""
|
||||
|
||||
links: Links
|
||||
r"""Pagination links"""
|
||||
|
||||
total_count: int
|
||||
r"""Total number of models matching the query"""
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr
|
||||
from pydantic import model_serializer
|
||||
from typing import List, Literal, Optional, Union
|
||||
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
Logic = Union[
|
||||
Literal[
|
||||
"and",
|
||||
"or",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
|
||||
FieldT = Union[
|
||||
Literal[
|
||||
"model",
|
||||
"provider",
|
||||
"session_id",
|
||||
"user_id",
|
||||
"api_key_name",
|
||||
"finish_reason",
|
||||
"input",
|
||||
"output",
|
||||
"total_cost",
|
||||
"total_tokens",
|
||||
"prompt_tokens",
|
||||
"completion_tokens",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
|
||||
Operator = Union[
|
||||
Literal[
|
||||
"equals",
|
||||
"not_equals",
|
||||
"contains",
|
||||
"not_contains",
|
||||
"regex",
|
||||
"starts_with",
|
||||
"ends_with",
|
||||
"gt",
|
||||
"lt",
|
||||
"gte",
|
||||
"lte",
|
||||
"exists",
|
||||
"not_exists",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
|
||||
ObservabilityFilterRuleGroupValueTypedDict = TypeAliasType(
|
||||
"ObservabilityFilterRuleGroupValueTypedDict", Union[str, float]
|
||||
)
|
||||
|
||||
|
||||
ObservabilityFilterRuleGroupValue = TypeAliasType(
|
||||
"ObservabilityFilterRuleGroupValue", Union[str, float]
|
||||
)
|
||||
|
||||
|
||||
class RuleTypedDict(TypedDict):
|
||||
field: FieldT
|
||||
operator: Operator
|
||||
value: NotRequired[ObservabilityFilterRuleGroupValueTypedDict]
|
||||
|
||||
|
||||
class Rule(BaseModel):
|
||||
field: FieldT
|
||||
|
||||
operator: Operator
|
||||
|
||||
value: Optional[ObservabilityFilterRuleGroupValue] = None
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = set(["value"])
|
||||
serialized = handler(self)
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k, serialized.get(n))
|
||||
|
||||
if val != UNSET_SENTINEL:
|
||||
if val is not None or k not in optional_fields:
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
class ObservabilityFilterRuleGroupTypedDict(TypedDict):
|
||||
rules: List[RuleTypedDict]
|
||||
logic: NotRequired[Logic]
|
||||
|
||||
|
||||
class ObservabilityFilterRuleGroup(BaseModel):
|
||||
rules: List[Rule]
|
||||
|
||||
logic: Optional[Logic] = "and"
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = set(["logic"])
|
||||
serialized = handler(self)
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k, serialized.get(n))
|
||||
|
||||
if val != UNSET_SENTINEL:
|
||||
if val is not None or k not in optional_fields:
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -1,138 +1,27 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel, UNSET_SENTINEL, UnrecognizedStr
|
||||
from .observabilityfilterrulegroup import (
|
||||
ObservabilityFilterRuleGroup,
|
||||
ObservabilityFilterRuleGroupTypedDict,
|
||||
)
|
||||
from openrouter.types import BaseModel, UNSET_SENTINEL
|
||||
from pydantic import model_serializer
|
||||
from typing import List, Literal, Optional, Union
|
||||
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
Logic = Union[
|
||||
Literal[
|
||||
"and",
|
||||
"or",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
|
||||
FieldT = Union[
|
||||
Literal[
|
||||
"model",
|
||||
"provider",
|
||||
"session_id",
|
||||
"user_id",
|
||||
"api_key_name",
|
||||
"finish_reason",
|
||||
"input",
|
||||
"output",
|
||||
"total_cost",
|
||||
"total_tokens",
|
||||
"prompt_tokens",
|
||||
"completion_tokens",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
|
||||
Operator = Union[
|
||||
Literal[
|
||||
"equals",
|
||||
"not_equals",
|
||||
"contains",
|
||||
"not_contains",
|
||||
"regex",
|
||||
"starts_with",
|
||||
"ends_with",
|
||||
"gt",
|
||||
"lt",
|
||||
"gte",
|
||||
"lte",
|
||||
"exists",
|
||||
"not_exists",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
|
||||
ObservabilityFilterRulesConfigValueTypedDict = TypeAliasType(
|
||||
"ObservabilityFilterRulesConfigValueTypedDict", Union[str, float]
|
||||
)
|
||||
|
||||
|
||||
ObservabilityFilterRulesConfigValue = TypeAliasType(
|
||||
"ObservabilityFilterRulesConfigValue", Union[str, float]
|
||||
)
|
||||
|
||||
|
||||
class RuleTypedDict(TypedDict):
|
||||
field: FieldT
|
||||
operator: Operator
|
||||
value: NotRequired[ObservabilityFilterRulesConfigValueTypedDict]
|
||||
|
||||
|
||||
class Rule(BaseModel):
|
||||
field: FieldT
|
||||
|
||||
operator: Operator
|
||||
|
||||
value: Optional[ObservabilityFilterRulesConfigValue] = None
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = set(["value"])
|
||||
serialized = handler(self)
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k, serialized.get(n))
|
||||
|
||||
if val != UNSET_SENTINEL:
|
||||
if val is not None or k not in optional_fields:
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
class GroupTypedDict(TypedDict):
|
||||
rules: List[RuleTypedDict]
|
||||
logic: NotRequired[Logic]
|
||||
|
||||
|
||||
class Group(BaseModel):
|
||||
rules: List[Rule]
|
||||
|
||||
logic: Optional[Logic] = "and"
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = set(["logic"])
|
||||
serialized = handler(self)
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k, serialized.get(n))
|
||||
|
||||
if val != UNSET_SENTINEL:
|
||||
if val is not None or k not in optional_fields:
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
from typing import List, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class ObservabilityFilterRulesConfigTypedDict(TypedDict):
|
||||
r"""Optional structured filter rules controlling which events are forwarded."""
|
||||
|
||||
groups: List[GroupTypedDict]
|
||||
groups: List[ObservabilityFilterRuleGroupTypedDict]
|
||||
enabled: NotRequired[bool]
|
||||
|
||||
|
||||
class ObservabilityFilterRulesConfig(BaseModel):
|
||||
r"""Optional structured filter rules controlling which events are forwarded."""
|
||||
|
||||
groups: List[Group]
|
||||
groups: List[ObservabilityFilterRuleGroup]
|
||||
|
||||
enabled: Optional[bool] = True
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .observabilityfilterrulegroup import (
|
||||
ObservabilityFilterRuleGroup,
|
||||
ObservabilityFilterRuleGroupTypedDict,
|
||||
)
|
||||
from openrouter.types import BaseModel, UNSET_SENTINEL
|
||||
from pydantic import model_serializer
|
||||
from typing import List, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class ObservabilityFilterRulesConfigNullableTypedDict(TypedDict):
|
||||
r"""Optional structured filter rules controlling which events are forwarded."""
|
||||
|
||||
groups: List[ObservabilityFilterRuleGroupTypedDict]
|
||||
enabled: NotRequired[bool]
|
||||
|
||||
|
||||
class ObservabilityFilterRulesConfigNullable(BaseModel):
|
||||
r"""Optional structured filter rules controlling which events are forwarded."""
|
||||
|
||||
groups: List[ObservabilityFilterRuleGroup]
|
||||
|
||||
enabled: Optional[bool] = True
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = set(["enabled"])
|
||||
serialized = handler(self)
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k, serialized.get(n))
|
||||
|
||||
if val != UNSET_SENTINEL:
|
||||
if val is not None or k not in optional_fields:
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -17,10 +17,6 @@ from .applypatchservertool_openrouter import (
|
||||
from .autorouterplugin import AutoRouterPlugin, AutoRouterPluginTypedDict
|
||||
from .bashservertool import BashServerTool, BashServerToolTypedDict
|
||||
from .chatdebugoptions import ChatDebugOptions, ChatDebugOptionsTypedDict
|
||||
from .chatsearchmodelsservertool import (
|
||||
ChatSearchModelsServerTool,
|
||||
ChatSearchModelsServerToolTypedDict,
|
||||
)
|
||||
from .codeinterpreterservertool import (
|
||||
CodeInterpreterServerTool,
|
||||
CodeInterpreterServerToolTypedDict,
|
||||
@@ -77,6 +73,10 @@ from .providerpreferences import ProviderPreferences, ProviderPreferencesTypedDi
|
||||
from .reasoningconfig import ReasoningConfig, ReasoningConfigTypedDict
|
||||
from .responsehealingplugin import ResponseHealingPlugin, ResponseHealingPluginTypedDict
|
||||
from .responseincludesenum import ResponseIncludesEnum
|
||||
from .searchmodelsservertool_openrouter import (
|
||||
SearchModelsServerToolOpenRouter,
|
||||
SearchModelsServerToolOpenRouterTypedDict,
|
||||
)
|
||||
from .shellservertool import ShellServerTool, ShellServerToolTypedDict
|
||||
from .shellservertool_openrouter import (
|
||||
ShellServerToolOpenRouter,
|
||||
@@ -227,7 +227,7 @@ ResponsesRequestToolUnionTypedDict = TypeAliasType(
|
||||
ApplyPatchServerToolOpenRouterTypedDict,
|
||||
WebSearchServerToolOpenRouterTypedDict,
|
||||
WebFetchServerToolTypedDict,
|
||||
ChatSearchModelsServerToolTypedDict,
|
||||
SearchModelsServerToolOpenRouterTypedDict,
|
||||
FilesServerToolTypedDict,
|
||||
DatetimeServerToolTypedDict,
|
||||
AdvisorServerToolOpenRouterTypedDict,
|
||||
@@ -273,7 +273,8 @@ ResponsesRequestToolUnion = Annotated[
|
||||
ImageGenerationServerToolOpenRouter, Tag("openrouter:image_generation")
|
||||
],
|
||||
Annotated[
|
||||
ChatSearchModelsServerTool, Tag("openrouter:experimental__search_models")
|
||||
SearchModelsServerToolOpenRouter,
|
||||
Tag("openrouter:experimental__search_models"),
|
||||
],
|
||||
Annotated[WebFetchServerTool, Tag("openrouter:web_fetch")],
|
||||
Annotated[WebSearchServerToolOpenRouter, Tag("openrouter:web_search")],
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .searchmodelsservertoolconfig import (
|
||||
SearchModelsServerToolConfig,
|
||||
SearchModelsServerToolConfigTypedDict,
|
||||
)
|
||||
from openrouter.types import BaseModel, UNSET_SENTINEL
|
||||
from pydantic import model_serializer
|
||||
from typing import Literal, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
SearchModelsServerToolOpenRouterType = Literal[
|
||||
"openrouter:experimental__search_models",
|
||||
]
|
||||
|
||||
|
||||
class SearchModelsServerToolOpenRouterTypedDict(TypedDict):
|
||||
r"""OpenRouter built-in server tool: searches and filters AI models available on OpenRouter"""
|
||||
|
||||
type: SearchModelsServerToolOpenRouterType
|
||||
parameters: NotRequired[SearchModelsServerToolConfigTypedDict]
|
||||
r"""Configuration for the openrouter:experimental__search_models server tool"""
|
||||
|
||||
|
||||
class SearchModelsServerToolOpenRouter(BaseModel):
|
||||
r"""OpenRouter built-in server tool: searches and filters AI models available on OpenRouter"""
|
||||
|
||||
type: SearchModelsServerToolOpenRouterType
|
||||
|
||||
parameters: Optional[SearchModelsServerToolConfig] = None
|
||||
r"""Configuration for the openrouter:experimental__search_models server tool"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = set(["parameters"])
|
||||
serialized = handler(self)
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k, serialized.get(n))
|
||||
|
||||
if val != UNSET_SENTINEL:
|
||||
if val is not None or k not in optional_fields:
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -1,9 +1,9 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .observabilityfilterrulesconfig import (
|
||||
ObservabilityFilterRulesConfig,
|
||||
ObservabilityFilterRulesConfigTypedDict,
|
||||
from .observabilityfilterrulesconfignullable import (
|
||||
ObservabilityFilterRulesConfigNullable,
|
||||
ObservabilityFilterRulesConfigNullableTypedDict,
|
||||
)
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
@@ -24,7 +24,7 @@ class UpdateObservabilityDestinationRequestTypedDict(TypedDict):
|
||||
r"""Provider-specific configuration fields to update. Masked values are ignored; unset fields keep their current value."""
|
||||
enabled: NotRequired[bool]
|
||||
r"""Whether the destination is enabled."""
|
||||
filter_rules: NotRequired[Nullable[ObservabilityFilterRulesConfigTypedDict]]
|
||||
filter_rules: NotRequired[Nullable[ObservabilityFilterRulesConfigNullableTypedDict]]
|
||||
name: NotRequired[str]
|
||||
r"""Human-readable name for the destination."""
|
||||
privacy_mode: NotRequired[bool]
|
||||
@@ -43,7 +43,7 @@ class UpdateObservabilityDestinationRequest(BaseModel):
|
||||
enabled: Optional[bool] = None
|
||||
r"""Whether the destination is enabled."""
|
||||
|
||||
filter_rules: OptionalNullable[ObservabilityFilterRulesConfig] = UNSET
|
||||
filter_rules: OptionalNullable[ObservabilityFilterRulesConfigNullable] = UNSET
|
||||
|
||||
name: Optional[str] = None
|
||||
r"""Human-readable name for the destination."""
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
|
||||
from .basesdk import BaseSDK
|
||||
from enum import Enum
|
||||
from jsonpath import JSONPath
|
||||
from openrouter import components, errors, operations, utils
|
||||
from openrouter._hooks import HookContext
|
||||
from openrouter.types import OptionalNullable, UNSET
|
||||
from openrouter.utils import get_security_from_env
|
||||
from openrouter.utils.unmarshal_json_response import unmarshal_json_response
|
||||
from typing import Any, Mapping, Optional, Union
|
||||
from typing import Any, Awaitable, Dict, List, Mapping, Optional, Union
|
||||
|
||||
|
||||
class GenerateAcceptEnum(str, Enum):
|
||||
@@ -432,11 +433,13 @@ class Embeddings(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 500,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> components.ModelsListResponse:
|
||||
) -> Optional[operations.ListEmbeddingsModelsResponse]:
|
||||
r"""List all embeddings models
|
||||
|
||||
Returns a list of all available embeddings models and their properties
|
||||
@@ -448,6 +451,8 @@ class Embeddings(BaseSDK):
|
||||
|
||||
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
:param offset: Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned
|
||||
:param limit: Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -467,6 +472,8 @@ class Embeddings(BaseSDK):
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
offset=offset,
|
||||
limit=limit,
|
||||
)
|
||||
|
||||
req = self._build_request(
|
||||
@@ -520,9 +527,39 @@ class Embeddings(BaseSDK):
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
def next_func() -> Optional[operations.ListEmbeddingsModelsResponse]:
|
||||
body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
|
||||
|
||||
offset = request.offset if isinstance(request.offset, int) else 0
|
||||
|
||||
if not http_res.text:
|
||||
return None
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return None
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 500
|
||||
if len(results[0]) < limit_:
|
||||
return None
|
||||
next_offset = offset + len(results[0])
|
||||
|
||||
return self.list_models(
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
offset=next_offset,
|
||||
limit=limit,
|
||||
retries=retries,
|
||||
server_url=server_url,
|
||||
timeout_ms=timeout_ms,
|
||||
http_headers=http_headers,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(components.ModelsListResponse, http_res)
|
||||
return operations.ListEmbeddingsModelsResponse(
|
||||
result=unmarshal_json_response(components.ModelsListResponse, http_res),
|
||||
next=next_func,
|
||||
)
|
||||
if utils.match_response(http_res, "400", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.BadRequestResponseErrorData, http_res
|
||||
@@ -552,11 +589,13 @@ class Embeddings(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 500,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> components.ModelsListResponse:
|
||||
) -> Optional[operations.ListEmbeddingsModelsResponse]:
|
||||
r"""List all embeddings models
|
||||
|
||||
Returns a list of all available embeddings models and their properties
|
||||
@@ -568,6 +607,8 @@ class Embeddings(BaseSDK):
|
||||
|
||||
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
:param offset: Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned
|
||||
:param limit: Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -587,6 +628,8 @@ class Embeddings(BaseSDK):
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
offset=offset,
|
||||
limit=limit,
|
||||
)
|
||||
|
||||
req = self._build_request_async(
|
||||
@@ -640,9 +683,42 @@ class Embeddings(BaseSDK):
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
def next_func() -> Awaitable[Optional[operations.ListEmbeddingsModelsResponse]]:
|
||||
body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
|
||||
|
||||
async def empty_result():
|
||||
return None
|
||||
|
||||
offset = request.offset if isinstance(request.offset, int) else 0
|
||||
|
||||
if not http_res.text:
|
||||
return empty_result()
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return empty_result()
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 500
|
||||
if len(results[0]) < limit_:
|
||||
return empty_result()
|
||||
next_offset = offset + len(results[0])
|
||||
|
||||
return self.list_models_async(
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
offset=next_offset,
|
||||
limit=limit,
|
||||
retries=retries,
|
||||
server_url=server_url,
|
||||
timeout_ms=timeout_ms,
|
||||
http_headers=http_headers,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(components.ModelsListResponse, http_res)
|
||||
return operations.ListEmbeddingsModelsResponse(
|
||||
result=unmarshal_json_response(components.ModelsListResponse, http_res),
|
||||
next=next_func,
|
||||
)
|
||||
if utils.match_response(http_res, "400", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.BadRequestResponseErrorData, http_res
|
||||
|
||||
@@ -19,8 +19,8 @@ class Guardrails(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
workspace_id: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
@@ -126,7 +126,7 @@ class Guardrails(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return None
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return None
|
||||
next_offset = offset + len(results[0])
|
||||
@@ -181,8 +181,8 @@ class Guardrails(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
workspace_id: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
@@ -291,7 +291,7 @@ class Guardrails(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return empty_result()
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return empty_result()
|
||||
next_offset = offset + len(results[0])
|
||||
@@ -1703,8 +1703,8 @@ class Guardrails(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -1809,7 +1809,7 @@ class Guardrails(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return None
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return None
|
||||
next_offset = offset + len(results[0])
|
||||
@@ -1870,8 +1870,8 @@ class Guardrails(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -1981,7 +1981,7 @@ class Guardrails(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return empty_result()
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return empty_result()
|
||||
next_offset = offset + len(results[0])
|
||||
@@ -2626,8 +2626,8 @@ class Guardrails(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -2732,7 +2732,7 @@ class Guardrails(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return None
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return None
|
||||
next_offset = offset + len(results[0])
|
||||
@@ -2793,8 +2793,8 @@ class Guardrails(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -2904,7 +2904,7 @@ class Guardrails(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return empty_result()
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return empty_result()
|
||||
next_offset = offset + len(results[0])
|
||||
@@ -3552,8 +3552,8 @@ class Guardrails(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -3656,7 +3656,7 @@ class Guardrails(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return None
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return None
|
||||
next_offset = offset + len(results[0])
|
||||
@@ -3710,8 +3710,8 @@ class Guardrails(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -3817,7 +3817,7 @@ class Guardrails(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return empty_result()
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return empty_result()
|
||||
next_offset = offset + len(results[0])
|
||||
@@ -3871,8 +3871,8 @@ class Guardrails(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -3975,7 +3975,7 @@ class Guardrails(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return None
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return None
|
||||
next_offset = offset + len(results[0])
|
||||
@@ -4029,8 +4029,8 @@ class Guardrails(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -4138,7 +4138,7 @@ class Guardrails(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return empty_result()
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return empty_result()
|
||||
next_offset = offset + len(results[0])
|
||||
|
||||
+216
-9
@@ -1,12 +1,13 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from .basesdk import BaseSDK
|
||||
from jsonpath import JSONPath
|
||||
from openrouter import components, errors, operations, utils
|
||||
from openrouter._hooks import HookContext
|
||||
from openrouter.types import OptionalNullable, UNSET
|
||||
from openrouter.utils import get_security_from_env
|
||||
from openrouter.utils.unmarshal_json_response import unmarshal_json_response
|
||||
from typing import Any, Mapping, Optional, Union
|
||||
from typing import Any, Awaitable, Dict, List, Mapping, Optional, Union
|
||||
|
||||
|
||||
class Models(BaseSDK):
|
||||
@@ -270,6 +271,8 @@ class Models(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 500,
|
||||
category: Optional[operations.GetModelsCategory] = None,
|
||||
supported_parameters: Optional[str] = None,
|
||||
output_modalities: Optional[str] = None,
|
||||
@@ -301,7 +304,7 @@ class Models(BaseSDK):
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> components.ModelsListResponse:
|
||||
) -> Optional[operations.GetModelsResponse]:
|
||||
r"""List all models and their properties
|
||||
|
||||
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
@@ -311,6 +314,8 @@ class Models(BaseSDK):
|
||||
|
||||
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
:param offset: Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned
|
||||
:param limit: Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned
|
||||
:param category: Filter models by use case category
|
||||
:param supported_parameters: Filter models by supported parameter (comma-separated)
|
||||
:param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\".
|
||||
@@ -357,6 +362,8 @@ class Models(BaseSDK):
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
offset=offset,
|
||||
limit=limit,
|
||||
category=category,
|
||||
supported_parameters=supported_parameters,
|
||||
output_modalities=output_modalities,
|
||||
@@ -437,9 +444,66 @@ class Models(BaseSDK):
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
def next_func() -> Optional[operations.GetModelsResponse]:
|
||||
body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
|
||||
|
||||
offset = request.offset if isinstance(request.offset, int) else 0
|
||||
|
||||
if not http_res.text:
|
||||
return None
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return None
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 500
|
||||
if len(results[0]) < limit_:
|
||||
return None
|
||||
next_offset = offset + len(results[0])
|
||||
|
||||
return self.list(
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
offset=next_offset,
|
||||
limit=limit,
|
||||
category=category,
|
||||
supported_parameters=supported_parameters,
|
||||
output_modalities=output_modalities,
|
||||
sort=sort,
|
||||
q=q,
|
||||
input_modalities=input_modalities,
|
||||
context=context,
|
||||
min_price=min_price,
|
||||
max_price=max_price,
|
||||
arch=arch,
|
||||
model_authors=model_authors,
|
||||
providers=providers,
|
||||
distillable=distillable,
|
||||
zdr=zdr,
|
||||
region=region,
|
||||
min_output_price=min_output_price,
|
||||
max_output_price=max_output_price,
|
||||
min_age_days=min_age_days,
|
||||
max_age_days=max_age_days,
|
||||
min_intelligence_index=min_intelligence_index,
|
||||
max_intelligence_index=max_intelligence_index,
|
||||
min_coding_index=min_coding_index,
|
||||
max_coding_index=max_coding_index,
|
||||
min_agentic_index=min_agentic_index,
|
||||
max_agentic_index=max_agentic_index,
|
||||
min_tool_success_rate=min_tool_success_rate,
|
||||
max_tool_success_rate=max_tool_success_rate,
|
||||
retries=retries,
|
||||
server_url=server_url,
|
||||
timeout_ms=timeout_ms,
|
||||
http_headers=http_headers,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(components.ModelsListResponse, http_res)
|
||||
return operations.GetModelsResponse(
|
||||
result=unmarshal_json_response(components.ModelsListResponse, http_res),
|
||||
next=next_func,
|
||||
)
|
||||
if utils.match_response(http_res, "400", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.BadRequestResponseErrorData, http_res
|
||||
@@ -469,6 +533,8 @@ class Models(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 500,
|
||||
category: Optional[operations.GetModelsCategory] = None,
|
||||
supported_parameters: Optional[str] = None,
|
||||
output_modalities: Optional[str] = None,
|
||||
@@ -500,7 +566,7 @@ class Models(BaseSDK):
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> components.ModelsListResponse:
|
||||
) -> Optional[operations.GetModelsResponse]:
|
||||
r"""List all models and their properties
|
||||
|
||||
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
||||
@@ -510,6 +576,8 @@ class Models(BaseSDK):
|
||||
|
||||
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
:param offset: Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned
|
||||
:param limit: Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned
|
||||
:param category: Filter models by use case category
|
||||
:param supported_parameters: Filter models by supported parameter (comma-separated)
|
||||
:param output_modalities: Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\".
|
||||
@@ -556,6 +624,8 @@ class Models(BaseSDK):
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
offset=offset,
|
||||
limit=limit,
|
||||
category=category,
|
||||
supported_parameters=supported_parameters,
|
||||
output_modalities=output_modalities,
|
||||
@@ -636,9 +706,69 @@ class Models(BaseSDK):
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
def next_func() -> Awaitable[Optional[operations.GetModelsResponse]]:
|
||||
body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
|
||||
|
||||
async def empty_result():
|
||||
return None
|
||||
|
||||
offset = request.offset if isinstance(request.offset, int) else 0
|
||||
|
||||
if not http_res.text:
|
||||
return empty_result()
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return empty_result()
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 500
|
||||
if len(results[0]) < limit_:
|
||||
return empty_result()
|
||||
next_offset = offset + len(results[0])
|
||||
|
||||
return self.list_async(
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
offset=next_offset,
|
||||
limit=limit,
|
||||
category=category,
|
||||
supported_parameters=supported_parameters,
|
||||
output_modalities=output_modalities,
|
||||
sort=sort,
|
||||
q=q,
|
||||
input_modalities=input_modalities,
|
||||
context=context,
|
||||
min_price=min_price,
|
||||
max_price=max_price,
|
||||
arch=arch,
|
||||
model_authors=model_authors,
|
||||
providers=providers,
|
||||
distillable=distillable,
|
||||
zdr=zdr,
|
||||
region=region,
|
||||
min_output_price=min_output_price,
|
||||
max_output_price=max_output_price,
|
||||
min_age_days=min_age_days,
|
||||
max_age_days=max_age_days,
|
||||
min_intelligence_index=min_intelligence_index,
|
||||
max_intelligence_index=max_intelligence_index,
|
||||
min_coding_index=min_coding_index,
|
||||
max_coding_index=max_coding_index,
|
||||
min_agentic_index=min_agentic_index,
|
||||
max_agentic_index=max_agentic_index,
|
||||
min_tool_success_rate=min_tool_success_rate,
|
||||
max_tool_success_rate=max_tool_success_rate,
|
||||
retries=retries,
|
||||
server_url=server_url,
|
||||
timeout_ms=timeout_ms,
|
||||
http_headers=http_headers,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(components.ModelsListResponse, http_res)
|
||||
return operations.GetModelsResponse(
|
||||
result=unmarshal_json_response(components.ModelsListResponse, http_res),
|
||||
next=next_func,
|
||||
)
|
||||
if utils.match_response(http_res, "400", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.BadRequestResponseErrorData, http_res
|
||||
@@ -914,11 +1044,13 @@ class Models(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 500,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> components.ModelsListResponse:
|
||||
) -> Optional[operations.ListModelsUserResponse]:
|
||||
r"""List models filtered by user provider preferences, privacy settings, and guardrails
|
||||
|
||||
List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/provider-logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region routing](https://openrouter.ai/docs/guides/privacy/provider-logging#enterprise-eu-in-region-routing).
|
||||
@@ -931,6 +1063,8 @@ class Models(BaseSDK):
|
||||
|
||||
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
:param offset: Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned
|
||||
:param limit: Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -950,6 +1084,8 @@ class Models(BaseSDK):
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
offset=offset,
|
||||
limit=limit,
|
||||
)
|
||||
|
||||
req = self._build_request(
|
||||
@@ -1003,9 +1139,40 @@ class Models(BaseSDK):
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
def next_func() -> Optional[operations.ListModelsUserResponse]:
|
||||
body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
|
||||
|
||||
offset = request.offset if isinstance(request.offset, int) else 0
|
||||
|
||||
if not http_res.text:
|
||||
return None
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return None
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 500
|
||||
if len(results[0]) < limit_:
|
||||
return None
|
||||
next_offset = offset + len(results[0])
|
||||
|
||||
return self.list_for_user(
|
||||
security=security,
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
offset=next_offset,
|
||||
limit=limit,
|
||||
retries=retries,
|
||||
server_url=server_url,
|
||||
timeout_ms=timeout_ms,
|
||||
http_headers=http_headers,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(components.ModelsListResponse, http_res)
|
||||
return operations.ListModelsUserResponse(
|
||||
result=unmarshal_json_response(components.ModelsListResponse, http_res),
|
||||
next=next_func,
|
||||
)
|
||||
if utils.match_response(http_res, "401", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.UnauthorizedResponseErrorData, http_res
|
||||
@@ -1044,11 +1211,13 @@ class Models(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 500,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
http_headers: Optional[Mapping[str, str]] = None,
|
||||
) -> components.ModelsListResponse:
|
||||
) -> Optional[operations.ListModelsUserResponse]:
|
||||
r"""List models filtered by user provider preferences, privacy settings, and guardrails
|
||||
|
||||
List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/provider-logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region routing](https://openrouter.ai/docs/guides/privacy/provider-logging#enterprise-eu-in-region-routing).
|
||||
@@ -1061,6 +1230,8 @@ class Models(BaseSDK):
|
||||
|
||||
:param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
:param offset: Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned
|
||||
:param limit: Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned
|
||||
:param retries: Override the default retry configuration for this method
|
||||
:param server_url: Override the default server URL for this method
|
||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||
@@ -1080,6 +1251,8 @@ class Models(BaseSDK):
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
offset=offset,
|
||||
limit=limit,
|
||||
)
|
||||
|
||||
req = self._build_request_async(
|
||||
@@ -1133,9 +1306,43 @@ class Models(BaseSDK):
|
||||
retry_config=retry_config,
|
||||
)
|
||||
|
||||
def next_func() -> Awaitable[Optional[operations.ListModelsUserResponse]]:
|
||||
body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
|
||||
|
||||
async def empty_result():
|
||||
return None
|
||||
|
||||
offset = request.offset if isinstance(request.offset, int) else 0
|
||||
|
||||
if not http_res.text:
|
||||
return empty_result()
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return empty_result()
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 500
|
||||
if len(results[0]) < limit_:
|
||||
return empty_result()
|
||||
next_offset = offset + len(results[0])
|
||||
|
||||
return self.list_for_user_async(
|
||||
security=security,
|
||||
http_referer=http_referer,
|
||||
x_open_router_title=x_open_router_title,
|
||||
x_open_router_categories=x_open_router_categories,
|
||||
offset=next_offset,
|
||||
limit=limit,
|
||||
retries=retries,
|
||||
server_url=server_url,
|
||||
timeout_ms=timeout_ms,
|
||||
http_headers=http_headers,
|
||||
)
|
||||
|
||||
response_data: Any = None
|
||||
if utils.match_response(http_res, "200", "application/json"):
|
||||
return unmarshal_json_response(components.ModelsListResponse, http_res)
|
||||
return operations.ListModelsUserResponse(
|
||||
result=unmarshal_json_response(components.ModelsListResponse, http_res),
|
||||
next=next_func,
|
||||
)
|
||||
if utils.match_response(http_res, "401", "application/json"):
|
||||
response_data = unmarshal_json_response(
|
||||
errors.UnauthorizedResponseErrorData, http_res
|
||||
|
||||
@@ -19,8 +19,8 @@ class Observability(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
workspace_id: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
@@ -126,7 +126,7 @@ class Observability(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return None
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return None
|
||||
next_offset = offset + len(results[0])
|
||||
@@ -181,8 +181,8 @@ class Observability(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
workspace_id: Optional[str] = None,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
@@ -293,7 +293,7 @@ class Observability(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return empty_result()
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return empty_result()
|
||||
next_offset = offset + len(results[0])
|
||||
@@ -355,8 +355,8 @@ class Observability(BaseSDK):
|
||||
enabled: Optional[bool] = True,
|
||||
filter_rules: OptionalNullable[
|
||||
Union[
|
||||
components.ObservabilityFilterRulesConfig,
|
||||
components.ObservabilityFilterRulesConfigTypedDict,
|
||||
components.ObservabilityFilterRulesConfigNullable,
|
||||
components.ObservabilityFilterRulesConfigNullableTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
privacy_mode: Optional[bool] = False,
|
||||
@@ -414,7 +414,7 @@ class Observability(BaseSDK):
|
||||
enabled=enabled,
|
||||
filter_rules=utils.get_pydantic_model(
|
||||
filter_rules,
|
||||
OptionalNullable[components.ObservabilityFilterRulesConfig],
|
||||
OptionalNullable[components.ObservabilityFilterRulesConfigNullable],
|
||||
),
|
||||
name=name,
|
||||
privacy_mode=privacy_mode,
|
||||
@@ -538,8 +538,8 @@ class Observability(BaseSDK):
|
||||
enabled: Optional[bool] = True,
|
||||
filter_rules: OptionalNullable[
|
||||
Union[
|
||||
components.ObservabilityFilterRulesConfig,
|
||||
components.ObservabilityFilterRulesConfigTypedDict,
|
||||
components.ObservabilityFilterRulesConfigNullable,
|
||||
components.ObservabilityFilterRulesConfigNullableTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
privacy_mode: Optional[bool] = False,
|
||||
@@ -597,7 +597,7 @@ class Observability(BaseSDK):
|
||||
enabled=enabled,
|
||||
filter_rules=utils.get_pydantic_model(
|
||||
filter_rules,
|
||||
OptionalNullable[components.ObservabilityFilterRulesConfig],
|
||||
OptionalNullable[components.ObservabilityFilterRulesConfigNullable],
|
||||
),
|
||||
name=name,
|
||||
privacy_mode=privacy_mode,
|
||||
@@ -1240,8 +1240,8 @@ class Observability(BaseSDK):
|
||||
enabled: Optional[bool] = None,
|
||||
filter_rules: OptionalNullable[
|
||||
Union[
|
||||
components.ObservabilityFilterRulesConfig,
|
||||
components.ObservabilityFilterRulesConfigTypedDict,
|
||||
components.ObservabilityFilterRulesConfigNullable,
|
||||
components.ObservabilityFilterRulesConfigNullableTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
name: Optional[str] = None,
|
||||
@@ -1299,7 +1299,7 @@ class Observability(BaseSDK):
|
||||
enabled=enabled,
|
||||
filter_rules=utils.get_pydantic_model(
|
||||
filter_rules,
|
||||
OptionalNullable[components.ObservabilityFilterRulesConfig],
|
||||
OptionalNullable[components.ObservabilityFilterRulesConfigNullable],
|
||||
),
|
||||
name=name,
|
||||
privacy_mode=privacy_mode,
|
||||
@@ -1420,8 +1420,8 @@ class Observability(BaseSDK):
|
||||
enabled: Optional[bool] = None,
|
||||
filter_rules: OptionalNullable[
|
||||
Union[
|
||||
components.ObservabilityFilterRulesConfig,
|
||||
components.ObservabilityFilterRulesConfigTypedDict,
|
||||
components.ObservabilityFilterRulesConfigNullable,
|
||||
components.ObservabilityFilterRulesConfigNullableTypedDict,
|
||||
]
|
||||
] = UNSET,
|
||||
name: Optional[str] = None,
|
||||
@@ -1479,7 +1479,7 @@ class Observability(BaseSDK):
|
||||
enabled=enabled,
|
||||
filter_rules=utils.get_pydantic_model(
|
||||
filter_rules,
|
||||
OptionalNullable[components.ObservabilityFilterRulesConfig],
|
||||
OptionalNullable[components.ObservabilityFilterRulesConfigNullable],
|
||||
),
|
||||
name=name,
|
||||
privacy_mode=privacy_mode,
|
||||
|
||||
@@ -92,8 +92,6 @@ if TYPE_CHECKING:
|
||||
ContentText,
|
||||
ContentTextTypedDict,
|
||||
ContentTypedDict,
|
||||
CostDetails,
|
||||
CostDetailsTypedDict,
|
||||
CreateEmbeddingsData,
|
||||
CreateEmbeddingsDataTypedDict,
|
||||
CreateEmbeddingsGlobals,
|
||||
@@ -389,6 +387,8 @@ if TYPE_CHECKING:
|
||||
GetModelsGlobalsTypedDict,
|
||||
GetModelsRequest,
|
||||
GetModelsRequestTypedDict,
|
||||
GetModelsResponse,
|
||||
GetModelsResponseTypedDict,
|
||||
GetModelsSort,
|
||||
Region,
|
||||
Zdr,
|
||||
@@ -471,6 +471,8 @@ if TYPE_CHECKING:
|
||||
ListEmbeddingsModelsGlobalsTypedDict,
|
||||
ListEmbeddingsModelsRequest,
|
||||
ListEmbeddingsModelsRequestTypedDict,
|
||||
ListEmbeddingsModelsResponse,
|
||||
ListEmbeddingsModelsResponseTypedDict,
|
||||
)
|
||||
from .listendpoints import (
|
||||
ListEndpointsGlobals,
|
||||
@@ -565,6 +567,8 @@ if TYPE_CHECKING:
|
||||
ListModelsUserGlobalsTypedDict,
|
||||
ListModelsUserRequest,
|
||||
ListModelsUserRequestTypedDict,
|
||||
ListModelsUserResponse,
|
||||
ListModelsUserResponseTypedDict,
|
||||
ListModelsUserSecurity,
|
||||
ListModelsUserSecurityTypedDict,
|
||||
)
|
||||
@@ -797,8 +801,6 @@ __all__ = [
|
||||
"ContentTextTypedDict",
|
||||
"ContentTypedDict",
|
||||
"ContextBucket",
|
||||
"CostDetails",
|
||||
"CostDetailsTypedDict",
|
||||
"CreateAudioSpeechGlobals",
|
||||
"CreateAudioSpeechGlobalsTypedDict",
|
||||
"CreateAudioSpeechRequest",
|
||||
@@ -1036,6 +1038,8 @@ __all__ = [
|
||||
"GetModelsGlobalsTypedDict",
|
||||
"GetModelsRequest",
|
||||
"GetModelsRequestTypedDict",
|
||||
"GetModelsResponse",
|
||||
"GetModelsResponseTypedDict",
|
||||
"GetModelsSort",
|
||||
"GetObservabilityDestinationGlobals",
|
||||
"GetObservabilityDestinationGlobalsTypedDict",
|
||||
@@ -1093,6 +1097,8 @@ __all__ = [
|
||||
"ListEmbeddingsModelsGlobalsTypedDict",
|
||||
"ListEmbeddingsModelsRequest",
|
||||
"ListEmbeddingsModelsRequestTypedDict",
|
||||
"ListEmbeddingsModelsResponse",
|
||||
"ListEmbeddingsModelsResponseTypedDict",
|
||||
"ListEndpointsGlobals",
|
||||
"ListEndpointsGlobalsTypedDict",
|
||||
"ListEndpointsRequest",
|
||||
@@ -1163,6 +1169,8 @@ __all__ = [
|
||||
"ListModelsUserGlobalsTypedDict",
|
||||
"ListModelsUserRequest",
|
||||
"ListModelsUserRequestTypedDict",
|
||||
"ListModelsUserResponse",
|
||||
"ListModelsUserResponseTypedDict",
|
||||
"ListModelsUserSecurity",
|
||||
"ListModelsUserSecurityTypedDict",
|
||||
"ListObservabilityDestinationsGlobals",
|
||||
@@ -1398,8 +1406,6 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ContentText": ".createembeddings",
|
||||
"ContentTextTypedDict": ".createembeddings",
|
||||
"ContentTypedDict": ".createembeddings",
|
||||
"CostDetails": ".createembeddings",
|
||||
"CostDetailsTypedDict": ".createembeddings",
|
||||
"CreateEmbeddingsData": ".createembeddings",
|
||||
"CreateEmbeddingsDataTypedDict": ".createembeddings",
|
||||
"CreateEmbeddingsGlobals": ".createembeddings",
|
||||
@@ -1631,6 +1637,8 @@ _dynamic_imports: dict[str, str] = {
|
||||
"GetModelsGlobalsTypedDict": ".getmodels",
|
||||
"GetModelsRequest": ".getmodels",
|
||||
"GetModelsRequestTypedDict": ".getmodels",
|
||||
"GetModelsResponse": ".getmodels",
|
||||
"GetModelsResponseTypedDict": ".getmodels",
|
||||
"GetModelsSort": ".getmodels",
|
||||
"Region": ".getmodels",
|
||||
"Zdr": ".getmodels",
|
||||
@@ -1691,6 +1699,8 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ListEmbeddingsModelsGlobalsTypedDict": ".listembeddingsmodels",
|
||||
"ListEmbeddingsModelsRequest": ".listembeddingsmodels",
|
||||
"ListEmbeddingsModelsRequestTypedDict": ".listembeddingsmodels",
|
||||
"ListEmbeddingsModelsResponse": ".listembeddingsmodels",
|
||||
"ListEmbeddingsModelsResponseTypedDict": ".listembeddingsmodels",
|
||||
"ListEndpointsGlobals": ".listendpoints",
|
||||
"ListEndpointsGlobalsTypedDict": ".listendpoints",
|
||||
"ListEndpointsRequest": ".listendpoints",
|
||||
@@ -1759,6 +1769,8 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ListModelsUserGlobalsTypedDict": ".listmodelsuser",
|
||||
"ListModelsUserRequest": ".listmodelsuser",
|
||||
"ListModelsUserRequestTypedDict": ".listmodelsuser",
|
||||
"ListModelsUserResponse": ".listmodelsuser",
|
||||
"ListModelsUserResponseTypedDict": ".listmodelsuser",
|
||||
"ListModelsUserSecurity": ".listmodelsuser",
|
||||
"ListModelsUserSecurityTypedDict": ".listmodelsuser",
|
||||
"ListObservabilityDestinationsGlobals": ".listobservabilitydestinations",
|
||||
|
||||
@@ -5,6 +5,7 @@ from openrouter.components import (
|
||||
contentpartinputaudio as components_contentpartinputaudio,
|
||||
contentpartinputfile as components_contentpartinputfile,
|
||||
contentpartinputvideo as components_contentpartinputvideo,
|
||||
costdetails as components_costdetails,
|
||||
providerpreferences as components_providerpreferences,
|
||||
)
|
||||
from openrouter.types import (
|
||||
@@ -383,49 +384,6 @@ class CreateEmbeddingsData(BaseModel):
|
||||
Object = Literal["list",]
|
||||
|
||||
|
||||
class CostDetailsTypedDict(TypedDict):
|
||||
r"""Breakdown of upstream inference costs"""
|
||||
|
||||
upstream_inference_completions_cost: float
|
||||
upstream_inference_prompt_cost: float
|
||||
upstream_inference_cost: NotRequired[Nullable[float]]
|
||||
|
||||
|
||||
class CostDetails(BaseModel):
|
||||
r"""Breakdown of upstream inference costs"""
|
||||
|
||||
upstream_inference_completions_cost: float
|
||||
|
||||
upstream_inference_prompt_cost: float
|
||||
|
||||
upstream_inference_cost: OptionalNullable[float] = UNSET
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = set(["upstream_inference_cost"])
|
||||
nullable_fields = set(["upstream_inference_cost"])
|
||||
serialized = handler(self)
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k, serialized.get(n))
|
||||
is_nullable_and_explicitly_set = (
|
||||
k in nullable_fields
|
||||
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
||||
)
|
||||
|
||||
if val != UNSET_SENTINEL:
|
||||
if (
|
||||
val is not None
|
||||
or k not in optional_fields
|
||||
or is_nullable_and_explicitly_set
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
class PromptTokensDetailsTypedDict(TypedDict):
|
||||
r"""Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included."""
|
||||
|
||||
@@ -493,7 +451,7 @@ class CreateEmbeddingsUsageTypedDict(TypedDict):
|
||||
r"""Total number of tokens used"""
|
||||
cost: NotRequired[float]
|
||||
r"""Cost of the request in credits"""
|
||||
cost_details: NotRequired[Nullable[CostDetailsTypedDict]]
|
||||
cost_details: NotRequired[Nullable[components_costdetails.CostDetailsTypedDict]]
|
||||
r"""Breakdown of upstream inference costs"""
|
||||
is_byok: NotRequired[bool]
|
||||
r"""Whether a request was made using a Bring Your Own Key configuration"""
|
||||
@@ -513,7 +471,7 @@ class CreateEmbeddingsUsage(BaseModel):
|
||||
cost: Optional[float] = None
|
||||
r"""Cost of the request in credits"""
|
||||
|
||||
cost_details: OptionalNullable[CostDetails] = UNSET
|
||||
cost_details: OptionalNullable[components_costdetails.CostDetails] = UNSET
|
||||
r"""Breakdown of upstream inference costs"""
|
||||
|
||||
is_byok: Optional[bool] = None
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.components import modelslistresponse as components_modelslistresponse
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
@@ -12,7 +13,7 @@ from openrouter.types import (
|
||||
from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata
|
||||
import pydantic
|
||||
from pydantic import model_serializer
|
||||
from typing import Literal, Optional, Union
|
||||
from typing import Awaitable, Callable, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
@@ -152,6 +153,10 @@ class GetModelsRequestTypedDict(TypedDict):
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
offset: NotRequired[int]
|
||||
r"""Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned"""
|
||||
limit: NotRequired[int]
|
||||
r"""Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned"""
|
||||
category: NotRequired[GetModelsCategory]
|
||||
r"""Filter models by use case category"""
|
||||
supported_parameters: NotRequired[str]
|
||||
@@ -237,6 +242,18 @@ class GetModelsRequest(BaseModel):
|
||||
|
||||
"""
|
||||
|
||||
offset: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = 0
|
||||
r"""Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned"""
|
||||
|
||||
limit: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = 500
|
||||
r"""Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned"""
|
||||
|
||||
category: Annotated[
|
||||
Optional[GetModelsCategory],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
@@ -406,6 +423,8 @@ class GetModelsRequest(BaseModel):
|
||||
"HTTP-Referer",
|
||||
"X-OpenRouter-Title",
|
||||
"X-OpenRouter-Categories",
|
||||
"offset",
|
||||
"limit",
|
||||
"category",
|
||||
"supported_parameters",
|
||||
"output_modalities",
|
||||
@@ -473,3 +492,16 @@ class GetModelsRequest(BaseModel):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
class GetModelsResponseTypedDict(TypedDict):
|
||||
result: components_modelslistresponse.ModelsListResponseTypedDict
|
||||
|
||||
|
||||
class GetModelsResponse(BaseModel):
|
||||
next: Union[
|
||||
Callable[[], Optional[GetModelsResponse]],
|
||||
Callable[[], Awaitable[Optional[GetModelsResponse]]],
|
||||
]
|
||||
|
||||
result: components_modelslistresponse.ModelsListResponse
|
||||
|
||||
@@ -230,13 +230,13 @@ class ListBYOKKeysRequest(BaseModel):
|
||||
offset: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 0
|
||||
r"""Number of records to skip for pagination"""
|
||||
|
||||
limit: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 50
|
||||
r"""Maximum number of records to return (max 100)"""
|
||||
|
||||
workspace_id: Annotated[
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.components import modelslistresponse as components_modelslistresponse
|
||||
from openrouter.types import BaseModel, UNSET_SENTINEL
|
||||
from openrouter.utils import FieldMetadata, HeaderMetadata
|
||||
from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata
|
||||
import pydantic
|
||||
from pydantic import model_serializer
|
||||
from typing import Optional
|
||||
from typing import Awaitable, Callable, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
@@ -87,6 +88,10 @@ class ListEmbeddingsModelsRequestTypedDict(TypedDict):
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
offset: NotRequired[int]
|
||||
r"""Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned"""
|
||||
limit: NotRequired[int]
|
||||
r"""Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned"""
|
||||
|
||||
|
||||
class ListEmbeddingsModelsRequest(BaseModel):
|
||||
@@ -118,10 +123,28 @@ class ListEmbeddingsModelsRequest(BaseModel):
|
||||
|
||||
"""
|
||||
|
||||
offset: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = 0
|
||||
r"""Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned"""
|
||||
|
||||
limit: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = 500
|
||||
r"""Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = set(
|
||||
["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"]
|
||||
[
|
||||
"HTTP-Referer",
|
||||
"X-OpenRouter-Title",
|
||||
"X-OpenRouter-Categories",
|
||||
"offset",
|
||||
"limit",
|
||||
]
|
||||
)
|
||||
serialized = handler(self)
|
||||
m = {}
|
||||
@@ -135,3 +158,16 @@ class ListEmbeddingsModelsRequest(BaseModel):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
class ListEmbeddingsModelsResponseTypedDict(TypedDict):
|
||||
result: components_modelslistresponse.ModelsListResponseTypedDict
|
||||
|
||||
|
||||
class ListEmbeddingsModelsResponse(BaseModel):
|
||||
next: Union[
|
||||
Callable[[], Optional[ListEmbeddingsModelsResponse]],
|
||||
Callable[[], Awaitable[Optional[ListEmbeddingsModelsResponse]]],
|
||||
]
|
||||
|
||||
result: components_modelslistresponse.ModelsListResponse
|
||||
|
||||
@@ -140,13 +140,13 @@ class ListGuardrailKeyAssignmentsRequest(BaseModel):
|
||||
offset: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 0
|
||||
r"""Number of records to skip for pagination"""
|
||||
|
||||
limit: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 50
|
||||
r"""Maximum number of records to return (max 100)"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
|
||||
@@ -140,13 +140,13 @@ class ListGuardrailMemberAssignmentsRequest(BaseModel):
|
||||
offset: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 0
|
||||
r"""Number of records to skip for pagination"""
|
||||
|
||||
limit: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 50
|
||||
r"""Maximum number of records to return (max 100)"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
|
||||
@@ -130,13 +130,13 @@ class ListGuardrailsRequest(BaseModel):
|
||||
offset: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 0
|
||||
r"""Number of records to skip for pagination"""
|
||||
|
||||
limit: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 50
|
||||
r"""Maximum number of records to return (max 100)"""
|
||||
|
||||
workspace_id: Annotated[
|
||||
|
||||
@@ -128,13 +128,13 @@ class ListKeyAssignmentsRequest(BaseModel):
|
||||
offset: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 0
|
||||
r"""Number of records to skip for pagination"""
|
||||
|
||||
limit: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 50
|
||||
r"""Maximum number of records to return (max 100)"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
|
||||
@@ -128,13 +128,13 @@ class ListMemberAssignmentsRequest(BaseModel):
|
||||
offset: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 0
|
||||
r"""Number of records to skip for pagination"""
|
||||
|
||||
limit: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 50
|
||||
r"""Maximum number of records to return (max 100)"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.components import modelslistresponse as components_modelslistresponse
|
||||
from openrouter.types import BaseModel, UNSET_SENTINEL
|
||||
from openrouter.utils import FieldMetadata, HeaderMetadata, SecurityMetadata
|
||||
from openrouter.utils import (
|
||||
FieldMetadata,
|
||||
HeaderMetadata,
|
||||
QueryParamMetadata,
|
||||
SecurityMetadata,
|
||||
)
|
||||
import pydantic
|
||||
from pydantic import model_serializer
|
||||
from typing import Optional
|
||||
from typing import Awaitable, Callable, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
@@ -105,6 +111,10 @@ class ListModelsUserRequestTypedDict(TypedDict):
|
||||
r"""Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
|
||||
|
||||
"""
|
||||
offset: NotRequired[int]
|
||||
r"""Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned"""
|
||||
limit: NotRequired[int]
|
||||
r"""Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned"""
|
||||
|
||||
|
||||
class ListModelsUserRequest(BaseModel):
|
||||
@@ -136,10 +146,28 @@ class ListModelsUserRequest(BaseModel):
|
||||
|
||||
"""
|
||||
|
||||
offset: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = 0
|
||||
r"""Number of records to skip for pagination. When both offset and limit are omitted, the full list is returned"""
|
||||
|
||||
limit: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = 500
|
||||
r"""Maximum number of records to return (max 1000). When both offset and limit are omitted, the full list is returned"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = set(
|
||||
["HTTP-Referer", "X-OpenRouter-Title", "X-OpenRouter-Categories"]
|
||||
[
|
||||
"HTTP-Referer",
|
||||
"X-OpenRouter-Title",
|
||||
"X-OpenRouter-Categories",
|
||||
"offset",
|
||||
"limit",
|
||||
]
|
||||
)
|
||||
serialized = handler(self)
|
||||
m = {}
|
||||
@@ -153,3 +181,16 @@ class ListModelsUserRequest(BaseModel):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
class ListModelsUserResponseTypedDict(TypedDict):
|
||||
result: components_modelslistresponse.ModelsListResponseTypedDict
|
||||
|
||||
|
||||
class ListModelsUserResponse(BaseModel):
|
||||
next: Union[
|
||||
Callable[[], Optional[ListModelsUserResponse]],
|
||||
Callable[[], Awaitable[Optional[ListModelsUserResponse]]],
|
||||
]
|
||||
|
||||
result: components_modelslistresponse.ModelsListResponse
|
||||
|
||||
@@ -130,13 +130,13 @@ class ListObservabilityDestinationsRequest(BaseModel):
|
||||
offset: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 0
|
||||
r"""Number of records to skip for pagination"""
|
||||
|
||||
limit: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 50
|
||||
r"""Maximum number of records to return (max 100)"""
|
||||
|
||||
workspace_id: Annotated[
|
||||
|
||||
@@ -125,13 +125,13 @@ class ListOrganizationMembersRequest(BaseModel):
|
||||
offset: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 0
|
||||
r"""Number of records to skip for pagination"""
|
||||
|
||||
limit: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 50
|
||||
r"""Maximum number of records to return (max 100)"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
|
||||
@@ -126,13 +126,13 @@ class ListPresetsRequest(BaseModel):
|
||||
offset: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 0
|
||||
r"""Number of records to skip for pagination"""
|
||||
|
||||
limit: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 50
|
||||
r"""Maximum number of records to return (max 100)"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
|
||||
@@ -140,13 +140,13 @@ class ListPresetVersionsRequest(BaseModel):
|
||||
offset: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 0
|
||||
r"""Number of records to skip for pagination"""
|
||||
|
||||
limit: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 50
|
||||
r"""Maximum number of records to return (max 100)"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
|
||||
@@ -140,13 +140,13 @@ class ListWorkspaceMembersRequest(BaseModel):
|
||||
offset: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 0
|
||||
r"""Number of records to skip for pagination"""
|
||||
|
||||
limit: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 50
|
||||
r"""Maximum number of records to return (max 100)"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
|
||||
@@ -128,13 +128,13 @@ class ListWorkspacesRequest(BaseModel):
|
||||
offset: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 0
|
||||
r"""Number of records to skip for pagination"""
|
||||
|
||||
limit: Annotated[
|
||||
Optional[int],
|
||||
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
||||
] = None
|
||||
] = 50
|
||||
r"""Maximum number of records to return (max 100)"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
|
||||
@@ -19,8 +19,8 @@ class Organization(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -123,7 +123,7 @@ class Organization(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return None
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return None
|
||||
next_offset = offset + len(results[0])
|
||||
@@ -182,8 +182,8 @@ class Organization(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -291,7 +291,7 @@ class Organization(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return empty_result()
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return empty_result()
|
||||
next_offset = offset + len(results[0])
|
||||
|
||||
+12
-12
@@ -19,8 +19,8 @@ class Presets(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -126,7 +126,7 @@ class Presets(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return None
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return None
|
||||
next_offset = offset + len(results[0])
|
||||
@@ -185,8 +185,8 @@ class Presets(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -295,7 +295,7 @@ class Presets(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return empty_result()
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return empty_result()
|
||||
next_offset = offset + len(results[0])
|
||||
@@ -2649,8 +2649,8 @@ class Presets(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -2758,7 +2758,7 @@ class Presets(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return None
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return None
|
||||
next_offset = offset + len(results[0])
|
||||
@@ -2824,8 +2824,8 @@ class Presets(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -2936,7 +2936,7 @@ class Presets(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return empty_result()
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return empty_result()
|
||||
next_offset = offset + len(results[0])
|
||||
|
||||
@@ -19,8 +19,8 @@ class Workspaces(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -123,7 +123,7 @@ class Workspaces(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return None
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return None
|
||||
next_offset = offset + len(results[0])
|
||||
@@ -177,8 +177,8 @@ class Workspaces(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -284,7 +284,7 @@ class Workspaces(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return empty_result()
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return empty_result()
|
||||
next_offset = offset + len(results[0])
|
||||
@@ -2409,8 +2409,8 @@ class Workspaces(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -2515,7 +2515,7 @@ class Workspaces(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return None
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return None
|
||||
next_offset = offset + len(results[0])
|
||||
@@ -2581,8 +2581,8 @@ class Workspaces(BaseSDK):
|
||||
http_referer: Optional[str] = None,
|
||||
x_open_router_title: Optional[str] = None,
|
||||
x_open_router_categories: Optional[str] = None,
|
||||
offset: Optional[int] = None,
|
||||
limit: Optional[int] = None,
|
||||
offset: Optional[int] = 0,
|
||||
limit: Optional[int] = 50,
|
||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||
server_url: Optional[str] = None,
|
||||
timeout_ms: Optional[int] = None,
|
||||
@@ -2690,7 +2690,7 @@ class Workspaces(BaseSDK):
|
||||
results = JSONPath("$.data").parse(body)
|
||||
if len(results) == 0 or len(results[0]) == 0:
|
||||
return empty_result()
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 0
|
||||
limit_ = request.limit if isinstance(request.limit, int) else 50
|
||||
if len(results[0]) < limit_:
|
||||
return empty_result()
|
||||
next_offset = offset + len(results[0])
|
||||
|
||||
Reference in New Issue
Block a user