mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-30 12:20:57 +08:00
## Python SDK Changes:
* `open_router.beta.responses.send()`: * `request` **Changed** **Breaking** ⚠️ * `response` **Changed** **Breaking** ⚠️ * `open_router.presets.create_presets_responses()`: `request` **Changed** **Breaking** ⚠️ * `open_router.presets.create_presets_chat_completions()`: `request` **Changed** **Breaking** ⚠️ * `open_router.chat.send()`: `request` **Changed** **Breaking** ⚠️ * `open_router.workspaces.set_budget()`: **Added** * `open_router.o_auth.create_auth_code()`: * `request.workspace_id` **Added** * `error.status[403]` **Added** * `open_router.files.download()`: **Added** * `open_router.models.get()`: **Added** * `open_router.workspaces.list_budgets()`: **Added** * `open_router.workspaces.delete_budget()`: **Added** * `open_router.datasets.get_benchmarks_artificial_analysis()`: **Added** * `open_router.beta.analytics.query_analytics()`: `response.data.warnings` **Added** * `open_router.files.delete()`: **Added** * `open_router.files.retrieve()`: **Added** * `open_router.files.upload()`: **Added** * `open_router.embeddings.list_models()`: `response.data.[].benchmarks` **Added** * `open_router.models.list()`: * `request` **Changed** * `response.data.[].benchmarks` **Added** * `open_router.models.list_for_user()`: `response.data.[].benchmarks` **Added** * `open_router.files.list()`: **Added** * `open_router.presets.create_presets_messages()`: `request` **Changed** * `open_router.datasets.get_benchmarks_design_arena()`: **Added**
This commit is contained in:
@@ -6,6 +6,7 @@ import builtins
|
||||
import sys
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .aabenchmarkentry import AABenchmarkEntry, AABenchmarkEntryTypedDict
|
||||
from .activityitem import ActivityItem, ActivityItemTypedDict
|
||||
from .activityresponse import ActivityResponse, ActivityResponseTypedDict
|
||||
from .advisornestedtool import AdvisorNestedTool, AdvisorNestedToolTypedDict
|
||||
@@ -87,6 +88,11 @@ if TYPE_CHECKING:
|
||||
SourceType,
|
||||
TypeDocument,
|
||||
)
|
||||
from .anthropicfiledocumentsource import (
|
||||
AnthropicFileDocumentSource,
|
||||
AnthropicFileDocumentSourceType,
|
||||
AnthropicFileDocumentSourceTypedDict,
|
||||
)
|
||||
from .anthropicimageblockparam import (
|
||||
AnthropicImageBlockParam,
|
||||
AnthropicImageBlockParamSource,
|
||||
@@ -270,6 +276,38 @@ if TYPE_CHECKING:
|
||||
BashServerToolEnvironment,
|
||||
BashServerToolEnvironmentTypedDict,
|
||||
)
|
||||
from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict
|
||||
from .benchmarksaaitem import BenchmarksAAItem, BenchmarksAAItemTypedDict
|
||||
from .benchmarksaameta import (
|
||||
BenchmarksAAMeta,
|
||||
BenchmarksAAMetaSource,
|
||||
BenchmarksAAMetaSourceURL,
|
||||
BenchmarksAAMetaTypedDict,
|
||||
BenchmarksAAMetaVersion,
|
||||
)
|
||||
from .benchmarksaaresponse import (
|
||||
BenchmarksAAResponse,
|
||||
BenchmarksAAResponseTypedDict,
|
||||
)
|
||||
from .benchmarksdaitem import (
|
||||
BenchmarksDAItem,
|
||||
BenchmarksDAItemTypedDict,
|
||||
TournamentStats,
|
||||
TournamentStatsTypedDict,
|
||||
)
|
||||
from .benchmarksdameta import (
|
||||
BenchmarksDAMeta,
|
||||
BenchmarksDAMetaSource,
|
||||
BenchmarksDAMetaSourceURL,
|
||||
BenchmarksDAMetaTypedDict,
|
||||
BenchmarksDAMetaVersion,
|
||||
EloBounds,
|
||||
EloBoundsTypedDict,
|
||||
)
|
||||
from .benchmarksdaresponse import (
|
||||
BenchmarksDAResponse,
|
||||
BenchmarksDAResponseTypedDict,
|
||||
)
|
||||
from .bulkaddworkspacemembersrequest import (
|
||||
BulkAddWorkspaceMembersRequest,
|
||||
BulkAddWorkspaceMembersRequestTypedDict,
|
||||
@@ -434,6 +472,7 @@ if TYPE_CHECKING:
|
||||
ChatRequestPlugin,
|
||||
ChatRequestPluginTypedDict,
|
||||
ChatRequestReasoning,
|
||||
ChatRequestReasoningEffort,
|
||||
ChatRequestReasoningTypedDict,
|
||||
ChatRequestServiceTier,
|
||||
ChatRequestTypedDict,
|
||||
@@ -727,6 +766,7 @@ if TYPE_CHECKING:
|
||||
CustomToolCallOutputItemTypeInputImage,
|
||||
CustomToolCallOutputItemTypedDict,
|
||||
)
|
||||
from .dabenchmarkentry import DABenchmarkEntry, DABenchmarkEntryTypedDict
|
||||
from .datetimeservertool import (
|
||||
DatetimeServerTool,
|
||||
DatetimeServerToolType,
|
||||
@@ -749,6 +789,10 @@ if TYPE_CHECKING:
|
||||
DeleteObservabilityDestinationResponse,
|
||||
DeleteObservabilityDestinationResponseTypedDict,
|
||||
)
|
||||
from .deleteworkspacebudgetresponse import (
|
||||
DeleteWorkspaceBudgetResponse,
|
||||
DeleteWorkspaceBudgetResponseTypedDict,
|
||||
)
|
||||
from .deleteworkspaceresponse import (
|
||||
DeleteWorkspaceResponse,
|
||||
DeleteWorkspaceResponseTypedDict,
|
||||
@@ -785,6 +829,13 @@ if TYPE_CHECKING:
|
||||
from .endpointstatus import EndpointStatus
|
||||
from .errorevent import ErrorEvent, ErrorEventType, ErrorEventTypedDict
|
||||
from .filecitation import FileCitation, FileCitationType, FileCitationTypedDict
|
||||
from .filedeleteresponse import (
|
||||
FileDeleteResponse,
|
||||
FileDeleteResponseType,
|
||||
FileDeleteResponseTypedDict,
|
||||
)
|
||||
from .filelistresponse import FileListResponse, FileListResponseTypedDict
|
||||
from .filemetadata import FileMetadata, FileMetadataType, FileMetadataTypedDict
|
||||
from .fileparserplugin import (
|
||||
FileParserPlugin,
|
||||
FileParserPluginID,
|
||||
@@ -928,6 +979,7 @@ if TYPE_CHECKING:
|
||||
FusionPluginTool,
|
||||
FusionPluginToolTypedDict,
|
||||
FusionPluginTypedDict,
|
||||
PresetEnum,
|
||||
)
|
||||
from .fusionservertool_openrouter import (
|
||||
FusionServerToolOpenRouter,
|
||||
@@ -1156,6 +1208,10 @@ if TYPE_CHECKING:
|
||||
ListPresetVersionsResponse,
|
||||
ListPresetVersionsResponseTypedDict,
|
||||
)
|
||||
from .listworkspacebudgetsresponse import (
|
||||
ListWorkspaceBudgetsResponse,
|
||||
ListWorkspaceBudgetsResponseTypedDict,
|
||||
)
|
||||
from .listworkspacesresponse import (
|
||||
ListWorkspacesResponse,
|
||||
ListWorkspacesResponseTypedDict,
|
||||
@@ -1218,6 +1274,10 @@ if TYPE_CHECKING:
|
||||
MessagesAdvisorToolResultBlockType,
|
||||
MessagesAdvisorToolResultBlockTypedDict,
|
||||
)
|
||||
from .messagesfallbackparam import (
|
||||
MessagesFallbackParam,
|
||||
MessagesFallbackParamTypedDict,
|
||||
)
|
||||
from .messagesmessageparam import (
|
||||
ContentCompaction,
|
||||
ContentCompactionTypedDict,
|
||||
@@ -1373,8 +1433,10 @@ if TYPE_CHECKING:
|
||||
ModelArchitectureInstructType,
|
||||
ModelArchitectureTypedDict,
|
||||
)
|
||||
from .modelbenchmarks import ModelBenchmarks, ModelBenchmarksTypedDict
|
||||
from .modelgroup import ModelGroup
|
||||
from .modellinks import ModelLinks, ModelLinksTypedDict
|
||||
from .modelresponse import ModelResponse, ModelResponseTypedDict
|
||||
from .modelscountresponse import (
|
||||
ModelsCountResponse,
|
||||
ModelsCountResponseData,
|
||||
@@ -1820,6 +1882,11 @@ if TYPE_CHECKING:
|
||||
TypeExit,
|
||||
TypeTimeout,
|
||||
)
|
||||
from .outputsubagentservertoolitem import (
|
||||
OutputSubagentServerToolItem,
|
||||
OutputSubagentServerToolItemType,
|
||||
OutputSubagentServerToolItemTypedDict,
|
||||
)
|
||||
from .outputtexteditorservertoolitem import (
|
||||
Command,
|
||||
OutputTextEditorServerToolItem,
|
||||
@@ -1973,7 +2040,7 @@ if TYPE_CHECKING:
|
||||
from .rankingsdailymeta import (
|
||||
RankingsDailyMeta,
|
||||
RankingsDailyMetaTypedDict,
|
||||
Version,
|
||||
RankingsDailyMetaVersion,
|
||||
)
|
||||
from .rankingsdailyresponse import (
|
||||
RankingsDailyResponse,
|
||||
@@ -2234,6 +2301,21 @@ if TYPE_CHECKING:
|
||||
)
|
||||
from .sttresponse import STTResponse, STTResponseTypedDict
|
||||
from .sttusage import STTUsage, STTUsageTypedDict
|
||||
from .subagentnestedtool import SubagentNestedTool, SubagentNestedToolTypedDict
|
||||
from .subagentreasoning import (
|
||||
SubagentReasoning,
|
||||
SubagentReasoningEffort,
|
||||
SubagentReasoningTypedDict,
|
||||
)
|
||||
from .subagentservertool_openrouter import (
|
||||
SubagentServerToolOpenRouter,
|
||||
SubagentServerToolOpenRouterType,
|
||||
SubagentServerToolOpenRouterTypedDict,
|
||||
)
|
||||
from .subagentservertoolconfig import (
|
||||
SubagentServerToolConfig,
|
||||
SubagentServerToolConfigTypedDict,
|
||||
)
|
||||
from .textdeltaevent import (
|
||||
TextDeltaEvent,
|
||||
TextDeltaEventType,
|
||||
@@ -2302,6 +2384,14 @@ if TYPE_CHECKING:
|
||||
UpdateWorkspaceResponse,
|
||||
UpdateWorkspaceResponseTypedDict,
|
||||
)
|
||||
from .upsertworkspacebudgetrequest import (
|
||||
UpsertWorkspaceBudgetRequest,
|
||||
UpsertWorkspaceBudgetRequestTypedDict,
|
||||
)
|
||||
from .upsertworkspacebudgetresponse import (
|
||||
UpsertWorkspaceBudgetResponse,
|
||||
UpsertWorkspaceBudgetResponseTypedDict,
|
||||
)
|
||||
from .urlcitation import URLCitation, URLCitationType, URLCitationTypedDict
|
||||
from .usage import (
|
||||
InputTokensDetails,
|
||||
@@ -2420,6 +2510,12 @@ if TYPE_CHECKING:
|
||||
WebSearchUserLocationServerToolTypedDict,
|
||||
)
|
||||
from .workspace import Workspace, WorkspaceTypedDict
|
||||
from .workspacebudget import (
|
||||
ResetInterval,
|
||||
WorkspaceBudget,
|
||||
WorkspaceBudgetTypedDict,
|
||||
)
|
||||
from .workspacebudgetinterval import WorkspaceBudgetInterval
|
||||
from .workspacemember import (
|
||||
WorkspaceMember,
|
||||
WorkspaceMemberRole,
|
||||
@@ -2427,6 +2523,8 @@ if TYPE_CHECKING:
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"AABenchmarkEntry",
|
||||
"AABenchmarkEntryTypedDict",
|
||||
"APIType",
|
||||
"Action",
|
||||
"ActionEnum",
|
||||
@@ -2496,6 +2594,9 @@ __all__ = [
|
||||
"AnthropicDocumentBlockParamSourceUnion",
|
||||
"AnthropicDocumentBlockParamSourceUnionTypedDict",
|
||||
"AnthropicDocumentBlockParamTypedDict",
|
||||
"AnthropicFileDocumentSource",
|
||||
"AnthropicFileDocumentSourceType",
|
||||
"AnthropicFileDocumentSourceTypedDict",
|
||||
"AnthropicImageBlockParam",
|
||||
"AnthropicImageBlockParamSource",
|
||||
"AnthropicImageBlockParamSourceTypedDict",
|
||||
@@ -2627,6 +2728,26 @@ __all__ = [
|
||||
"BashServerToolEnvironmentTypedDict",
|
||||
"BashServerToolType",
|
||||
"BashServerToolTypedDict",
|
||||
"BenchmarkPricing",
|
||||
"BenchmarkPricingTypedDict",
|
||||
"BenchmarksAAItem",
|
||||
"BenchmarksAAItemTypedDict",
|
||||
"BenchmarksAAMeta",
|
||||
"BenchmarksAAMetaSource",
|
||||
"BenchmarksAAMetaSourceURL",
|
||||
"BenchmarksAAMetaTypedDict",
|
||||
"BenchmarksAAMetaVersion",
|
||||
"BenchmarksAAResponse",
|
||||
"BenchmarksAAResponseTypedDict",
|
||||
"BenchmarksDAItem",
|
||||
"BenchmarksDAItemTypedDict",
|
||||
"BenchmarksDAMeta",
|
||||
"BenchmarksDAMetaSource",
|
||||
"BenchmarksDAMetaSourceURL",
|
||||
"BenchmarksDAMetaTypedDict",
|
||||
"BenchmarksDAMetaVersion",
|
||||
"BenchmarksDAResponse",
|
||||
"BenchmarksDAResponseTypedDict",
|
||||
"BulkAddWorkspaceMembersRequest",
|
||||
"BulkAddWorkspaceMembersRequestTypedDict",
|
||||
"BulkAddWorkspaceMembersResponse",
|
||||
@@ -2736,6 +2857,7 @@ __all__ = [
|
||||
"ChatRequestPlugin",
|
||||
"ChatRequestPluginTypedDict",
|
||||
"ChatRequestReasoning",
|
||||
"ChatRequestReasoningEffort",
|
||||
"ChatRequestReasoningTypedDict",
|
||||
"ChatRequestServiceTier",
|
||||
"ChatRequestTypedDict",
|
||||
@@ -2945,6 +3067,8 @@ __all__ = [
|
||||
"CustomToolCallOutputItemTypedDict",
|
||||
"CustomToolTypeCustom",
|
||||
"CustomToolTypedDict",
|
||||
"DABenchmarkEntry",
|
||||
"DABenchmarkEntryTypedDict",
|
||||
"DataCollection",
|
||||
"DataRegion",
|
||||
"DatetimeServerTool",
|
||||
@@ -2960,6 +3084,8 @@ __all__ = [
|
||||
"DeleteGuardrailResponseTypedDict",
|
||||
"DeleteObservabilityDestinationResponse",
|
||||
"DeleteObservabilityDestinationResponseTypedDict",
|
||||
"DeleteWorkspaceBudgetResponse",
|
||||
"DeleteWorkspaceBudgetResponseTypedDict",
|
||||
"DeleteWorkspaceResponse",
|
||||
"DeleteWorkspaceResponseTypedDict",
|
||||
"EasyInputMessage",
|
||||
@@ -2994,6 +3120,8 @@ __all__ = [
|
||||
"EditCompact20260112TypedDict",
|
||||
"EditTypeInputTokens",
|
||||
"EditTypedDict",
|
||||
"EloBounds",
|
||||
"EloBoundsTypedDict",
|
||||
"EndpointInfo",
|
||||
"EndpointInfoTypedDict",
|
||||
"EndpointStatus",
|
||||
@@ -3013,6 +3141,14 @@ __all__ = [
|
||||
"FileCitation",
|
||||
"FileCitationType",
|
||||
"FileCitationTypedDict",
|
||||
"FileDeleteResponse",
|
||||
"FileDeleteResponseType",
|
||||
"FileDeleteResponseTypedDict",
|
||||
"FileListResponse",
|
||||
"FileListResponseTypedDict",
|
||||
"FileMetadata",
|
||||
"FileMetadataType",
|
||||
"FileMetadataTypedDict",
|
||||
"FileParserPlugin",
|
||||
"FileParserPluginID",
|
||||
"FileParserPluginTypedDict",
|
||||
@@ -3293,6 +3429,8 @@ __all__ = [
|
||||
"ListPresetVersionsResponseTypedDict",
|
||||
"ListPresetsResponse",
|
||||
"ListPresetsResponseTypedDict",
|
||||
"ListWorkspaceBudgetsResponse",
|
||||
"ListWorkspaceBudgetsResponseTypedDict",
|
||||
"ListWorkspacesResponse",
|
||||
"ListWorkspacesResponseTypedDict",
|
||||
"LocalShellCallItem",
|
||||
@@ -3331,6 +3469,8 @@ __all__ = [
|
||||
"MessagesAdvisorToolResultBlock",
|
||||
"MessagesAdvisorToolResultBlockType",
|
||||
"MessagesAdvisorToolResultBlockTypedDict",
|
||||
"MessagesFallbackParam",
|
||||
"MessagesFallbackParamTypedDict",
|
||||
"MessagesMessageParam",
|
||||
"MessagesMessageParamContentUnion1",
|
||||
"MessagesMessageParamContentUnion1TypedDict",
|
||||
@@ -3372,10 +3512,14 @@ __all__ = [
|
||||
"ModelArchitecture",
|
||||
"ModelArchitectureInstructType",
|
||||
"ModelArchitectureTypedDict",
|
||||
"ModelBenchmarks",
|
||||
"ModelBenchmarksTypedDict",
|
||||
"ModelEnum",
|
||||
"ModelGroup",
|
||||
"ModelLinks",
|
||||
"ModelLinksTypedDict",
|
||||
"ModelResponse",
|
||||
"ModelResponseTypedDict",
|
||||
"ModelTypedDict",
|
||||
"ModelsCountResponse",
|
||||
"ModelsCountResponseData",
|
||||
@@ -3702,6 +3846,9 @@ __all__ = [
|
||||
"OutputShellCallOutputItemOutputTypedDict",
|
||||
"OutputShellCallOutputItemTypeShellCallOutput",
|
||||
"OutputShellCallOutputItemTypedDict",
|
||||
"OutputSubagentServerToolItem",
|
||||
"OutputSubagentServerToolItemType",
|
||||
"OutputSubagentServerToolItemTypedDict",
|
||||
"OutputTextEditorServerToolItem",
|
||||
"OutputTextEditorServerToolItemType",
|
||||
"OutputTextEditorServerToolItemTypedDict",
|
||||
@@ -3763,6 +3910,7 @@ __all__ = [
|
||||
"Preset",
|
||||
"PresetDesignatedVersion",
|
||||
"PresetDesignatedVersionTypedDict",
|
||||
"PresetEnum",
|
||||
"PresetStatus",
|
||||
"PresetTypedDict",
|
||||
"PresetWithDesignatedVersion",
|
||||
@@ -3808,6 +3956,7 @@ __all__ = [
|
||||
"RankingsDailyItemTypedDict",
|
||||
"RankingsDailyMeta",
|
||||
"RankingsDailyMetaTypedDict",
|
||||
"RankingsDailyMetaVersion",
|
||||
"RankingsDailyResponse",
|
||||
"RankingsDailyResponseTypedDict",
|
||||
"Reason",
|
||||
@@ -3874,6 +4023,7 @@ __all__ = [
|
||||
"RequireApprovalTypedDict",
|
||||
"RequireApprovalUnion",
|
||||
"RequireApprovalUnionTypedDict",
|
||||
"ResetInterval",
|
||||
"Resolution",
|
||||
"Response",
|
||||
"ResponseFormat",
|
||||
@@ -4007,6 +4157,16 @@ __all__ = [
|
||||
"StreamLogprobTopLogprob",
|
||||
"StreamLogprobTopLogprobTypedDict",
|
||||
"StreamLogprobTypedDict",
|
||||
"SubagentNestedTool",
|
||||
"SubagentNestedToolTypedDict",
|
||||
"SubagentReasoning",
|
||||
"SubagentReasoningEffort",
|
||||
"SubagentReasoningTypedDict",
|
||||
"SubagentServerToolConfig",
|
||||
"SubagentServerToolConfigTypedDict",
|
||||
"SubagentServerToolOpenRouter",
|
||||
"SubagentServerToolOpenRouterType",
|
||||
"SubagentServerToolOpenRouterTypedDict",
|
||||
"SupportedAspectRatio",
|
||||
"SupportedFrameImage",
|
||||
"SupportedResolution",
|
||||
@@ -4066,6 +4226,8 @@ __all__ = [
|
||||
"ToolWebSearch20260209TypedDict",
|
||||
"TopProviderInfo",
|
||||
"TopProviderInfoTypedDict",
|
||||
"TournamentStats",
|
||||
"TournamentStatsTypedDict",
|
||||
"TraceConfig",
|
||||
"TraceConfigTypedDict",
|
||||
"Trigger",
|
||||
@@ -4135,6 +4297,10 @@ __all__ = [
|
||||
"UpdateWorkspaceRequestTypedDict",
|
||||
"UpdateWorkspaceResponse",
|
||||
"UpdateWorkspaceResponseTypedDict",
|
||||
"UpsertWorkspaceBudgetRequest",
|
||||
"UpsertWorkspaceBudgetRequestTypedDict",
|
||||
"UpsertWorkspaceBudgetResponse",
|
||||
"UpsertWorkspaceBudgetResponseTypedDict",
|
||||
"Usage",
|
||||
"UsageCostDetails",
|
||||
"UsageCostDetailsTypedDict",
|
||||
@@ -4144,7 +4310,6 @@ __all__ = [
|
||||
"Variables",
|
||||
"VariablesTypedDict",
|
||||
"Verbosity",
|
||||
"Version",
|
||||
"VideoGenerationRequest",
|
||||
"VideoGenerationRequestProvider",
|
||||
"VideoGenerationRequestProviderTypedDict",
|
||||
@@ -4207,6 +4372,9 @@ __all__ = [
|
||||
"WebSearchUserLocationType",
|
||||
"WebSearchUserLocationTypedDict",
|
||||
"Workspace",
|
||||
"WorkspaceBudget",
|
||||
"WorkspaceBudgetInterval",
|
||||
"WorkspaceBudgetTypedDict",
|
||||
"WorkspaceMember",
|
||||
"WorkspaceMemberRole",
|
||||
"WorkspaceMemberTypedDict",
|
||||
@@ -4214,6 +4382,8 @@ __all__ = [
|
||||
]
|
||||
|
||||
_dynamic_imports: dict[str, str] = {
|
||||
"AABenchmarkEntry": ".aabenchmarkentry",
|
||||
"AABenchmarkEntryTypedDict": ".aabenchmarkentry",
|
||||
"ActivityItem": ".activityitem",
|
||||
"ActivityItemTypedDict": ".activityitem",
|
||||
"ActivityResponse": ".activityresponse",
|
||||
@@ -4272,6 +4442,9 @@ _dynamic_imports: dict[str, str] = {
|
||||
"SourceContentTypedDict": ".anthropicdocumentblockparam",
|
||||
"SourceType": ".anthropicdocumentblockparam",
|
||||
"TypeDocument": ".anthropicdocumentblockparam",
|
||||
"AnthropicFileDocumentSource": ".anthropicfiledocumentsource",
|
||||
"AnthropicFileDocumentSourceType": ".anthropicfiledocumentsource",
|
||||
"AnthropicFileDocumentSourceTypedDict": ".anthropicfiledocumentsource",
|
||||
"AnthropicImageBlockParam": ".anthropicimageblockparam",
|
||||
"AnthropicImageBlockParamSource": ".anthropicimageblockparam",
|
||||
"AnthropicImageBlockParamSourceTypedDict": ".anthropicimageblockparam",
|
||||
@@ -4396,6 +4569,30 @@ _dynamic_imports: dict[str, str] = {
|
||||
"BashServerToolEngine": ".bashservertoolengine",
|
||||
"BashServerToolEnvironment": ".bashservertoolenvironment",
|
||||
"BashServerToolEnvironmentTypedDict": ".bashservertoolenvironment",
|
||||
"BenchmarkPricing": ".benchmarkpricing",
|
||||
"BenchmarkPricingTypedDict": ".benchmarkpricing",
|
||||
"BenchmarksAAItem": ".benchmarksaaitem",
|
||||
"BenchmarksAAItemTypedDict": ".benchmarksaaitem",
|
||||
"BenchmarksAAMeta": ".benchmarksaameta",
|
||||
"BenchmarksAAMetaSource": ".benchmarksaameta",
|
||||
"BenchmarksAAMetaSourceURL": ".benchmarksaameta",
|
||||
"BenchmarksAAMetaTypedDict": ".benchmarksaameta",
|
||||
"BenchmarksAAMetaVersion": ".benchmarksaameta",
|
||||
"BenchmarksAAResponse": ".benchmarksaaresponse",
|
||||
"BenchmarksAAResponseTypedDict": ".benchmarksaaresponse",
|
||||
"BenchmarksDAItem": ".benchmarksdaitem",
|
||||
"BenchmarksDAItemTypedDict": ".benchmarksdaitem",
|
||||
"TournamentStats": ".benchmarksdaitem",
|
||||
"TournamentStatsTypedDict": ".benchmarksdaitem",
|
||||
"BenchmarksDAMeta": ".benchmarksdameta",
|
||||
"BenchmarksDAMetaSource": ".benchmarksdameta",
|
||||
"BenchmarksDAMetaSourceURL": ".benchmarksdameta",
|
||||
"BenchmarksDAMetaTypedDict": ".benchmarksdameta",
|
||||
"BenchmarksDAMetaVersion": ".benchmarksdameta",
|
||||
"EloBounds": ".benchmarksdameta",
|
||||
"EloBoundsTypedDict": ".benchmarksdameta",
|
||||
"BenchmarksDAResponse": ".benchmarksdaresponse",
|
||||
"BenchmarksDAResponseTypedDict": ".benchmarksdaresponse",
|
||||
"BulkAddWorkspaceMembersRequest": ".bulkaddworkspacemembersrequest",
|
||||
"BulkAddWorkspaceMembersRequestTypedDict": ".bulkaddworkspacemembersrequest",
|
||||
"BulkAddWorkspaceMembersResponse": ".bulkaddworkspacemembersresponse",
|
||||
@@ -4507,6 +4704,7 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ChatRequestPlugin": ".chatrequest",
|
||||
"ChatRequestPluginTypedDict": ".chatrequest",
|
||||
"ChatRequestReasoning": ".chatrequest",
|
||||
"ChatRequestReasoningEffort": ".chatrequest",
|
||||
"ChatRequestReasoningTypedDict": ".chatrequest",
|
||||
"ChatRequestServiceTier": ".chatrequest",
|
||||
"ChatRequestTypedDict": ".chatrequest",
|
||||
@@ -4712,6 +4910,8 @@ _dynamic_imports: dict[str, str] = {
|
||||
"CustomToolCallOutputItemTypeCustomToolCallOutput": ".customtoolcalloutputitem",
|
||||
"CustomToolCallOutputItemTypeInputImage": ".customtoolcalloutputitem",
|
||||
"CustomToolCallOutputItemTypedDict": ".customtoolcalloutputitem",
|
||||
"DABenchmarkEntry": ".dabenchmarkentry",
|
||||
"DABenchmarkEntryTypedDict": ".dabenchmarkentry",
|
||||
"DatetimeServerTool": ".datetimeservertool",
|
||||
"DatetimeServerToolType": ".datetimeservertool",
|
||||
"DatetimeServerToolTypedDict": ".datetimeservertool",
|
||||
@@ -4725,6 +4925,8 @@ _dynamic_imports: dict[str, str] = {
|
||||
"DeleteGuardrailResponseTypedDict": ".deleteguardrailresponse",
|
||||
"DeleteObservabilityDestinationResponse": ".deleteobservabilitydestinationresponse",
|
||||
"DeleteObservabilityDestinationResponseTypedDict": ".deleteobservabilitydestinationresponse",
|
||||
"DeleteWorkspaceBudgetResponse": ".deleteworkspacebudgetresponse",
|
||||
"DeleteWorkspaceBudgetResponseTypedDict": ".deleteworkspacebudgetresponse",
|
||||
"DeleteWorkspaceResponse": ".deleteworkspaceresponse",
|
||||
"DeleteWorkspaceResponseTypedDict": ".deleteworkspaceresponse",
|
||||
"EasyInputMessage": ".easyinputmessage",
|
||||
@@ -4761,6 +4963,14 @@ _dynamic_imports: dict[str, str] = {
|
||||
"FileCitation": ".filecitation",
|
||||
"FileCitationType": ".filecitation",
|
||||
"FileCitationTypedDict": ".filecitation",
|
||||
"FileDeleteResponse": ".filedeleteresponse",
|
||||
"FileDeleteResponseType": ".filedeleteresponse",
|
||||
"FileDeleteResponseTypedDict": ".filedeleteresponse",
|
||||
"FileListResponse": ".filelistresponse",
|
||||
"FileListResponseTypedDict": ".filelistresponse",
|
||||
"FileMetadata": ".filemetadata",
|
||||
"FileMetadataType": ".filemetadata",
|
||||
"FileMetadataTypedDict": ".filemetadata",
|
||||
"FileParserPlugin": ".fileparserplugin",
|
||||
"FileParserPluginID": ".fileparserplugin",
|
||||
"FileParserPluginTypedDict": ".fileparserplugin",
|
||||
@@ -4864,6 +5074,7 @@ _dynamic_imports: dict[str, str] = {
|
||||
"FusionPluginTool": ".fusionplugin",
|
||||
"FusionPluginToolTypedDict": ".fusionplugin",
|
||||
"FusionPluginTypedDict": ".fusionplugin",
|
||||
"PresetEnum": ".fusionplugin",
|
||||
"FusionServerToolOpenRouter": ".fusionservertool_openrouter",
|
||||
"FusionServerToolOpenRouterType": ".fusionservertool_openrouter",
|
||||
"FusionServerToolOpenRouterTypedDict": ".fusionservertool_openrouter",
|
||||
@@ -5042,6 +5253,8 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ListPresetsResponseTypedDict": ".listpresetsresponse",
|
||||
"ListPresetVersionsResponse": ".listpresetversionsresponse",
|
||||
"ListPresetVersionsResponseTypedDict": ".listpresetversionsresponse",
|
||||
"ListWorkspaceBudgetsResponse": ".listworkspacebudgetsresponse",
|
||||
"ListWorkspaceBudgetsResponseTypedDict": ".listworkspacebudgetsresponse",
|
||||
"ListWorkspacesResponse": ".listworkspacesresponse",
|
||||
"ListWorkspacesResponseTypedDict": ".listworkspacesresponse",
|
||||
"LocalShellCallItem": ".localshellcallitem",
|
||||
@@ -5091,6 +5304,8 @@ _dynamic_imports: dict[str, str] = {
|
||||
"MessagesAdvisorToolResultBlock": ".messagesadvisortoolresultblock",
|
||||
"MessagesAdvisorToolResultBlockType": ".messagesadvisortoolresultblock",
|
||||
"MessagesAdvisorToolResultBlockTypedDict": ".messagesadvisortoolresultblock",
|
||||
"MessagesFallbackParam": ".messagesfallbackparam",
|
||||
"MessagesFallbackParamTypedDict": ".messagesfallbackparam",
|
||||
"ContentCompaction": ".messagesmessageparam",
|
||||
"ContentCompactionTypedDict": ".messagesmessageparam",
|
||||
"ContentRedactedThinking": ".messagesmessageparam",
|
||||
@@ -5239,9 +5454,13 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ModelArchitecture": ".modelarchitecture",
|
||||
"ModelArchitectureInstructType": ".modelarchitecture",
|
||||
"ModelArchitectureTypedDict": ".modelarchitecture",
|
||||
"ModelBenchmarks": ".modelbenchmarks",
|
||||
"ModelBenchmarksTypedDict": ".modelbenchmarks",
|
||||
"ModelGroup": ".modelgroup",
|
||||
"ModelLinks": ".modellinks",
|
||||
"ModelLinksTypedDict": ".modellinks",
|
||||
"ModelResponse": ".modelresponse",
|
||||
"ModelResponseTypedDict": ".modelresponse",
|
||||
"ModelsCountResponse": ".modelscountresponse",
|
||||
"ModelsCountResponseData": ".modelscountresponse",
|
||||
"ModelsCountResponseDataTypedDict": ".modelscountresponse",
|
||||
@@ -5573,6 +5792,9 @@ _dynamic_imports: dict[str, str] = {
|
||||
"OutputShellCallOutputItemTypedDict": ".outputshellcalloutputitem",
|
||||
"TypeExit": ".outputshellcalloutputitem",
|
||||
"TypeTimeout": ".outputshellcalloutputitem",
|
||||
"OutputSubagentServerToolItem": ".outputsubagentservertoolitem",
|
||||
"OutputSubagentServerToolItemType": ".outputsubagentservertoolitem",
|
||||
"OutputSubagentServerToolItemTypedDict": ".outputsubagentservertoolitem",
|
||||
"Command": ".outputtexteditorservertoolitem",
|
||||
"OutputTextEditorServerToolItem": ".outputtexteditorservertoolitem",
|
||||
"OutputTextEditorServerToolItemType": ".outputtexteditorservertoolitem",
|
||||
@@ -5690,7 +5912,7 @@ _dynamic_imports: dict[str, str] = {
|
||||
"RankingsDailyItemTypedDict": ".rankingsdailyitem",
|
||||
"RankingsDailyMeta": ".rankingsdailymeta",
|
||||
"RankingsDailyMetaTypedDict": ".rankingsdailymeta",
|
||||
"Version": ".rankingsdailymeta",
|
||||
"RankingsDailyMetaVersion": ".rankingsdailymeta",
|
||||
"RankingsDailyResponse": ".rankingsdailyresponse",
|
||||
"RankingsDailyResponseTypedDict": ".rankingsdailyresponse",
|
||||
"ReasoningConfig": ".reasoningconfig",
|
||||
@@ -5869,6 +6091,16 @@ _dynamic_imports: dict[str, str] = {
|
||||
"STTResponseTypedDict": ".sttresponse",
|
||||
"STTUsage": ".sttusage",
|
||||
"STTUsageTypedDict": ".sttusage",
|
||||
"SubagentNestedTool": ".subagentnestedtool",
|
||||
"SubagentNestedToolTypedDict": ".subagentnestedtool",
|
||||
"SubagentReasoning": ".subagentreasoning",
|
||||
"SubagentReasoningEffort": ".subagentreasoning",
|
||||
"SubagentReasoningTypedDict": ".subagentreasoning",
|
||||
"SubagentServerToolOpenRouter": ".subagentservertool_openrouter",
|
||||
"SubagentServerToolOpenRouterType": ".subagentservertool_openrouter",
|
||||
"SubagentServerToolOpenRouterTypedDict": ".subagentservertool_openrouter",
|
||||
"SubagentServerToolConfig": ".subagentservertoolconfig",
|
||||
"SubagentServerToolConfigTypedDict": ".subagentservertoolconfig",
|
||||
"TextDeltaEvent": ".textdeltaevent",
|
||||
"TextDeltaEventType": ".textdeltaevent",
|
||||
"TextDeltaEventTypedDict": ".textdeltaevent",
|
||||
@@ -5913,6 +6145,10 @@ _dynamic_imports: dict[str, str] = {
|
||||
"UpdateWorkspaceRequestTypedDict": ".updateworkspacerequest",
|
||||
"UpdateWorkspaceResponse": ".updateworkspaceresponse",
|
||||
"UpdateWorkspaceResponseTypedDict": ".updateworkspaceresponse",
|
||||
"UpsertWorkspaceBudgetRequest": ".upsertworkspacebudgetrequest",
|
||||
"UpsertWorkspaceBudgetRequestTypedDict": ".upsertworkspacebudgetrequest",
|
||||
"UpsertWorkspaceBudgetResponse": ".upsertworkspacebudgetresponse",
|
||||
"UpsertWorkspaceBudgetResponseTypedDict": ".upsertworkspacebudgetresponse",
|
||||
"URLCitation": ".urlcitation",
|
||||
"URLCitationType": ".urlcitation",
|
||||
"URLCitationTypedDict": ".urlcitation",
|
||||
@@ -5995,6 +6231,10 @@ _dynamic_imports: dict[str, str] = {
|
||||
"WebSearchUserLocationServerToolTypedDict": ".websearchuserlocationservertool",
|
||||
"Workspace": ".workspace",
|
||||
"WorkspaceTypedDict": ".workspace",
|
||||
"ResetInterval": ".workspacebudget",
|
||||
"WorkspaceBudget": ".workspacebudget",
|
||||
"WorkspaceBudgetTypedDict": ".workspacebudget",
|
||||
"WorkspaceBudgetInterval": ".workspacebudgetinterval",
|
||||
"WorkspaceMember": ".workspacemember",
|
||||
"WorkspaceMemberRole": ".workspacemember",
|
||||
"WorkspaceMemberTypedDict": ".workspacemember",
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
|
||||
from pydantic import model_serializer
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class AABenchmarkEntryTypedDict(TypedDict):
|
||||
r"""Artificial Analysis benchmark index scores."""
|
||||
|
||||
agentic_index: Nullable[float]
|
||||
r"""Artificial Analysis Agentic Index score"""
|
||||
coding_index: Nullable[float]
|
||||
r"""Artificial Analysis Coding Index score"""
|
||||
intelligence_index: Nullable[float]
|
||||
r"""Artificial Analysis Intelligence Index score"""
|
||||
|
||||
|
||||
class AABenchmarkEntry(BaseModel):
|
||||
r"""Artificial Analysis benchmark index scores."""
|
||||
|
||||
agentic_index: Nullable[float]
|
||||
r"""Artificial Analysis Agentic Index score"""
|
||||
|
||||
coding_index: Nullable[float]
|
||||
r"""Artificial Analysis Coding Index score"""
|
||||
|
||||
intelligence_index: Nullable[float]
|
||||
r"""Artificial Analysis Intelligence Index score"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = ["agentic_index", "coding_index", "intelligence_index"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -9,15 +9,14 @@ from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class AdvisorNestedToolTypedDict(TypedDict):
|
||||
r"""A tool made available to the advisor sub-agent. Accepts function tools and OpenRouter server tools (e.g. openrouter:web_search). The advisor tool may not list itself."""
|
||||
r"""A tool made available to the advisor sub-agent. Only OpenRouter server tools (e.g. openrouter:web_search) are supported; function tools are rejected because the advisor has no way to execute them. The advisor tool may not list itself."""
|
||||
|
||||
type: str
|
||||
function: NotRequired[Dict[str, Nullable[Any]]]
|
||||
parameters: NotRequired[Dict[str, Nullable[Any]]]
|
||||
|
||||
|
||||
class AdvisorNestedTool(BaseModel):
|
||||
r"""A tool made available to the advisor sub-agent. Accepts function tools and OpenRouter server tools (e.g. openrouter:web_search). The advisor tool may not list itself."""
|
||||
r"""A tool made available to the advisor sub-agent. Only OpenRouter server tools (e.g. openrouter:web_search) are supported; function tools are rejected because the advisor has no way to execute them. The advisor tool may not list itself."""
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
|
||||
@@ -26,8 +25,6 @@ class AdvisorNestedTool(BaseModel):
|
||||
|
||||
type: str
|
||||
|
||||
function: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
parameters: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
@property
|
||||
|
||||
@@ -30,7 +30,7 @@ class AdvisorServerToolConfigTypedDict(TypedDict):
|
||||
temperature: NotRequired[float]
|
||||
r"""Sampling temperature forwarded to the advisor call. When omitted, the provider's default applies."""
|
||||
tools: NotRequired[List[AdvisorNestedToolTypedDict]]
|
||||
r"""Tools the advisor sub-agent may use while forming its advice. The advisor runs as an agentic sub-agent over these tools, then returns its text. Must not include the advisor tool itself."""
|
||||
r"""Tools the advisor sub-agent may use while forming its advice. The advisor runs as an agentic sub-agent over these tools, then returns its text. Only OpenRouter server tools are supported — function tools are rejected — and the list must not include the advisor tool itself."""
|
||||
|
||||
|
||||
class AdvisorServerToolConfig(BaseModel):
|
||||
@@ -64,4 +64,4 @@ class AdvisorServerToolConfig(BaseModel):
|
||||
r"""Sampling temperature forwarded to the advisor call. When omitted, the provider's default applies."""
|
||||
|
||||
tools: Optional[List[AdvisorNestedTool]] = None
|
||||
r"""Tools the advisor sub-agent may use while forming its advice. The advisor runs as an agentic sub-agent over these tools, then returns its text. Must not include the advisor tool itself."""
|
||||
r"""Tools the advisor sub-agent may use while forming its advice. The advisor runs as an agentic sub-agent over these tools, then returns its text. Only OpenRouter server tools are supported — function tools are rejected — and the list must not include the advisor tool itself."""
|
||||
|
||||
@@ -9,6 +9,10 @@ from .anthropiccachecontroldirective import (
|
||||
AnthropicCacheControlDirective,
|
||||
AnthropicCacheControlDirectiveTypedDict,
|
||||
)
|
||||
from .anthropicfiledocumentsource import (
|
||||
AnthropicFileDocumentSource,
|
||||
AnthropicFileDocumentSourceTypedDict,
|
||||
)
|
||||
from .anthropicimageblockparam import (
|
||||
AnthropicImageBlockParam,
|
||||
AnthropicImageBlockParamTypedDict,
|
||||
@@ -89,6 +93,7 @@ AnthropicDocumentBlockParamSourceUnionTypedDict = TypeAliasType(
|
||||
Union[
|
||||
SourceContentTypedDict,
|
||||
AnthropicURLPdfSourceTypedDict,
|
||||
AnthropicFileDocumentSourceTypedDict,
|
||||
AnthropicBase64PdfSourceTypedDict,
|
||||
AnthropicPlainTextSourceTypedDict,
|
||||
],
|
||||
@@ -101,6 +106,7 @@ AnthropicDocumentBlockParamSourceUnion = Annotated[
|
||||
Annotated[AnthropicPlainTextSource, Tag("text")],
|
||||
Annotated[SourceContent, Tag("content")],
|
||||
Annotated[AnthropicURLPdfSource, Tag("url")],
|
||||
Annotated[AnthropicFileDocumentSource, Tag("file")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
"""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
|
||||
|
||||
|
||||
AnthropicFileDocumentSourceType = Literal["file",]
|
||||
|
||||
|
||||
class AnthropicFileDocumentSourceTypedDict(TypedDict):
|
||||
file_id: str
|
||||
type: AnthropicFileDocumentSourceType
|
||||
|
||||
|
||||
class AnthropicFileDocumentSource(BaseModel):
|
||||
file_id: str
|
||||
|
||||
type: AnthropicFileDocumentSourceType
|
||||
@@ -0,0 +1,24 @@
|
||||
"""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 BenchmarkPricingTypedDict(TypedDict):
|
||||
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
|
||||
|
||||
completion: str
|
||||
r"""Cost per output token (USD, decimal string)."""
|
||||
prompt: str
|
||||
r"""Cost per input token (USD, decimal string)."""
|
||||
|
||||
|
||||
class BenchmarkPricing(BaseModel):
|
||||
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
|
||||
|
||||
completion: str
|
||||
r"""Cost per output token (USD, decimal string)."""
|
||||
|
||||
prompt: str
|
||||
r"""Cost per input token (USD, decimal string)."""
|
||||
@@ -0,0 +1,77 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict
|
||||
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
|
||||
from pydantic import model_serializer
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class BenchmarksAAItemTypedDict(TypedDict):
|
||||
aa_name: str
|
||||
r"""Model name as listed on Artificial Analysis."""
|
||||
agentic_index: Nullable[float]
|
||||
r"""Artificial Analysis Agentic Index composite score. Higher is better."""
|
||||
coding_index: Nullable[float]
|
||||
r"""Artificial Analysis Coding Index composite score. Higher is better."""
|
||||
intelligence_index: Nullable[float]
|
||||
r"""Artificial Analysis Intelligence Index composite score. Higher is better."""
|
||||
model_permaslug: str
|
||||
r"""Stable OpenRouter model identifier."""
|
||||
pricing: Nullable[BenchmarkPricingTypedDict]
|
||||
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
|
||||
|
||||
|
||||
class BenchmarksAAItem(BaseModel):
|
||||
aa_name: str
|
||||
r"""Model name as listed on Artificial Analysis."""
|
||||
|
||||
agentic_index: Nullable[float]
|
||||
r"""Artificial Analysis Agentic Index composite score. Higher is better."""
|
||||
|
||||
coding_index: Nullable[float]
|
||||
r"""Artificial Analysis Coding Index composite score. Higher is better."""
|
||||
|
||||
intelligence_index: Nullable[float]
|
||||
r"""Artificial Analysis Intelligence Index composite score. Higher is better."""
|
||||
|
||||
model_permaslug: str
|
||||
r"""Stable OpenRouter model identifier."""
|
||||
|
||||
pricing: Nullable[BenchmarkPricing]
|
||||
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = [
|
||||
"agentic_index",
|
||||
"coding_index",
|
||||
"intelligence_index",
|
||||
"pricing",
|
||||
]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,53 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel
|
||||
from typing import Literal
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
BenchmarksAAMetaSource = Literal["artificial-analysis",]
|
||||
r"""Data source identifier."""
|
||||
|
||||
|
||||
BenchmarksAAMetaSourceURL = Literal["https://artificialanalysis.ai",]
|
||||
r"""URL of the upstream data source."""
|
||||
|
||||
|
||||
BenchmarksAAMetaVersion = Literal["v1",]
|
||||
r"""Dataset version."""
|
||||
|
||||
|
||||
class BenchmarksAAMetaTypedDict(TypedDict):
|
||||
as_of: str
|
||||
r"""ISO-8601 timestamp of when this data was last updated."""
|
||||
citation: str
|
||||
r"""Required attribution when republishing this data."""
|
||||
model_count: int
|
||||
r"""Number of unique models in the response."""
|
||||
source: BenchmarksAAMetaSource
|
||||
r"""Data source identifier."""
|
||||
source_url: BenchmarksAAMetaSourceURL
|
||||
r"""URL of the upstream data source."""
|
||||
version: BenchmarksAAMetaVersion
|
||||
r"""Dataset version."""
|
||||
|
||||
|
||||
class BenchmarksAAMeta(BaseModel):
|
||||
as_of: str
|
||||
r"""ISO-8601 timestamp of when this data was last updated."""
|
||||
|
||||
citation: str
|
||||
r"""Required attribution when republishing this data."""
|
||||
|
||||
model_count: int
|
||||
r"""Number of unique models in the response."""
|
||||
|
||||
source: BenchmarksAAMetaSource
|
||||
r"""Data source identifier."""
|
||||
|
||||
source_url: BenchmarksAAMetaSourceURL
|
||||
r"""URL of the upstream data source."""
|
||||
|
||||
version: BenchmarksAAMetaVersion
|
||||
r"""Dataset version."""
|
||||
@@ -0,0 +1,19 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .benchmarksaaitem import BenchmarksAAItem, BenchmarksAAItemTypedDict
|
||||
from .benchmarksaameta import BenchmarksAAMeta, BenchmarksAAMetaTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class BenchmarksAAResponseTypedDict(TypedDict):
|
||||
data: List[BenchmarksAAItemTypedDict]
|
||||
meta: BenchmarksAAMetaTypedDict
|
||||
|
||||
|
||||
class BenchmarksAAResponse(BaseModel):
|
||||
data: List[BenchmarksAAItem]
|
||||
|
||||
meta: BenchmarksAAMeta
|
||||
@@ -0,0 +1,147 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .benchmarkpricing import BenchmarkPricing, BenchmarkPricingTypedDict
|
||||
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
|
||||
from pydantic import model_serializer
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class TournamentStatsTypedDict(TypedDict):
|
||||
r"""Placement distribution from tournament matches."""
|
||||
|
||||
first_place: Nullable[int]
|
||||
fourth_place: Nullable[int]
|
||||
second_place: Nullable[int]
|
||||
third_place: Nullable[int]
|
||||
total: Nullable[int]
|
||||
|
||||
|
||||
class TournamentStats(BaseModel):
|
||||
r"""Placement distribution from tournament matches."""
|
||||
|
||||
first_place: Nullable[int]
|
||||
|
||||
fourth_place: Nullable[int]
|
||||
|
||||
second_place: Nullable[int]
|
||||
|
||||
third_place: Nullable[int]
|
||||
|
||||
total: Nullable[int]
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = [
|
||||
"first_place",
|
||||
"fourth_place",
|
||||
"second_place",
|
||||
"third_place",
|
||||
"total",
|
||||
]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
class BenchmarksDAItemTypedDict(TypedDict):
|
||||
arena: str
|
||||
r"""Arena this ranking belongs to."""
|
||||
avg_generation_time_ms: Nullable[float]
|
||||
r"""Average generation time in milliseconds."""
|
||||
category: str
|
||||
r"""Category within the arena."""
|
||||
display_name: str
|
||||
r"""Human-readable model name from Design Arena."""
|
||||
elo: float
|
||||
r"""ELO rating from head-to-head arena battles."""
|
||||
model_permaslug: str
|
||||
r"""Stable OpenRouter model identifier when the model is on OpenRouter; otherwise the upstream Design Arena model id. Use pricing != null to detect OpenRouter-mapped models."""
|
||||
pricing: Nullable[BenchmarkPricingTypedDict]
|
||||
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
|
||||
tournament_stats: TournamentStatsTypedDict
|
||||
r"""Placement distribution from tournament matches."""
|
||||
win_rate: float
|
||||
r"""Win rate as a percentage (0–100)."""
|
||||
|
||||
|
||||
class BenchmarksDAItem(BaseModel):
|
||||
arena: str
|
||||
r"""Arena this ranking belongs to."""
|
||||
|
||||
avg_generation_time_ms: Nullable[float]
|
||||
r"""Average generation time in milliseconds."""
|
||||
|
||||
category: str
|
||||
r"""Category within the arena."""
|
||||
|
||||
display_name: str
|
||||
r"""Human-readable model name from Design Arena."""
|
||||
|
||||
elo: float
|
||||
r"""ELO rating from head-to-head arena battles."""
|
||||
|
||||
model_permaslug: str
|
||||
r"""Stable OpenRouter model identifier when the model is on OpenRouter; otherwise the upstream Design Arena model id. Use pricing != null to detect OpenRouter-mapped models."""
|
||||
|
||||
pricing: Nullable[BenchmarkPricing]
|
||||
r"""OpenRouter pricing per token for this model. Null if pricing is unavailable."""
|
||||
|
||||
tournament_stats: TournamentStats
|
||||
r"""Placement distribution from tournament matches."""
|
||||
|
||||
win_rate: float
|
||||
r"""Win rate as a percentage (0–100)."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = ["avg_generation_time_ms", "pricing"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,118 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
|
||||
from pydantic import model_serializer
|
||||
from typing import Literal
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class EloBoundsTypedDict(TypedDict):
|
||||
r"""ELO range across all returned models for normalization."""
|
||||
|
||||
max: float
|
||||
r"""Maximum ELO in the result set."""
|
||||
min: float
|
||||
r"""Minimum ELO in the result set."""
|
||||
|
||||
|
||||
class EloBounds(BaseModel):
|
||||
r"""ELO range across all returned models for normalization."""
|
||||
|
||||
max: float
|
||||
r"""Maximum ELO in the result set."""
|
||||
|
||||
min: float
|
||||
r"""Minimum ELO in the result set."""
|
||||
|
||||
|
||||
BenchmarksDAMetaSource = Literal["design-arena",]
|
||||
r"""Data source identifier."""
|
||||
|
||||
|
||||
BenchmarksDAMetaSourceURL = Literal["https://www.designarena.ai",]
|
||||
r"""URL of the upstream data source."""
|
||||
|
||||
|
||||
BenchmarksDAMetaVersion = Literal["v1",]
|
||||
r"""Dataset version."""
|
||||
|
||||
|
||||
class BenchmarksDAMetaTypedDict(TypedDict):
|
||||
arena: str
|
||||
r"""The arena filter applied."""
|
||||
as_of: str
|
||||
r"""ISO-8601 timestamp of when this data was generated."""
|
||||
category: Nullable[str]
|
||||
r"""The category filter applied, or null if showing all."""
|
||||
citation: str
|
||||
r"""Required attribution when republishing this data."""
|
||||
elo_bounds: EloBoundsTypedDict
|
||||
r"""ELO range across all returned models for normalization."""
|
||||
model_count: int
|
||||
r"""Number of unique models in the response."""
|
||||
source: BenchmarksDAMetaSource
|
||||
r"""Data source identifier."""
|
||||
source_url: BenchmarksDAMetaSourceURL
|
||||
r"""URL of the upstream data source."""
|
||||
version: BenchmarksDAMetaVersion
|
||||
r"""Dataset version."""
|
||||
|
||||
|
||||
class BenchmarksDAMeta(BaseModel):
|
||||
arena: str
|
||||
r"""The arena filter applied."""
|
||||
|
||||
as_of: str
|
||||
r"""ISO-8601 timestamp of when this data was generated."""
|
||||
|
||||
category: Nullable[str]
|
||||
r"""The category filter applied, or null if showing all."""
|
||||
|
||||
citation: str
|
||||
r"""Required attribution when republishing this data."""
|
||||
|
||||
elo_bounds: EloBounds
|
||||
r"""ELO range across all returned models for normalization."""
|
||||
|
||||
model_count: int
|
||||
r"""Number of unique models in the response."""
|
||||
|
||||
source: BenchmarksDAMetaSource
|
||||
r"""Data source identifier."""
|
||||
|
||||
source_url: BenchmarksDAMetaSourceURL
|
||||
r"""URL of the upstream data source."""
|
||||
|
||||
version: BenchmarksDAMetaVersion
|
||||
r"""Dataset version."""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = ["category"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,19 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .benchmarksdaitem import BenchmarksDAItem, BenchmarksDAItemTypedDict
|
||||
from .benchmarksdameta import BenchmarksDAMeta, BenchmarksDAMetaTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class BenchmarksDAResponseTypedDict(TypedDict):
|
||||
data: List[BenchmarksDAItemTypedDict]
|
||||
meta: BenchmarksDAMetaTypedDict
|
||||
|
||||
|
||||
class BenchmarksDAResponse(BaseModel):
|
||||
data: List[BenchmarksDAItem]
|
||||
|
||||
meta: BenchmarksDAMeta
|
||||
@@ -27,6 +27,10 @@ from .openrouterwebsearchservertool import (
|
||||
OpenRouterWebSearchServerTool,
|
||||
OpenRouterWebSearchServerToolTypedDict,
|
||||
)
|
||||
from .subagentservertool_openrouter import (
|
||||
SubagentServerToolOpenRouter,
|
||||
SubagentServerToolOpenRouterTypedDict,
|
||||
)
|
||||
from .webfetchservertool import WebFetchServerTool, WebFetchServerToolTypedDict
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
@@ -129,6 +133,7 @@ ChatFunctionToolTypedDict = TypeAliasType(
|
||||
DatetimeServerToolTypedDict,
|
||||
ImageGenerationServerToolOpenRouterTypedDict,
|
||||
ChatSearchModelsServerToolTypedDict,
|
||||
SubagentServerToolOpenRouterTypedDict,
|
||||
WebFetchServerToolTypedDict,
|
||||
OpenRouterWebSearchServerToolTypedDict,
|
||||
ChatFunctionToolFunctionTypedDict,
|
||||
@@ -150,6 +155,7 @@ ChatFunctionTool = Annotated[
|
||||
Annotated[
|
||||
ChatSearchModelsServerTool, Tag("openrouter:experimental__search_models")
|
||||
],
|
||||
Annotated[SubagentServerToolOpenRouter, Tag("openrouter:subagent")],
|
||||
Annotated[WebFetchServerTool, Tag("openrouter:web_fetch")],
|
||||
Annotated[OpenRouterWebSearchServerTool, Tag("openrouter:web_search")],
|
||||
Annotated[ChatWebSearchShorthand, Tag("web_search")],
|
||||
|
||||
@@ -170,6 +170,20 @@ class ChatRequestReasoning(BaseModel):
|
||||
return m
|
||||
|
||||
|
||||
ChatRequestReasoningEffort = Union[
|
||||
Literal[
|
||||
"xhigh",
|
||||
"high",
|
||||
"medium",
|
||||
"low",
|
||||
"minimal",
|
||||
"none",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ."""
|
||||
|
||||
|
||||
ResponseFormatTypedDict = TypeAliasType(
|
||||
"ResponseFormatTypedDict",
|
||||
Union[
|
||||
@@ -240,6 +254,8 @@ class ChatRequestTypedDict(TypedDict):
|
||||
r"""Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16."""
|
||||
metadata: NotRequired[Dict[str, str]]
|
||||
r"""Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)"""
|
||||
min_p: NotRequired[Nullable[float]]
|
||||
r"""Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter."""
|
||||
modalities: NotRequired[List[Modality]]
|
||||
r"""Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\"."""
|
||||
model: NotRequired[str]
|
||||
@@ -256,6 +272,10 @@ class ChatRequestTypedDict(TypedDict):
|
||||
r"""When multiple model providers are available, optionally indicate your routing preference."""
|
||||
reasoning: NotRequired[ChatRequestReasoningTypedDict]
|
||||
r"""Configuration options for reasoning models"""
|
||||
reasoning_effort: NotRequired[Nullable[ChatRequestReasoningEffort]]
|
||||
r"""Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ."""
|
||||
repetition_penalty: NotRequired[Nullable[float]]
|
||||
r"""Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter."""
|
||||
response_format: NotRequired[ResponseFormatTypedDict]
|
||||
r"""Response format configuration"""
|
||||
seed: NotRequired[Nullable[int]]
|
||||
@@ -278,6 +298,10 @@ class ChatRequestTypedDict(TypedDict):
|
||||
r"""Tool choice configuration"""
|
||||
tools: NotRequired[List[ChatFunctionToolTypedDict]]
|
||||
r"""Available tools for function calling"""
|
||||
top_a: NotRequired[Nullable[float]]
|
||||
r"""Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter."""
|
||||
top_k: NotRequired[Nullable[int]]
|
||||
r"""Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter."""
|
||||
top_logprobs: NotRequired[Nullable[int]]
|
||||
r"""Number of top log probabilities to return (0-20)"""
|
||||
top_p: NotRequired[Nullable[float]]
|
||||
@@ -321,6 +345,9 @@ class ChatRequest(BaseModel):
|
||||
metadata: Optional[Dict[str, str]] = None
|
||||
r"""Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)"""
|
||||
|
||||
min_p: OptionalNullable[float] = UNSET
|
||||
r"""Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter."""
|
||||
|
||||
modalities: Optional[
|
||||
List[Annotated[Modality, PlainValidator(validate_open_enum(False))]]
|
||||
] = None
|
||||
@@ -347,6 +374,15 @@ class ChatRequest(BaseModel):
|
||||
reasoning: Optional[ChatRequestReasoning] = None
|
||||
r"""Configuration options for reasoning models"""
|
||||
|
||||
reasoning_effort: Annotated[
|
||||
OptionalNullable[ChatRequestReasoningEffort],
|
||||
PlainValidator(validate_open_enum(False)),
|
||||
] = UNSET
|
||||
r"""Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ."""
|
||||
|
||||
repetition_penalty: OptionalNullable[float] = UNSET
|
||||
r"""Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter."""
|
||||
|
||||
response_format: Optional[ResponseFormat] = None
|
||||
r"""Response format configuration"""
|
||||
|
||||
@@ -383,6 +419,12 @@ class ChatRequest(BaseModel):
|
||||
tools: Optional[List[ChatFunctionTool]] = None
|
||||
r"""Available tools for function calling"""
|
||||
|
||||
top_a: OptionalNullable[float] = UNSET
|
||||
r"""Consider only tokens with \"sufficiently high\" probabilities based on the probability of the most likely token. Not all providers support this parameter."""
|
||||
|
||||
top_k: OptionalNullable[int] = UNSET
|
||||
r"""Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter."""
|
||||
|
||||
top_logprobs: OptionalNullable[int] = UNSET
|
||||
r"""Number of top log probabilities to return (0-20)"""
|
||||
|
||||
@@ -407,6 +449,7 @@ class ChatRequest(BaseModel):
|
||||
"max_completion_tokens",
|
||||
"max_tokens",
|
||||
"metadata",
|
||||
"min_p",
|
||||
"modalities",
|
||||
"model",
|
||||
"models",
|
||||
@@ -415,6 +458,8 @@ class ChatRequest(BaseModel):
|
||||
"presence_penalty",
|
||||
"provider",
|
||||
"reasoning",
|
||||
"reasoning_effort",
|
||||
"repetition_penalty",
|
||||
"response_format",
|
||||
"seed",
|
||||
"service_tier",
|
||||
@@ -426,6 +471,8 @@ class ChatRequest(BaseModel):
|
||||
"temperature",
|
||||
"tool_choice",
|
||||
"tools",
|
||||
"top_a",
|
||||
"top_k",
|
||||
"top_logprobs",
|
||||
"top_p",
|
||||
"trace",
|
||||
@@ -437,14 +484,19 @@ class ChatRequest(BaseModel):
|
||||
"logprobs",
|
||||
"max_completion_tokens",
|
||||
"max_tokens",
|
||||
"min_p",
|
||||
"parallel_tool_calls",
|
||||
"presence_penalty",
|
||||
"provider",
|
||||
"reasoning_effort",
|
||||
"repetition_penalty",
|
||||
"seed",
|
||||
"service_tier",
|
||||
"stop",
|
||||
"stream_options",
|
||||
"temperature",
|
||||
"top_a",
|
||||
"top_k",
|
||||
"top_logprobs",
|
||||
"top_p",
|
||||
]
|
||||
|
||||
@@ -31,20 +31,20 @@ class ChatWebSearchShorthandTypedDict(TypedDict):
|
||||
|
||||
type: ChatWebSearchShorthandType
|
||||
allowed_domains: NotRequired[List[str]]
|
||||
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains."""
|
||||
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains."""
|
||||
engine: NotRequired[WebSearchEngineEnum]
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API."""
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
excluded_domains: NotRequired[List[str]]
|
||||
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains."""
|
||||
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). Cannot be used with allowed_domains."""
|
||||
max_characters: NotRequired[int]
|
||||
r"""Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel)."""
|
||||
r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity)."""
|
||||
max_results: NotRequired[int]
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
max_total_results: NotRequired[int]
|
||||
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified."""
|
||||
parameters: NotRequired[WebSearchConfigTypedDict]
|
||||
search_context_size: NotRequired[SearchQualityLevel]
|
||||
r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set."""
|
||||
r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set."""
|
||||
user_location: NotRequired[WebSearchUserLocationServerToolTypedDict]
|
||||
r"""Approximate user location for location-biased results."""
|
||||
|
||||
@@ -57,21 +57,21 @@ class ChatWebSearchShorthand(BaseModel):
|
||||
]
|
||||
|
||||
allowed_domains: Optional[List[str]] = None
|
||||
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains."""
|
||||
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains."""
|
||||
|
||||
engine: Annotated[
|
||||
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API."""
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
|
||||
excluded_domains: Optional[List[str]] = None
|
||||
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains."""
|
||||
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). Cannot be used with allowed_domains."""
|
||||
|
||||
max_characters: Optional[int] = None
|
||||
r"""Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel)."""
|
||||
r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity)."""
|
||||
|
||||
max_results: Optional[int] = None
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
|
||||
max_total_results: Optional[int] = None
|
||||
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified."""
|
||||
@@ -81,7 +81,7 @@ class ChatWebSearchShorthand(BaseModel):
|
||||
search_context_size: Annotated[
|
||||
Optional[SearchQualityLevel], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set."""
|
||||
r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set."""
|
||||
|
||||
user_location: Optional[WebSearchUserLocationServerTool] = None
|
||||
r"""Approximate user location for location-biased results."""
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
"""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 DABenchmarkEntryTypedDict(TypedDict):
|
||||
r"""A single Design Arena benchmark entry for a specific arena+category"""
|
||||
|
||||
arena: str
|
||||
r"""Arena type (e.g. models, builders, agents)"""
|
||||
category: str
|
||||
r"""Category within the arena (e.g. website, gamedev, uicomponent)"""
|
||||
elo: float
|
||||
r"""ELO rating from head-to-head arena battles"""
|
||||
rank: int
|
||||
r"""Rank position within this arena+category among models available on OpenRouter (1 = highest ELO)"""
|
||||
win_rate: float
|
||||
r"""Win rate percentage in arena battles"""
|
||||
|
||||
|
||||
class DABenchmarkEntry(BaseModel):
|
||||
r"""A single Design Arena benchmark entry for a specific arena+category"""
|
||||
|
||||
arena: str
|
||||
r"""Arena type (e.g. models, builders, agents)"""
|
||||
|
||||
category: str
|
||||
r"""Category within the arena (e.g. website, gamedev, uicomponent)"""
|
||||
|
||||
elo: float
|
||||
r"""ELO rating from head-to-head arena battles"""
|
||||
|
||||
rank: int
|
||||
r"""Rank position within this arena+category among models available on OpenRouter (1 = highest ELO)"""
|
||||
|
||||
win_rate: float
|
||||
r"""Win rate percentage in arena battles"""
|
||||
@@ -0,0 +1,22 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import validate_const
|
||||
import pydantic
|
||||
from pydantic.functional_validators import AfterValidator
|
||||
from typing import Literal
|
||||
from typing_extensions import Annotated, TypedDict
|
||||
|
||||
|
||||
class DeleteWorkspaceBudgetResponseTypedDict(TypedDict):
|
||||
deleted: Literal[True]
|
||||
r"""Confirmation that the budget was deleted (or did not exist)"""
|
||||
|
||||
|
||||
class DeleteWorkspaceBudgetResponse(BaseModel):
|
||||
DELETED: Annotated[
|
||||
Annotated[Literal[True], AfterValidator(validate_const(True))],
|
||||
pydantic.Field(alias="deleted"),
|
||||
] = True
|
||||
r"""Confirmation that the budget was deleted (or did not exist)"""
|
||||
@@ -0,0 +1,24 @@
|
||||
"""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
|
||||
|
||||
|
||||
FileDeleteResponseType = Literal["file_deleted",]
|
||||
|
||||
|
||||
class FileDeleteResponseTypedDict(TypedDict):
|
||||
r"""Confirmation that a file was deleted."""
|
||||
|
||||
id: str
|
||||
type: FileDeleteResponseType
|
||||
|
||||
|
||||
class FileDeleteResponse(BaseModel):
|
||||
r"""Confirmation that a file was deleted."""
|
||||
|
||||
id: str
|
||||
|
||||
type: FileDeleteResponseType
|
||||
@@ -0,0 +1,64 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .filemetadata import FileMetadata, FileMetadataTypedDict
|
||||
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
|
||||
from pydantic import model_serializer
|
||||
from typing import List
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class FileListResponseTypedDict(TypedDict):
|
||||
r"""A page of files belonging to the requesting workspace."""
|
||||
|
||||
cursor: Nullable[str]
|
||||
r"""Opaque cursor for the next page; null when there are no more results."""
|
||||
data: List[FileMetadataTypedDict]
|
||||
first_id: Nullable[str]
|
||||
has_more: bool
|
||||
last_id: Nullable[str]
|
||||
|
||||
|
||||
class FileListResponse(BaseModel):
|
||||
r"""A page of files belonging to the requesting workspace."""
|
||||
|
||||
cursor: Nullable[str]
|
||||
r"""Opaque cursor for the next page; null when there are no more results."""
|
||||
|
||||
data: List[FileMetadata]
|
||||
|
||||
first_id: Nullable[str]
|
||||
|
||||
has_more: bool
|
||||
|
||||
last_id: Nullable[str]
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = ["cursor", "first_id", "last_id"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,39 @@
|
||||
"""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
|
||||
|
||||
|
||||
FileMetadataType = Literal["file",]
|
||||
|
||||
|
||||
class FileMetadataTypedDict(TypedDict):
|
||||
r"""Metadata describing a stored file."""
|
||||
|
||||
created_at: str
|
||||
downloadable: bool
|
||||
filename: str
|
||||
id: str
|
||||
mime_type: str
|
||||
size_bytes: int
|
||||
type: FileMetadataType
|
||||
|
||||
|
||||
class FileMetadata(BaseModel):
|
||||
r"""Metadata describing a stored file."""
|
||||
|
||||
created_at: str
|
||||
|
||||
downloadable: bool
|
||||
|
||||
filename: str
|
||||
|
||||
id: str
|
||||
|
||||
mime_type: str
|
||||
|
||||
size_bytes: int
|
||||
|
||||
type: FileMetadataType
|
||||
@@ -1,14 +1,26 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel, Nullable
|
||||
from typing import Any, Dict, List, Literal, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
from openrouter.types import BaseModel, Nullable, UnrecognizedStr
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import Any, Dict, List, Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
FusionPluginID = Literal["fusion",]
|
||||
|
||||
|
||||
PresetEnum = Union[
|
||||
Literal[
|
||||
"general-high",
|
||||
"general-budget",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""A curated OpenRouter fusion preset (slugs follow `<task>-<tier>`, e.g. `general-high`). Expands server-side into the preset's analysis_models panel and judge model, so callers never name individual models. Explicitly provided `analysis_models` / `model` take precedence."""
|
||||
|
||||
|
||||
class FusionPluginToolTypedDict(TypedDict):
|
||||
type: str
|
||||
r"""Server tool type identifier (e.g. \"openrouter:web_search\", \"openrouter:web_fetch\")."""
|
||||
@@ -34,6 +46,8 @@ class FusionPluginTypedDict(TypedDict):
|
||||
r"""Maximum number of tool-calling steps each panelist (analysis model) and the judge model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 8. Capped at 16."""
|
||||
model: NotRequired[str]
|
||||
r"""Slug of the model that performs both the judge step (with web_search + web_fetch) and the final synthesis. When omitted, defaults to the first model in the Quality preset."""
|
||||
preset: NotRequired[PresetEnum]
|
||||
r"""A curated OpenRouter fusion preset (slugs follow `<task>-<tier>`, e.g. `general-high`). Expands server-side into the preset's analysis_models panel and judge model, so callers never name individual models. Explicitly provided `analysis_models` / `model` take precedence."""
|
||||
tools: NotRequired[List[FusionPluginToolTypedDict]]
|
||||
r"""Server tools available to panelist and judge inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: \"openrouter:web_search\" }, { type: \"openrouter:web_fetch\" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only)."""
|
||||
|
||||
@@ -53,5 +67,10 @@ class FusionPlugin(BaseModel):
|
||||
model: Optional[str] = None
|
||||
r"""Slug of the model that performs both the judge step (with web_search + web_fetch) and the final synthesis. When omitted, defaults to the first model in the Quality preset."""
|
||||
|
||||
preset: Annotated[
|
||||
Optional[PresetEnum], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
r"""A curated OpenRouter fusion preset (slugs follow `<task>-<tier>`, e.g. `general-high`). Expands server-side into the preset's analysis_models panel and judge model, so callers never name individual models. Explicitly provided `analysis_models` / `model` take precedence."""
|
||||
|
||||
tools: Optional[List[FusionPluginTool]] = None
|
||||
r"""Server tools available to panelist and judge inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: \"openrouter:web_search\" }, { type: \"openrouter:web_fetch\" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only)."""
|
||||
|
||||
@@ -84,6 +84,10 @@ from .outputfunctioncallitem import (
|
||||
OutputFunctionCallItem,
|
||||
OutputFunctionCallItemTypedDict,
|
||||
)
|
||||
from .outputfusionservertoolitem import (
|
||||
OutputFusionServerToolItem,
|
||||
OutputFusionServerToolItemTypedDict,
|
||||
)
|
||||
from .outputimagegenerationcallitem import (
|
||||
OutputImageGenerationCallItem,
|
||||
OutputImageGenerationCallItemTypedDict,
|
||||
@@ -104,6 +108,10 @@ from .outputsearchmodelsservertoolitem import (
|
||||
OutputSearchModelsServerToolItem,
|
||||
OutputSearchModelsServerToolItemTypedDict,
|
||||
)
|
||||
from .outputsubagentservertoolitem import (
|
||||
OutputSubagentServerToolItem,
|
||||
OutputSubagentServerToolItemTypedDict,
|
||||
)
|
||||
from .outputtexteditorservertoolitem import (
|
||||
OutputTextEditorServerToolItem,
|
||||
OutputTextEditorServerToolItemTypedDict,
|
||||
@@ -388,44 +396,46 @@ InputsUnion1TypedDict = TypeAliasType(
|
||||
OutputFileSearchCallItemTypedDict,
|
||||
EasyInputMessageTypedDict,
|
||||
InputMessageItemTypedDict,
|
||||
CustomToolCallOutputItemTypedDict,
|
||||
LocalShellCallOutputItemTypedDict,
|
||||
OutputToolSearchServerToolItemTypedDict,
|
||||
OutputFileSearchServerToolItemTypedDict,
|
||||
OutputWebSearchServerToolItemTypedDict,
|
||||
CustomToolCallOutputItemTypedDict,
|
||||
OutputImageGenerationCallItemTypedDict,
|
||||
OutputWebSearchCallItemTypedDict,
|
||||
OutputDatetimeItemTypedDict,
|
||||
OutputMcpServerToolItemTypedDict,
|
||||
FunctionCallOutputItemTypedDict,
|
||||
LocalShellCallItemTypedDict,
|
||||
OutputSearchModelsServerToolItemTypedDict,
|
||||
FunctionCallOutputItemTypedDict,
|
||||
ApplyPatchCallItemTypedDict,
|
||||
OutputDatetimeItemTypedDict,
|
||||
McpApprovalResponseItemTypedDict,
|
||||
McpApprovalRequestItemTypedDict,
|
||||
McpListToolsItemTypedDict,
|
||||
ApplyPatchCallOutputItemTypedDict,
|
||||
McpApprovalResponseItemTypedDict,
|
||||
OutputBrowserUseServerToolItemTypedDict,
|
||||
McpApprovalRequestItemTypedDict,
|
||||
OutputMcpServerToolItemTypedDict,
|
||||
OutputTextEditorServerToolItemTypedDict,
|
||||
OutputApplyPatchServerToolItemTypedDict,
|
||||
CustomToolCallItemTypedDict,
|
||||
ShellCallItemTypedDict,
|
||||
InputsMessageTypedDict,
|
||||
OutputMemoryServerToolItemTypedDict,
|
||||
OutputCustomToolCallItemTypedDict,
|
||||
ShellCallItemTypedDict,
|
||||
ShellCallOutputItemTypedDict,
|
||||
OutputComputerCallItemTypedDict,
|
||||
OutputCodeInterpreterCallItemTypedDict,
|
||||
OutputImageGenerationServerToolItemTypedDict,
|
||||
OutputBashServerToolItemTypedDict,
|
||||
OutputCustomToolCallItemTypedDict,
|
||||
OutputComputerCallItemTypedDict,
|
||||
CustomToolCallItemTypedDict,
|
||||
ShellCallOutputItemTypedDict,
|
||||
McpCallItemTypedDict,
|
||||
OutputImageGenerationServerToolItemTypedDict,
|
||||
OutputFunctionCallItemTypedDict,
|
||||
OutputBashServerToolItemTypedDict,
|
||||
FunctionCallItemTypedDict,
|
||||
OutputAdvisorServerToolItemTypedDict,
|
||||
OutputWebFetchServerToolItemTypedDict,
|
||||
ReasoningItemTypedDict,
|
||||
OutputCodeInterpreterServerToolItemTypedDict,
|
||||
OutputSubagentServerToolItemTypedDict,
|
||||
InputsReasoningTypedDict,
|
||||
OutputCodeInterpreterServerToolItemTypedDict,
|
||||
OutputWebFetchServerToolItemTypedDict,
|
||||
OutputAdvisorServerToolItemTypedDict,
|
||||
OutputFusionServerToolItemTypedDict,
|
||||
],
|
||||
)
|
||||
|
||||
@@ -438,44 +448,46 @@ InputsUnion1 = TypeAliasType(
|
||||
OutputFileSearchCallItem,
|
||||
EasyInputMessage,
|
||||
InputMessageItem,
|
||||
CustomToolCallOutputItem,
|
||||
LocalShellCallOutputItem,
|
||||
OutputToolSearchServerToolItem,
|
||||
OutputFileSearchServerToolItem,
|
||||
OutputWebSearchServerToolItem,
|
||||
CustomToolCallOutputItem,
|
||||
OutputImageGenerationCallItem,
|
||||
OutputWebSearchCallItem,
|
||||
OutputDatetimeItem,
|
||||
OutputMcpServerToolItem,
|
||||
FunctionCallOutputItem,
|
||||
LocalShellCallItem,
|
||||
OutputSearchModelsServerToolItem,
|
||||
FunctionCallOutputItem,
|
||||
ApplyPatchCallItem,
|
||||
OutputDatetimeItem,
|
||||
McpApprovalResponseItem,
|
||||
McpApprovalRequestItem,
|
||||
McpListToolsItem,
|
||||
ApplyPatchCallOutputItem,
|
||||
McpApprovalResponseItem,
|
||||
OutputBrowserUseServerToolItem,
|
||||
McpApprovalRequestItem,
|
||||
OutputMcpServerToolItem,
|
||||
OutputTextEditorServerToolItem,
|
||||
OutputApplyPatchServerToolItem,
|
||||
CustomToolCallItem,
|
||||
ShellCallItem,
|
||||
InputsMessage,
|
||||
OutputMemoryServerToolItem,
|
||||
OutputCustomToolCallItem,
|
||||
ShellCallItem,
|
||||
ShellCallOutputItem,
|
||||
OutputComputerCallItem,
|
||||
OutputCodeInterpreterCallItem,
|
||||
OutputImageGenerationServerToolItem,
|
||||
OutputBashServerToolItem,
|
||||
OutputCustomToolCallItem,
|
||||
OutputComputerCallItem,
|
||||
CustomToolCallItem,
|
||||
ShellCallOutputItem,
|
||||
McpCallItem,
|
||||
OutputImageGenerationServerToolItem,
|
||||
OutputFunctionCallItem,
|
||||
OutputBashServerToolItem,
|
||||
FunctionCallItem,
|
||||
OutputAdvisorServerToolItem,
|
||||
OutputWebFetchServerToolItem,
|
||||
ReasoningItem,
|
||||
OutputCodeInterpreterServerToolItem,
|
||||
OutputSubagentServerToolItem,
|
||||
InputsReasoning,
|
||||
OutputCodeInterpreterServerToolItem,
|
||||
OutputWebFetchServerToolItem,
|
||||
OutputAdvisorServerToolItem,
|
||||
OutputFusionServerToolItem,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -27,10 +27,10 @@ class LegacyWebSearchServerToolTypedDict(TypedDict):
|
||||
|
||||
type: LegacyWebSearchServerToolType
|
||||
engine: NotRequired[WebSearchEngineEnum]
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API."""
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]]
|
||||
max_results: NotRequired[int]
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
search_context_size: NotRequired[SearchContextSizeEnum]
|
||||
r"""Size of the search context for web search tools"""
|
||||
user_location: NotRequired[Nullable[WebSearchUserLocationTypedDict]]
|
||||
@@ -45,12 +45,12 @@ class LegacyWebSearchServerTool(BaseModel):
|
||||
engine: Annotated[
|
||||
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API."""
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
|
||||
filters: OptionalNullable[WebSearchDomainFilter] = UNSET
|
||||
|
||||
max_results: Optional[int] = None
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
|
||||
search_context_size: Annotated[
|
||||
Optional[SearchContextSizeEnum], PlainValidator(validate_open_enum(False))
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .workspacebudget import WorkspaceBudget, WorkspaceBudgetTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class ListWorkspaceBudgetsResponseTypedDict(TypedDict):
|
||||
data: List[WorkspaceBudgetTypedDict]
|
||||
r"""List of budgets configured for the workspace"""
|
||||
|
||||
|
||||
class ListWorkspaceBudgetsResponse(BaseModel):
|
||||
data: List[WorkspaceBudget]
|
||||
r"""List of budgets configured for the workspace"""
|
||||
@@ -0,0 +1,33 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel, Nullable
|
||||
import pydantic
|
||||
from pydantic import ConfigDict
|
||||
from typing import Any, Dict
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class MessagesFallbackParamTypedDict(TypedDict):
|
||||
r"""Fallback model to try when the primary model fails or refuses. Only the `model` field is supported; per-attempt overrides are rejected."""
|
||||
|
||||
model: str
|
||||
|
||||
|
||||
class MessagesFallbackParam(BaseModel):
|
||||
r"""Fallback model to try when the primary model fails or refuses. Only the `model` field is supported; per-attempt overrides are rejected."""
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
|
||||
)
|
||||
__pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False)
|
||||
|
||||
model: str
|
||||
|
||||
@property
|
||||
def additional_properties(self):
|
||||
return self.__pydantic_extra__
|
||||
|
||||
@additional_properties.setter
|
||||
def additional_properties(self, value):
|
||||
self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
@@ -50,6 +50,7 @@ from .imagegenerationservertool_openrouter import (
|
||||
ImageGenerationServerToolOpenRouter,
|
||||
ImageGenerationServerToolOpenRouterTypedDict,
|
||||
)
|
||||
from .messagesfallbackparam import MessagesFallbackParam, MessagesFallbackParamTypedDict
|
||||
from .messagesmessageparam import MessagesMessageParam, MessagesMessageParamTypedDict
|
||||
from .messagesoutputconfig import MessagesOutputConfig, MessagesOutputConfigTypedDict
|
||||
from .moderationplugin import ModerationPlugin, ModerationPluginTypedDict
|
||||
@@ -1046,6 +1047,8 @@ class MessagesRequestTypedDict(TypedDict):
|
||||
cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict]
|
||||
r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models."""
|
||||
context_management: NotRequired[Nullable[ContextManagementTypedDict]]
|
||||
fallbacks: NotRequired[Nullable[List[MessagesFallbackParamTypedDict]]]
|
||||
r"""Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries."""
|
||||
max_tokens: NotRequired[int]
|
||||
metadata: NotRequired[MetadataTypedDict]
|
||||
models: NotRequired[List[str]]
|
||||
@@ -1088,6 +1091,9 @@ class MessagesRequest(BaseModel):
|
||||
|
||||
context_management: OptionalNullable[ContextManagement] = UNSET
|
||||
|
||||
fallbacks: OptionalNullable[List[MessagesFallbackParam]] = UNSET
|
||||
r"""Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries."""
|
||||
|
||||
max_tokens: Optional[int] = None
|
||||
|
||||
metadata: Optional[Metadata] = None
|
||||
@@ -1144,6 +1150,7 @@ class MessagesRequest(BaseModel):
|
||||
optional_fields = [
|
||||
"cache_control",
|
||||
"context_management",
|
||||
"fallbacks",
|
||||
"max_tokens",
|
||||
"metadata",
|
||||
"models",
|
||||
@@ -1166,7 +1173,13 @@ class MessagesRequest(BaseModel):
|
||||
"trace",
|
||||
"user",
|
||||
]
|
||||
nullable_fields = ["context_management", "messages", "provider", "speed"]
|
||||
nullable_fields = [
|
||||
"context_management",
|
||||
"fallbacks",
|
||||
"messages",
|
||||
"provider",
|
||||
"speed",
|
||||
]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
from .defaultparameters import DefaultParameters, DefaultParametersTypedDict
|
||||
from .modelarchitecture import ModelArchitecture, ModelArchitectureTypedDict
|
||||
from .modelbenchmarks import ModelBenchmarks, ModelBenchmarksTypedDict
|
||||
from .modellinks import ModelLinks, ModelLinksTypedDict
|
||||
from .parameter import Parameter
|
||||
from .perrequestlimits import PerRequestLimits, PerRequestLimitsTypedDict
|
||||
@@ -51,6 +52,8 @@ class ModelTypedDict(TypedDict):
|
||||
r"""List of supported voice identifiers for TTS models. Null for non-TTS models."""
|
||||
top_provider: TopProviderInfoTypedDict
|
||||
r"""Information about the top provider for this model"""
|
||||
benchmarks: NotRequired[ModelBenchmarksTypedDict]
|
||||
r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available."""
|
||||
description: NotRequired[str]
|
||||
r"""Description of the model"""
|
||||
expiration_date: NotRequired[Nullable[str]]
|
||||
@@ -105,6 +108,9 @@ class Model(BaseModel):
|
||||
top_provider: TopProviderInfo
|
||||
r"""Information about the top provider for this model"""
|
||||
|
||||
benchmarks: Optional[ModelBenchmarks] = None
|
||||
r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available."""
|
||||
|
||||
description: Optional[str] = None
|
||||
r"""Description of the model"""
|
||||
|
||||
@@ -120,6 +126,7 @@ class Model(BaseModel):
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
"benchmarks",
|
||||
"description",
|
||||
"expiration_date",
|
||||
"hugging_face_id",
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .aabenchmarkentry import AABenchmarkEntry, AABenchmarkEntryTypedDict
|
||||
from .dabenchmarkentry import DABenchmarkEntry, DABenchmarkEntryTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class ModelBenchmarksTypedDict(TypedDict):
|
||||
r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available."""
|
||||
|
||||
design_arena: List[DABenchmarkEntryTypedDict]
|
||||
r"""Design Arena ELO rankings across arena+category pairs."""
|
||||
artificial_analysis: NotRequired[AABenchmarkEntryTypedDict]
|
||||
r"""Artificial Analysis benchmark index scores."""
|
||||
|
||||
|
||||
class ModelBenchmarks(BaseModel):
|
||||
r"""Third-party benchmark rankings for this model. Omitted when no benchmark data is available."""
|
||||
|
||||
design_arena: List[DABenchmarkEntry]
|
||||
r"""Design Arena ELO rankings across arena+category pairs."""
|
||||
|
||||
artificial_analysis: Optional[AABenchmarkEntry] = None
|
||||
r"""Artificial Analysis benchmark index scores."""
|
||||
@@ -0,0 +1,20 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .model import Model, ModelTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class ModelResponseTypedDict(TypedDict):
|
||||
r"""Single model response"""
|
||||
|
||||
data: ModelTypedDict
|
||||
r"""Information about an AI model available on OpenRouter"""
|
||||
|
||||
|
||||
class ModelResponse(BaseModel):
|
||||
r"""Single model response"""
|
||||
|
||||
data: Model
|
||||
r"""Information about an AI model available on OpenRouter"""
|
||||
@@ -81,6 +81,10 @@ from .outputshellcalloutputitem import (
|
||||
OutputShellCallOutputItem,
|
||||
OutputShellCallOutputItemTypedDict,
|
||||
)
|
||||
from .outputsubagentservertoolitem import (
|
||||
OutputSubagentServerToolItem,
|
||||
OutputSubagentServerToolItemTypedDict,
|
||||
)
|
||||
from .outputtexteditorservertoolitem import (
|
||||
OutputTextEditorServerToolItem,
|
||||
OutputTextEditorServerToolItemTypedDict,
|
||||
@@ -138,6 +142,7 @@ OutputItemsTypedDict = TypeAliasType(
|
||||
OutputReasoningItemTypedDict,
|
||||
OutputFusionServerToolItemTypedDict,
|
||||
OutputAdvisorServerToolItemTypedDict,
|
||||
OutputSubagentServerToolItemTypedDict,
|
||||
],
|
||||
)
|
||||
r"""An output item from the response"""
|
||||
@@ -172,6 +177,7 @@ OutputItems = Annotated[
|
||||
],
|
||||
Annotated[OutputMcpServerToolItem, Tag("openrouter:mcp")],
|
||||
Annotated[OutputMemoryServerToolItem, Tag("openrouter:memory")],
|
||||
Annotated[OutputSubagentServerToolItem, Tag("openrouter:subagent")],
|
||||
Annotated[OutputTextEditorServerToolItem, Tag("openrouter:text_editor")],
|
||||
Annotated[OutputToolSearchServerToolItem, Tag("openrouter:tool_search")],
|
||||
Annotated[OutputWebFetchServerToolItem, Tag("openrouter:web_fetch")],
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .toolcallstatus import ToolCallStatus
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import Literal, Optional
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
OutputSubagentServerToolItemType = Literal["openrouter:subagent",]
|
||||
|
||||
|
||||
class OutputSubagentServerToolItemTypedDict(TypedDict):
|
||||
r"""An openrouter:subagent server tool output item"""
|
||||
|
||||
status: ToolCallStatus
|
||||
type: OutputSubagentServerToolItemType
|
||||
error: NotRequired[str]
|
||||
r"""Error message when the subagent task did not produce an outcome."""
|
||||
id: NotRequired[str]
|
||||
model: NotRequired[str]
|
||||
r"""Slug of the worker model that executed the task."""
|
||||
outcome: NotRequired[str]
|
||||
r"""The worker model's result (the outcome text returned to the delegating model)."""
|
||||
task_description: NotRequired[str]
|
||||
r"""The task description the delegating model sent to the worker."""
|
||||
task_name: NotRequired[str]
|
||||
r"""The short task identifier the delegating model supplied."""
|
||||
|
||||
|
||||
class OutputSubagentServerToolItem(BaseModel):
|
||||
r"""An openrouter:subagent server tool output item"""
|
||||
|
||||
status: Annotated[ToolCallStatus, PlainValidator(validate_open_enum(False))]
|
||||
|
||||
type: OutputSubagentServerToolItemType
|
||||
|
||||
error: Optional[str] = None
|
||||
r"""Error message when the subagent task did not produce an outcome."""
|
||||
|
||||
id: Optional[str] = None
|
||||
|
||||
model: Optional[str] = None
|
||||
r"""Slug of the worker model that executed the task."""
|
||||
|
||||
outcome: Optional[str] = None
|
||||
r"""The worker model's result (the outcome text returned to the delegating model)."""
|
||||
|
||||
task_description: Optional[str] = None
|
||||
r"""The task description the delegating model sent to the worker."""
|
||||
|
||||
task_name: Optional[str] = None
|
||||
r"""The short task identifier the delegating model supplied."""
|
||||
@@ -30,10 +30,10 @@ class Preview20250311WebSearchServerToolTypedDict(TypedDict):
|
||||
|
||||
type: Preview20250311WebSearchServerToolType
|
||||
engine: NotRequired[WebSearchEngineEnum]
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API."""
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]]
|
||||
max_results: NotRequired[int]
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
search_context_size: NotRequired[SearchContextSizeEnum]
|
||||
r"""Size of the search context for web search tools"""
|
||||
user_location: NotRequired[Nullable[PreviewWebSearchUserLocationTypedDict]]
|
||||
@@ -47,12 +47,12 @@ class Preview20250311WebSearchServerTool(BaseModel):
|
||||
engine: Annotated[
|
||||
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API."""
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
|
||||
filters: OptionalNullable[WebSearchDomainFilter] = UNSET
|
||||
|
||||
max_results: Optional[int] = None
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
|
||||
search_context_size: Annotated[
|
||||
Optional[SearchContextSizeEnum], PlainValidator(validate_open_enum(False))
|
||||
|
||||
@@ -30,10 +30,10 @@ class PreviewWebSearchServerToolTypedDict(TypedDict):
|
||||
|
||||
type: PreviewWebSearchServerToolType
|
||||
engine: NotRequired[WebSearchEngineEnum]
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API."""
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]]
|
||||
max_results: NotRequired[int]
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
search_context_size: NotRequired[SearchContextSizeEnum]
|
||||
r"""Size of the search context for web search tools"""
|
||||
user_location: NotRequired[Nullable[PreviewWebSearchUserLocationTypedDict]]
|
||||
@@ -47,12 +47,12 @@ class PreviewWebSearchServerTool(BaseModel):
|
||||
engine: Annotated[
|
||||
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API."""
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
|
||||
filters: OptionalNullable[WebSearchDomainFilter] = UNSET
|
||||
|
||||
max_results: Optional[int] = None
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
|
||||
search_context_size: Annotated[
|
||||
Optional[SearchContextSizeEnum], PlainValidator(validate_open_enum(False))
|
||||
|
||||
@@ -8,7 +8,7 @@ from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class ProviderOptionsTypedDict(TypedDict):
|
||||
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body."""
|
||||
r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
|
||||
|
||||
oneai: NotRequired[Dict[str, Nullable[Any]]]
|
||||
ai21: NotRequired[Dict[str, Nullable[Any]]]
|
||||
@@ -128,7 +128,7 @@ class ProviderOptionsTypedDict(TypedDict):
|
||||
|
||||
|
||||
class ProviderOptions(BaseModel):
|
||||
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body."""
|
||||
r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
|
||||
|
||||
oneai: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="01ai")
|
||||
|
||||
@@ -6,7 +6,7 @@ from typing import Literal
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
Version = Literal["v1",]
|
||||
RankingsDailyMetaVersion = Literal["v1",]
|
||||
r"""Dataset version. Field names and grain are stable for the life of `v1`."""
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class RankingsDailyMetaTypedDict(TypedDict):
|
||||
r"""Resolved end of the date window (UTC, inclusive)."""
|
||||
start_date: str
|
||||
r"""Resolved start of the date window (UTC, inclusive)."""
|
||||
version: Version
|
||||
version: RankingsDailyMetaVersion
|
||||
r"""Dataset version. Field names and grain are stable for the life of `v1`."""
|
||||
|
||||
|
||||
@@ -31,5 +31,5 @@ class RankingsDailyMeta(BaseModel):
|
||||
start_date: str
|
||||
r"""Resolved start of the date window (UTC, inclusive)."""
|
||||
|
||||
version: Version
|
||||
version: RankingsDailyMetaVersion
|
||||
r"""Dataset version. Field names and grain are stable for the life of `v1`."""
|
||||
|
||||
@@ -84,6 +84,10 @@ from .stopservertoolswhencondition import (
|
||||
StopServerToolsWhenConditionTypedDict,
|
||||
)
|
||||
from .storedprompttemplate import StoredPromptTemplate, StoredPromptTemplateTypedDict
|
||||
from .subagentservertool_openrouter import (
|
||||
SubagentServerToolOpenRouter,
|
||||
SubagentServerToolOpenRouterTypedDict,
|
||||
)
|
||||
from .textextendedconfig import TextExtendedConfig, TextExtendedConfigTypedDict
|
||||
from .traceconfig import TraceConfig, TraceConfigTypedDict
|
||||
from .webfetchplugin import WebFetchPlugin, WebFetchPluginTypedDict
|
||||
@@ -217,16 +221,17 @@ ResponsesRequestToolUnionTypedDict = TypeAliasType(
|
||||
CodexLocalShellToolTypedDict,
|
||||
ApplyPatchServerToolTypedDict,
|
||||
ShellServerToolTypedDict,
|
||||
ImageGenerationServerToolOpenRouterTypedDict,
|
||||
ChatSearchModelsServerToolTypedDict,
|
||||
WebFetchServerToolTypedDict,
|
||||
ShellServerToolOpenRouterTypedDict,
|
||||
BashServerToolTypedDict,
|
||||
CodeInterpreterServerToolTypedDict,
|
||||
ApplyPatchServerToolOpenRouterTypedDict,
|
||||
WebSearchServerToolOpenRouterTypedDict,
|
||||
ImageGenerationServerToolOpenRouterTypedDict,
|
||||
WebFetchServerToolTypedDict,
|
||||
FusionServerToolOpenRouterTypedDict,
|
||||
DatetimeServerToolTypedDict,
|
||||
SubagentServerToolOpenRouterTypedDict,
|
||||
AdvisorServerToolOpenRouterTypedDict,
|
||||
CustomToolTypedDict,
|
||||
ComputerUseServerToolTypedDict,
|
||||
@@ -234,8 +239,8 @@ ResponsesRequestToolUnionTypedDict = TypeAliasType(
|
||||
FileSearchServerToolTypedDict,
|
||||
PreviewWebSearchServerToolTypedDict,
|
||||
Preview20250311WebSearchServerToolTypedDict,
|
||||
LegacyWebSearchServerToolTypedDict,
|
||||
WebSearchServerToolTypedDict,
|
||||
LegacyWebSearchServerToolTypedDict,
|
||||
McpServerToolTypedDict,
|
||||
ImageGenerationServerToolTypedDict,
|
||||
],
|
||||
@@ -261,6 +266,7 @@ ResponsesRequestToolUnion = Annotated[
|
||||
Annotated[ApplyPatchServerTool, Tag("apply_patch")],
|
||||
Annotated[CustomTool, Tag("custom")],
|
||||
Annotated[AdvisorServerToolOpenRouter, Tag("openrouter:advisor")],
|
||||
Annotated[SubagentServerToolOpenRouter, Tag("openrouter:subagent")],
|
||||
Annotated[DatetimeServerTool, Tag("openrouter:datetime")],
|
||||
Annotated[FusionServerToolOpenRouter, Tag("openrouter:fusion")],
|
||||
Annotated[
|
||||
|
||||
@@ -13,4 +13,4 @@ SearchQualityLevel = Union[
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set."""
|
||||
r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set."""
|
||||
|
||||
@@ -13,14 +13,14 @@ class SpeechRequestProviderTypedDict(TypedDict):
|
||||
r"""Provider-specific passthrough configuration"""
|
||||
|
||||
options: NotRequired[ProviderOptionsTypedDict]
|
||||
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body."""
|
||||
r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
|
||||
|
||||
|
||||
class SpeechRequestProvider(BaseModel):
|
||||
r"""Provider-specific passthrough configuration"""
|
||||
|
||||
options: Optional[ProviderOptions] = None
|
||||
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body."""
|
||||
r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
|
||||
|
||||
|
||||
ResponseFormatEnum = Union[
|
||||
|
||||
@@ -12,14 +12,14 @@ class STTRequestProviderTypedDict(TypedDict):
|
||||
r"""Provider-specific passthrough configuration"""
|
||||
|
||||
options: NotRequired[ProviderOptionsTypedDict]
|
||||
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body."""
|
||||
r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
|
||||
|
||||
|
||||
class STTRequestProvider(BaseModel):
|
||||
r"""Provider-specific passthrough configuration"""
|
||||
|
||||
options: Optional[ProviderOptions] = None
|
||||
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body."""
|
||||
r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
|
||||
|
||||
|
||||
class STTRequestTypedDict(TypedDict):
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel, Nullable
|
||||
import pydantic
|
||||
from pydantic import ConfigDict
|
||||
from typing import Any, Dict, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class SubagentNestedToolTypedDict(TypedDict):
|
||||
r"""A tool made available to the subagent. Only OpenRouter server tools (e.g. openrouter:web_search) are supported; function tools are rejected because the worker has no way to execute them. The subagent tool may not list itself."""
|
||||
|
||||
type: str
|
||||
parameters: NotRequired[Dict[str, Nullable[Any]]]
|
||||
|
||||
|
||||
class SubagentNestedTool(BaseModel):
|
||||
r"""A tool made available to the subagent. Only OpenRouter server tools (e.g. openrouter:web_search) are supported; function tools are rejected because the worker has no way to execute them. The subagent tool may not list itself."""
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True, arbitrary_types_allowed=True, extra="allow"
|
||||
)
|
||||
__pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False)
|
||||
|
||||
type: str
|
||||
|
||||
parameters: Optional[Dict[str, Nullable[Any]]] = None
|
||||
|
||||
@property
|
||||
def additional_properties(self):
|
||||
return self.__pydantic_extra__
|
||||
|
||||
@additional_properties.setter
|
||||
def additional_properties(self, value):
|
||||
self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
@@ -0,0 +1,43 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel, UnrecognizedStr
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import Literal, Optional, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
SubagentReasoningEffort = Union[
|
||||
Literal[
|
||||
"xhigh",
|
||||
"high",
|
||||
"medium",
|
||||
"low",
|
||||
"minimal",
|
||||
"none",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Reasoning effort level for the subagent call."""
|
||||
|
||||
|
||||
class SubagentReasoningTypedDict(TypedDict):
|
||||
r"""Reasoning configuration forwarded to the subagent call. Use this to control reasoning effort and token budget for models that support extended thinking."""
|
||||
|
||||
effort: NotRequired[SubagentReasoningEffort]
|
||||
r"""Reasoning effort level for the subagent call."""
|
||||
max_tokens: NotRequired[int]
|
||||
r"""Maximum number of reasoning tokens the subagent may use. Accepted and validated but not yet forwarded to the subagent call."""
|
||||
|
||||
|
||||
class SubagentReasoning(BaseModel):
|
||||
r"""Reasoning configuration forwarded to the subagent call. Use this to control reasoning effort and token budget for models that support extended thinking."""
|
||||
|
||||
effort: Annotated[
|
||||
Optional[SubagentReasoningEffort], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
r"""Reasoning effort level for the subagent call."""
|
||||
|
||||
max_tokens: Optional[int] = None
|
||||
r"""Maximum number of reasoning tokens the subagent may use. Accepted and validated but not yet forwarded to the subagent call."""
|
||||
@@ -0,0 +1,30 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .subagentservertoolconfig import (
|
||||
SubagentServerToolConfig,
|
||||
SubagentServerToolConfigTypedDict,
|
||||
)
|
||||
from openrouter.types import BaseModel
|
||||
from typing import Literal, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
SubagentServerToolOpenRouterType = Literal["openrouter:subagent",]
|
||||
|
||||
|
||||
class SubagentServerToolOpenRouterTypedDict(TypedDict):
|
||||
r"""OpenRouter built-in server tool: delegates self-contained tasks to a smaller, cheaper, faster worker model (any OpenRouter model) mid-generation and returns its outcome. The worker may run as a sub-agent with its own tools."""
|
||||
|
||||
type: SubagentServerToolOpenRouterType
|
||||
parameters: NotRequired[SubagentServerToolConfigTypedDict]
|
||||
r"""Configuration for the openrouter:subagent server tool."""
|
||||
|
||||
|
||||
class SubagentServerToolOpenRouter(BaseModel):
|
||||
r"""OpenRouter built-in server tool: delegates self-contained tasks to a smaller, cheaper, faster worker model (any OpenRouter model) mid-generation and returns its outcome. The worker may run as a sub-agent with its own tools."""
|
||||
|
||||
type: SubagentServerToolOpenRouterType
|
||||
|
||||
parameters: Optional[SubagentServerToolConfig] = None
|
||||
r"""Configuration for the openrouter:subagent server tool."""
|
||||
@@ -0,0 +1,52 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .subagentnestedtool import SubagentNestedTool, SubagentNestedToolTypedDict
|
||||
from .subagentreasoning import SubagentReasoning, SubagentReasoningTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class SubagentServerToolConfigTypedDict(TypedDict):
|
||||
r"""Configuration for the openrouter:subagent server tool."""
|
||||
|
||||
instructions: NotRequired[str]
|
||||
r"""System instructions for the subagent. When omitted, the subagent responds with no system prompt of its own."""
|
||||
max_completion_tokens: NotRequired[int]
|
||||
r"""Maximum number of output tokens (including reasoning) the subagent may produce. When omitted, the provider's default applies."""
|
||||
max_tool_calls: NotRequired[int]
|
||||
r"""Maximum number of tool-calling steps the subagent may take during its agentic loop. Capped at 25. Only relevant when the subagent is given tools. Accepted and validated but not yet enforced on the subagent call."""
|
||||
model: NotRequired[str]
|
||||
r"""Slug of the model that executes delegated tasks (any OpenRouter model). Typically a smaller, cheaper, faster model than the one delegating. When omitted, the model from the outer API request is used. The subagent tool itself cannot be the subagent model."""
|
||||
reasoning: NotRequired[SubagentReasoningTypedDict]
|
||||
r"""Reasoning configuration forwarded to the subagent call. Use this to control reasoning effort and token budget for models that support extended thinking."""
|
||||
temperature: NotRequired[float]
|
||||
r"""Sampling temperature forwarded to the subagent call. When omitted, the provider's default applies."""
|
||||
tools: NotRequired[List[SubagentNestedToolTypedDict]]
|
||||
r"""Tools the subagent may use while executing a delegated task. The subagent runs as an agentic sub-agent over these tools, then returns its outcome. Only OpenRouter server tools are supported — function tools are rejected — and the list must not include the subagent tool itself."""
|
||||
|
||||
|
||||
class SubagentServerToolConfig(BaseModel):
|
||||
r"""Configuration for the openrouter:subagent server tool."""
|
||||
|
||||
instructions: Optional[str] = None
|
||||
r"""System instructions for the subagent. When omitted, the subagent responds with no system prompt of its own."""
|
||||
|
||||
max_completion_tokens: Optional[int] = None
|
||||
r"""Maximum number of output tokens (including reasoning) the subagent may produce. When omitted, the provider's default applies."""
|
||||
|
||||
max_tool_calls: Optional[int] = None
|
||||
r"""Maximum number of tool-calling steps the subagent may take during its agentic loop. Capped at 25. Only relevant when the subagent is given tools. Accepted and validated but not yet enforced on the subagent call."""
|
||||
|
||||
model: Optional[str] = None
|
||||
r"""Slug of the model that executes delegated tasks (any OpenRouter model). Typically a smaller, cheaper, faster model than the one delegating. When omitted, the model from the outer API request is used. The subagent tool itself cannot be the subagent model."""
|
||||
|
||||
reasoning: Optional[SubagentReasoning] = None
|
||||
r"""Reasoning configuration forwarded to the subagent call. Use this to control reasoning effort and token budget for models that support extended thinking."""
|
||||
|
||||
temperature: Optional[float] = None
|
||||
r"""Sampling temperature forwarded to the subagent call. When omitted, the provider's default applies."""
|
||||
|
||||
tools: Optional[List[SubagentNestedTool]] = None
|
||||
r"""Tools the subagent may use while executing a delegated task. The subagent runs as an agentic sub-agent over these tools, then returns its outcome. Only OpenRouter server tools are supported — function tools are rejected — and the list must not include the subagent tool itself."""
|
||||
@@ -0,0 +1,15 @@
|
||||
"""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 UpsertWorkspaceBudgetRequestTypedDict(TypedDict):
|
||||
limit_usd: float
|
||||
r"""Spending limit in USD. Must be greater than 0."""
|
||||
|
||||
|
||||
class UpsertWorkspaceBudgetRequest(BaseModel):
|
||||
limit_usd: float
|
||||
r"""Spending limit in USD. Must be greater than 0."""
|
||||
@@ -0,0 +1,14 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .workspacebudget import WorkspaceBudget, WorkspaceBudgetTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class UpsertWorkspaceBudgetResponseTypedDict(TypedDict):
|
||||
data: WorkspaceBudgetTypedDict
|
||||
|
||||
|
||||
class UpsertWorkspaceBudgetResponse(BaseModel):
|
||||
data: WorkspaceBudget
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel
|
||||
from typing import Literal
|
||||
from typing_extensions import TypedDict
|
||||
from typing import Literal, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
URLCitationType = Literal["url_citation",]
|
||||
@@ -15,6 +15,7 @@ class URLCitationTypedDict(TypedDict):
|
||||
title: str
|
||||
type: URLCitationType
|
||||
url: str
|
||||
content: NotRequired[str]
|
||||
|
||||
|
||||
class URLCitation(BaseModel):
|
||||
@@ -27,3 +28,5 @@ class URLCitation(BaseModel):
|
||||
type: URLCitationType
|
||||
|
||||
url: str
|
||||
|
||||
content: Optional[str] = None
|
||||
|
||||
@@ -29,7 +29,7 @@ r"""Aspect ratio of the generated video"""
|
||||
|
||||
|
||||
class OptionsTypedDict(TypedDict):
|
||||
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body."""
|
||||
r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
|
||||
|
||||
oneai: NotRequired[Dict[str, Nullable[Any]]]
|
||||
ai21: NotRequired[Dict[str, Nullable[Any]]]
|
||||
@@ -149,7 +149,7 @@ class OptionsTypedDict(TypedDict):
|
||||
|
||||
|
||||
class Options(BaseModel):
|
||||
r"""Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body."""
|
||||
r"""Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped."""
|
||||
|
||||
oneai: Annotated[
|
||||
Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="01ai")
|
||||
|
||||
@@ -16,40 +16,40 @@ from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
class WebSearchConfigTypedDict(TypedDict):
|
||||
allowed_domains: NotRequired[List[str]]
|
||||
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains."""
|
||||
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains."""
|
||||
engine: NotRequired[WebSearchEngineEnum]
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API."""
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
excluded_domains: NotRequired[List[str]]
|
||||
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains."""
|
||||
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). Cannot be used with allowed_domains."""
|
||||
max_characters: NotRequired[int]
|
||||
r"""Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel)."""
|
||||
r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity)."""
|
||||
max_results: NotRequired[int]
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
max_total_results: NotRequired[int]
|
||||
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified."""
|
||||
search_context_size: NotRequired[SearchQualityLevel]
|
||||
r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set."""
|
||||
r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set."""
|
||||
user_location: NotRequired[WebSearchUserLocationServerToolTypedDict]
|
||||
r"""Approximate user location for location-biased results."""
|
||||
|
||||
|
||||
class WebSearchConfig(BaseModel):
|
||||
allowed_domains: Optional[List[str]] = None
|
||||
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains."""
|
||||
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains."""
|
||||
|
||||
engine: Annotated[
|
||||
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API."""
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
|
||||
excluded_domains: Optional[List[str]] = None
|
||||
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains."""
|
||||
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). Cannot be used with allowed_domains."""
|
||||
|
||||
max_characters: Optional[int] = None
|
||||
r"""Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel)."""
|
||||
r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity)."""
|
||||
|
||||
max_results: Optional[int] = None
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
|
||||
max_total_results: Optional[int] = None
|
||||
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified."""
|
||||
@@ -57,7 +57,7 @@ class WebSearchConfig(BaseModel):
|
||||
search_context_size: Annotated[
|
||||
Optional[SearchQualityLevel], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set."""
|
||||
r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set."""
|
||||
|
||||
user_location: Optional[WebSearchUserLocationServerTool] = None
|
||||
r"""Approximate user location for location-biased results."""
|
||||
|
||||
@@ -11,6 +11,7 @@ WebSearchEngine = Union[
|
||||
"exa",
|
||||
"firecrawl",
|
||||
"parallel",
|
||||
"perplexity",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
@@ -7,12 +7,13 @@ from typing import Literal, Union
|
||||
|
||||
WebSearchEngineEnum = Union[
|
||||
Literal[
|
||||
"auto",
|
||||
"native",
|
||||
"exa",
|
||||
"parallel",
|
||||
"firecrawl",
|
||||
"perplexity",
|
||||
"auto",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API."""
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
|
||||
@@ -27,10 +27,10 @@ class WebSearchServerToolTypedDict(TypedDict):
|
||||
|
||||
type: WebSearchServerToolType
|
||||
engine: NotRequired[WebSearchEngineEnum]
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API."""
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]]
|
||||
max_results: NotRequired[int]
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
search_context_size: NotRequired[SearchContextSizeEnum]
|
||||
r"""Size of the search context for web search tools"""
|
||||
user_location: NotRequired[Nullable[WebSearchUserLocationTypedDict]]
|
||||
@@ -45,12 +45,12 @@ class WebSearchServerTool(BaseModel):
|
||||
engine: Annotated[
|
||||
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API."""
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
|
||||
filters: OptionalNullable[WebSearchDomainFilter] = UNSET
|
||||
|
||||
max_results: Optional[int] = None
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
|
||||
search_context_size: Annotated[
|
||||
Optional[SearchContextSizeEnum], PlainValidator(validate_open_enum(False))
|
||||
|
||||
@@ -18,19 +18,19 @@ class WebSearchServerToolConfigTypedDict(TypedDict):
|
||||
r"""Configuration for the openrouter:web_search server tool"""
|
||||
|
||||
allowed_domains: NotRequired[List[str]]
|
||||
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains."""
|
||||
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains."""
|
||||
engine: NotRequired[WebSearchEngineEnum]
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API."""
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
excluded_domains: NotRequired[List[str]]
|
||||
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains."""
|
||||
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). Cannot be used with allowed_domains."""
|
||||
max_characters: NotRequired[int]
|
||||
r"""Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel)."""
|
||||
r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity)."""
|
||||
max_results: NotRequired[int]
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
max_total_results: NotRequired[int]
|
||||
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified."""
|
||||
search_context_size: NotRequired[SearchQualityLevel]
|
||||
r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set."""
|
||||
r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set."""
|
||||
user_location: NotRequired[WebSearchUserLocationServerToolTypedDict]
|
||||
r"""Approximate user location for location-biased results."""
|
||||
|
||||
@@ -39,21 +39,21 @@ class WebSearchServerToolConfig(BaseModel):
|
||||
r"""Configuration for the openrouter:web_search server tool"""
|
||||
|
||||
allowed_domains: Optional[List[str]] = None
|
||||
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains."""
|
||||
r"""Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, and most native providers (Anthropic, OpenAI, xAI). Cannot be used with excluded_domains."""
|
||||
|
||||
engine: Annotated[
|
||||
Optional[WebSearchEngineEnum], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API."""
|
||||
r"""Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API. \"perplexity\" uses the Perplexity Search API (raw ranked results)."""
|
||||
|
||||
excluded_domains: Optional[List[str]] = None
|
||||
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains."""
|
||||
r"""Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Perplexity, Anthropic, and xAI. Not supported with OpenAI (silently ignored). Cannot be used with allowed_domains."""
|
||||
|
||||
max_characters: Optional[int] = None
|
||||
r"""Exact maximum number of characters of content per search result. Applies to the Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence for both engines. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel)."""
|
||||
r"""Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity)."""
|
||||
|
||||
max_results: Optional[int] = None
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search."""
|
||||
r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped."""
|
||||
|
||||
max_total_results: Optional[int] = None
|
||||
r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified."""
|
||||
@@ -61,7 +61,7 @@ class WebSearchServerToolConfig(BaseModel):
|
||||
search_context_size: Annotated[
|
||||
Optional[SearchQualityLevel], PlainValidator(validate_open_enum(False))
|
||||
] = None
|
||||
r"""How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. Overridden by `max_characters` when both are set."""
|
||||
r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set."""
|
||||
|
||||
user_location: Optional[WebSearchUserLocationServerTool] = None
|
||||
r"""Approximate user location for location-biased results."""
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic import model_serializer
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import Literal, Union
|
||||
from typing_extensions import Annotated, TypedDict
|
||||
|
||||
|
||||
ResetInterval = Union[
|
||||
Literal[
|
||||
"daily",
|
||||
"weekly",
|
||||
"monthly",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Interval at which spend resets. Null means a lifetime (one-time) budget."""
|
||||
|
||||
|
||||
class WorkspaceBudgetTypedDict(TypedDict):
|
||||
created_at: str
|
||||
r"""ISO 8601 timestamp of when the budget was created"""
|
||||
id: str
|
||||
r"""Unique identifier for the budget"""
|
||||
limit_usd: float
|
||||
r"""Spending limit in USD for this interval"""
|
||||
reset_interval: Nullable[ResetInterval]
|
||||
r"""Interval at which spend resets. Null means a lifetime (one-time) budget."""
|
||||
updated_at: str
|
||||
r"""ISO 8601 timestamp of when the budget was last updated"""
|
||||
workspace_id: str
|
||||
r"""ID of the workspace the budget belongs to"""
|
||||
|
||||
|
||||
class WorkspaceBudget(BaseModel):
|
||||
created_at: str
|
||||
r"""ISO 8601 timestamp of when the budget was created"""
|
||||
|
||||
id: str
|
||||
r"""Unique identifier for the budget"""
|
||||
|
||||
limit_usd: float
|
||||
r"""Spending limit in USD for this interval"""
|
||||
|
||||
reset_interval: Annotated[
|
||||
Nullable[ResetInterval], PlainValidator(validate_open_enum(False))
|
||||
]
|
||||
r"""Interval at which spend resets. Null means a lifetime (one-time) budget."""
|
||||
|
||||
updated_at: str
|
||||
r"""ISO 8601 timestamp of when the budget was last updated"""
|
||||
|
||||
workspace_id: str
|
||||
r"""ID of the workspace the budget belongs to"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = ["reset_interval"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,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
|
||||
|
||||
|
||||
WorkspaceBudgetInterval = Union[
|
||||
Literal[
|
||||
"daily",
|
||||
"weekly",
|
||||
"monthly",
|
||||
"lifetime",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Budget reset interval. Use \"lifetime\" for a one-time budget that never resets."""
|
||||
Reference in New Issue
Block a user