mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-29 11:23:49 +08:00
chore: regenerate SDK to v0.0.19 with speakeasy
This commit is contained in:
@@ -21,7 +21,6 @@ if TYPE_CHECKING:
|
||||
BadRequestResponseErrorData,
|
||||
BadRequestResponseErrorDataTypedDict,
|
||||
)
|
||||
from .chatcompletionfinishreason import ChatCompletionFinishReason
|
||||
from .chaterror import ChatErrorError, ChatErrorErrorTypedDict, Code, CodeTypedDict
|
||||
from .chatgenerationparams import (
|
||||
ChatGenerationParams,
|
||||
@@ -72,9 +71,15 @@ if TYPE_CHECKING:
|
||||
)
|
||||
from .chatmessagecontentitemvideo import (
|
||||
ChatMessageContentItemVideo,
|
||||
ChatMessageContentItemVideoInputVideo,
|
||||
ChatMessageContentItemVideoInputVideoTypedDict,
|
||||
ChatMessageContentItemVideoTypedDict,
|
||||
VideoURL,
|
||||
VideoURLTypedDict,
|
||||
ChatMessageContentItemVideoVideoURL,
|
||||
ChatMessageContentItemVideoVideoURLTypedDict,
|
||||
VideoURL1,
|
||||
VideoURL1TypedDict,
|
||||
VideoURL2,
|
||||
VideoURL2TypedDict,
|
||||
)
|
||||
from .chatmessagetokenlogprob import (
|
||||
ChatMessageTokenLogprob,
|
||||
@@ -93,8 +98,13 @@ if TYPE_CHECKING:
|
||||
ChatMessageToolCallTypedDict,
|
||||
)
|
||||
from .chatresponse import ChatResponse, ChatResponseTypedDict
|
||||
from .chatresponsechoice import ChatResponseChoice, ChatResponseChoiceTypedDict
|
||||
from .chatstreamingchoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict
|
||||
from .chatresponsechoice import (
|
||||
ChatCompletionFinishReason,
|
||||
ChatResponseChoice,
|
||||
ChatResponseChoiceTypedDict,
|
||||
ChatStreamingChoice,
|
||||
ChatStreamingChoiceTypedDict,
|
||||
)
|
||||
from .chatstreamingmessagechunk import (
|
||||
ChatStreamingMessageChunk,
|
||||
ChatStreamingMessageChunkRole,
|
||||
@@ -146,6 +156,7 @@ if TYPE_CHECKING:
|
||||
CreateChargeRequest,
|
||||
CreateChargeRequestTypedDict,
|
||||
)
|
||||
from .datacollection import DataCollection
|
||||
from .defaultparameters import DefaultParameters, DefaultParametersTypedDict
|
||||
from .edgenetworktimeoutresponseerrordata import (
|
||||
EdgeNetworkTimeoutResponseErrorData,
|
||||
@@ -408,7 +419,6 @@ if TYPE_CHECKING:
|
||||
OpenResponsesReasoningSummaryTextDoneEventTypedDict,
|
||||
)
|
||||
from .openresponsesrequest import (
|
||||
DataCollection,
|
||||
Engine,
|
||||
IDFileParser,
|
||||
IDModeration,
|
||||
@@ -442,7 +452,6 @@ if TYPE_CHECKING:
|
||||
Provider,
|
||||
ProviderTypedDict,
|
||||
ServiceTier,
|
||||
Sort,
|
||||
Truncation,
|
||||
)
|
||||
from .openresponsesresponsetext import (
|
||||
@@ -581,6 +590,7 @@ if TYPE_CHECKING:
|
||||
ProviderOverloadedResponseErrorData,
|
||||
ProviderOverloadedResponseErrorDataTypedDict,
|
||||
)
|
||||
from .providersort import ProviderSort
|
||||
from .publicendpoint import (
|
||||
Pricing,
|
||||
PricingTypedDict,
|
||||
@@ -821,7 +831,11 @@ __all__ = [
|
||||
"ChatMessageContentItemTextTypedDict",
|
||||
"ChatMessageContentItemTypedDict",
|
||||
"ChatMessageContentItemVideo",
|
||||
"ChatMessageContentItemVideoInputVideo",
|
||||
"ChatMessageContentItemVideoInputVideoTypedDict",
|
||||
"ChatMessageContentItemVideoTypedDict",
|
||||
"ChatMessageContentItemVideoVideoURL",
|
||||
"ChatMessageContentItemVideoVideoURLTypedDict",
|
||||
"ChatMessageTokenLogprob",
|
||||
"ChatMessageTokenLogprobTypedDict",
|
||||
"ChatMessageTokenLogprobs",
|
||||
@@ -1205,6 +1219,7 @@ __all__ = [
|
||||
"ProviderName",
|
||||
"ProviderOverloadedResponseErrorData",
|
||||
"ProviderOverloadedResponseErrorDataTypedDict",
|
||||
"ProviderSort",
|
||||
"ProviderTypedDict",
|
||||
"PublicEndpoint",
|
||||
"PublicEndpointQuantization",
|
||||
@@ -1310,7 +1325,6 @@ __all__ = [
|
||||
"ServiceTier",
|
||||
"ServiceUnavailableResponseErrorData",
|
||||
"ServiceUnavailableResponseErrorDataTypedDict",
|
||||
"Sort",
|
||||
"StreamOptions",
|
||||
"StreamOptionsTypedDict",
|
||||
"SystemMessage",
|
||||
@@ -1366,8 +1380,10 @@ __all__ = [
|
||||
"UserMessageTypedDict",
|
||||
"Variables",
|
||||
"VariablesTypedDict",
|
||||
"VideoURL",
|
||||
"VideoURLTypedDict",
|
||||
"VideoURL1",
|
||||
"VideoURL1TypedDict",
|
||||
"VideoURL2",
|
||||
"VideoURL2TypedDict",
|
||||
"WebSearchPreviewToolUserLocation",
|
||||
"WebSearchPreviewToolUserLocationType",
|
||||
"WebSearchPreviewToolUserLocationTypedDict",
|
||||
@@ -1385,7 +1401,6 @@ _dynamic_imports: dict[str, str] = {
|
||||
"BadGatewayResponseErrorDataTypedDict": ".badgatewayresponseerrordata",
|
||||
"BadRequestResponseErrorData": ".badrequestresponseerrordata",
|
||||
"BadRequestResponseErrorDataTypedDict": ".badrequestresponseerrordata",
|
||||
"ChatCompletionFinishReason": ".chatcompletionfinishreason",
|
||||
"ChatErrorError": ".chaterror",
|
||||
"ChatErrorErrorTypedDict": ".chaterror",
|
||||
"Code": ".chaterror",
|
||||
@@ -1426,9 +1441,15 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ChatMessageContentItemText": ".chatmessagecontentitemtext",
|
||||
"ChatMessageContentItemTextTypedDict": ".chatmessagecontentitemtext",
|
||||
"ChatMessageContentItemVideo": ".chatmessagecontentitemvideo",
|
||||
"ChatMessageContentItemVideoInputVideo": ".chatmessagecontentitemvideo",
|
||||
"ChatMessageContentItemVideoInputVideoTypedDict": ".chatmessagecontentitemvideo",
|
||||
"ChatMessageContentItemVideoTypedDict": ".chatmessagecontentitemvideo",
|
||||
"VideoURL": ".chatmessagecontentitemvideo",
|
||||
"VideoURLTypedDict": ".chatmessagecontentitemvideo",
|
||||
"ChatMessageContentItemVideoVideoURL": ".chatmessagecontentitemvideo",
|
||||
"ChatMessageContentItemVideoVideoURLTypedDict": ".chatmessagecontentitemvideo",
|
||||
"VideoURL1": ".chatmessagecontentitemvideo",
|
||||
"VideoURL1TypedDict": ".chatmessagecontentitemvideo",
|
||||
"VideoURL2": ".chatmessagecontentitemvideo",
|
||||
"VideoURL2TypedDict": ".chatmessagecontentitemvideo",
|
||||
"ChatMessageTokenLogprob": ".chatmessagetokenlogprob",
|
||||
"ChatMessageTokenLogprobTypedDict": ".chatmessagetokenlogprob",
|
||||
"TopLogprob": ".chatmessagetokenlogprob",
|
||||
@@ -1441,10 +1462,11 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ChatMessageToolCallTypedDict": ".chatmessagetoolcall",
|
||||
"ChatResponse": ".chatresponse",
|
||||
"ChatResponseTypedDict": ".chatresponse",
|
||||
"ChatCompletionFinishReason": ".chatresponsechoice",
|
||||
"ChatResponseChoice": ".chatresponsechoice",
|
||||
"ChatResponseChoiceTypedDict": ".chatresponsechoice",
|
||||
"ChatStreamingChoice": ".chatstreamingchoice",
|
||||
"ChatStreamingChoiceTypedDict": ".chatstreamingchoice",
|
||||
"ChatStreamingChoice": ".chatresponsechoice",
|
||||
"ChatStreamingChoiceTypedDict": ".chatresponsechoice",
|
||||
"ChatStreamingMessageChunk": ".chatstreamingmessagechunk",
|
||||
"ChatStreamingMessageChunkRole": ".chatstreamingmessagechunk",
|
||||
"ChatStreamingMessageChunkTypedDict": ".chatstreamingmessagechunk",
|
||||
@@ -1488,6 +1510,7 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ChainID": ".createchargerequest",
|
||||
"CreateChargeRequest": ".createchargerequest",
|
||||
"CreateChargeRequestTypedDict": ".createchargerequest",
|
||||
"DataCollection": ".datacollection",
|
||||
"DefaultParameters": ".defaultparameters",
|
||||
"DefaultParametersTypedDict": ".defaultparameters",
|
||||
"EdgeNetworkTimeoutResponseErrorData": ".edgenetworktimeoutresponseerrordata",
|
||||
@@ -1687,7 +1710,6 @@ _dynamic_imports: dict[str, str] = {
|
||||
"OpenResponsesReasoningSummaryTextDoneEvent": ".openresponsesreasoningsummarytextdoneevent",
|
||||
"OpenResponsesReasoningSummaryTextDoneEventType": ".openresponsesreasoningsummarytextdoneevent",
|
||||
"OpenResponsesReasoningSummaryTextDoneEventTypedDict": ".openresponsesreasoningsummarytextdoneevent",
|
||||
"DataCollection": ".openresponsesrequest",
|
||||
"Engine": ".openresponsesrequest",
|
||||
"IDFileParser": ".openresponsesrequest",
|
||||
"IDModeration": ".openresponsesrequest",
|
||||
@@ -1721,7 +1743,6 @@ _dynamic_imports: dict[str, str] = {
|
||||
"Provider": ".openresponsesrequest",
|
||||
"ProviderTypedDict": ".openresponsesrequest",
|
||||
"ServiceTier": ".openresponsesrequest",
|
||||
"Sort": ".openresponsesrequest",
|
||||
"Truncation": ".openresponsesrequest",
|
||||
"OpenResponsesResponseText": ".openresponsesresponsetext",
|
||||
"OpenResponsesResponseTextTypedDict": ".openresponsesresponsetext",
|
||||
@@ -1834,6 +1855,7 @@ _dynamic_imports: dict[str, str] = {
|
||||
"ProviderName": ".providername",
|
||||
"ProviderOverloadedResponseErrorData": ".provideroverloadedresponseerrordata",
|
||||
"ProviderOverloadedResponseErrorDataTypedDict": ".provideroverloadedresponseerrordata",
|
||||
"ProviderSort": ".providersort",
|
||||
"Pricing": ".publicendpoint",
|
||||
"PricingTypedDict": ".publicendpoint",
|
||||
"PublicEndpoint": ".publicendpoint",
|
||||
|
||||
@@ -31,6 +31,7 @@ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
Effort = Union[
|
||||
Literal[
|
||||
"none",
|
||||
"minimal",
|
||||
"low",
|
||||
"medium",
|
||||
|
||||
@@ -40,6 +40,7 @@ ChatMessageContentItem = Annotated[
|
||||
Annotated[ChatMessageContentItemImage, Tag("image_url")],
|
||||
Annotated[ChatMessageContentItemAudio, Tag("input_audio")],
|
||||
Annotated[ChatMessageContentItemVideo, Tag("input_video")],
|
||||
Annotated[ChatMessageContentItemVideo, Tag("video_url")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
|
||||
@@ -5,25 +5,47 @@ 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
|
||||
from typing import Literal, Union
|
||||
from typing_extensions import Annotated, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
class VideoURLTypedDict(TypedDict):
|
||||
class VideoURL2TypedDict(TypedDict):
|
||||
url: str
|
||||
|
||||
|
||||
class VideoURL(BaseModel):
|
||||
class VideoURL2(BaseModel):
|
||||
url: str
|
||||
|
||||
|
||||
class ChatMessageContentItemVideoTypedDict(TypedDict):
|
||||
video_url: VideoURLTypedDict
|
||||
class ChatMessageContentItemVideoVideoURLTypedDict(TypedDict):
|
||||
video_url: VideoURL2TypedDict
|
||||
type: Literal["video_url"]
|
||||
|
||||
|
||||
class ChatMessageContentItemVideoVideoURL(BaseModel):
|
||||
video_url: VideoURL2
|
||||
|
||||
TYPE: Annotated[
|
||||
Annotated[Literal["video_url"], AfterValidator(validate_const("video_url"))],
|
||||
pydantic.Field(alias="type"),
|
||||
] = "video_url"
|
||||
|
||||
|
||||
class VideoURL1TypedDict(TypedDict):
|
||||
url: str
|
||||
|
||||
|
||||
class VideoURL1(BaseModel):
|
||||
url: str
|
||||
|
||||
|
||||
class ChatMessageContentItemVideoInputVideoTypedDict(TypedDict):
|
||||
video_url: VideoURL1TypedDict
|
||||
type: Literal["input_video"]
|
||||
|
||||
|
||||
class ChatMessageContentItemVideo(BaseModel):
|
||||
video_url: VideoURL
|
||||
class ChatMessageContentItemVideoInputVideo(BaseModel):
|
||||
video_url: VideoURL1
|
||||
|
||||
TYPE: Annotated[
|
||||
Annotated[
|
||||
@@ -31,3 +53,18 @@ class ChatMessageContentItemVideo(BaseModel):
|
||||
],
|
||||
pydantic.Field(alias="type"),
|
||||
] = "input_video"
|
||||
|
||||
|
||||
ChatMessageContentItemVideoTypedDict = TypeAliasType(
|
||||
"ChatMessageContentItemVideoTypedDict",
|
||||
Union[
|
||||
ChatMessageContentItemVideoInputVideoTypedDict,
|
||||
ChatMessageContentItemVideoVideoURLTypedDict,
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
ChatMessageContentItemVideo = TypeAliasType(
|
||||
"ChatMessageContentItemVideo",
|
||||
Union[ChatMessageContentItemVideoInputVideo, ChatMessageContentItemVideoVideoURL],
|
||||
)
|
||||
|
||||
@@ -2,24 +2,41 @@
|
||||
|
||||
from __future__ import annotations
|
||||
from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
|
||||
from .chatcompletionfinishreason import ChatCompletionFinishReason
|
||||
from .chatmessagetokenlogprobs import (
|
||||
ChatMessageTokenLogprobs,
|
||||
ChatMessageTokenLogprobsTypedDict,
|
||||
)
|
||||
from .chatstreamingmessagechunk import (
|
||||
ChatStreamingMessageChunk,
|
||||
ChatStreamingMessageChunkTypedDict,
|
||||
)
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
UnrecognizedStr,
|
||||
)
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic import model_serializer
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing import Literal, Union
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
ChatCompletionFinishReason = Union[
|
||||
Literal[
|
||||
"tool_calls",
|
||||
"stop",
|
||||
"length",
|
||||
"content_filter",
|
||||
"error",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
|
||||
class ChatResponseChoiceTypedDict(TypedDict):
|
||||
finish_reason: Nullable[ChatCompletionFinishReason]
|
||||
index: float
|
||||
@@ -67,3 +84,52 @@ class ChatResponseChoice(BaseModel):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
class ChatStreamingChoiceTypedDict(TypedDict):
|
||||
delta: ChatStreamingMessageChunkTypedDict
|
||||
finish_reason: Nullable[ChatCompletionFinishReason]
|
||||
index: float
|
||||
logprobs: NotRequired[Nullable[ChatMessageTokenLogprobsTypedDict]]
|
||||
|
||||
|
||||
class ChatStreamingChoice(BaseModel):
|
||||
delta: ChatStreamingMessageChunk
|
||||
|
||||
finish_reason: Annotated[
|
||||
Nullable[ChatCompletionFinishReason], PlainValidator(validate_open_enum(False))
|
||||
]
|
||||
|
||||
index: float
|
||||
|
||||
logprobs: OptionalNullable[ChatMessageTokenLogprobs] = UNSET
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["logprobs"]
|
||||
nullable_fields = ["finish_reason", "logprobs"]
|
||||
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
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .chatcompletionfinishreason import ChatCompletionFinishReason
|
||||
from .chatmessagetokenlogprobs import (
|
||||
ChatMessageTokenLogprobs,
|
||||
ChatMessageTokenLogprobsTypedDict,
|
||||
)
|
||||
from .chatstreamingmessagechunk import (
|
||||
ChatStreamingMessageChunk,
|
||||
ChatStreamingMessageChunkTypedDict,
|
||||
)
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
from openrouter.utils import validate_open_enum
|
||||
from pydantic import model_serializer
|
||||
from pydantic.functional_validators import PlainValidator
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class ChatStreamingChoiceTypedDict(TypedDict):
|
||||
delta: ChatStreamingMessageChunkTypedDict
|
||||
finish_reason: Nullable[ChatCompletionFinishReason]
|
||||
index: float
|
||||
logprobs: NotRequired[Nullable[ChatMessageTokenLogprobsTypedDict]]
|
||||
|
||||
|
||||
class ChatStreamingChoice(BaseModel):
|
||||
delta: ChatStreamingMessageChunk
|
||||
|
||||
finish_reason: Annotated[
|
||||
Nullable[ChatCompletionFinishReason], PlainValidator(validate_open_enum(False))
|
||||
]
|
||||
|
||||
index: float
|
||||
|
||||
logprobs: OptionalNullable[ChatMessageTokenLogprobs] = UNSET
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["logprobs"]
|
||||
nullable_fields = ["finish_reason", "logprobs"]
|
||||
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
|
||||
@@ -5,7 +5,7 @@ from .chatgenerationtokenusage import (
|
||||
ChatGenerationTokenUsage,
|
||||
ChatGenerationTokenUsageTypedDict,
|
||||
)
|
||||
from .chatstreamingchoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict
|
||||
from .chatresponsechoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import UnrecognizedStr
|
||||
from typing import Literal, Union
|
||||
|
||||
|
||||
DataCollection = Union[
|
||||
Literal[
|
||||
"deny",
|
||||
"allow",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
||||
- allow: (default) allow providers which store user data non-transiently and may train on it
|
||||
|
||||
- deny: use only providers which do not collect user data.
|
||||
"""
|
||||
@@ -11,6 +11,7 @@ OpenAIResponsesReasoningEffort = Union[
|
||||
"medium",
|
||||
"low",
|
||||
"minimal",
|
||||
"none",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
@@ -57,6 +57,7 @@ OpenResponsesReasoningFormat = Union[
|
||||
"openai-responses-v1",
|
||||
"xai-responses-v1",
|
||||
"anthropic-claude-v1",
|
||||
"google-gemini-v1",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .datacollection import DataCollection
|
||||
from .openairesponsesincludable import OpenAIResponsesIncludable
|
||||
from .openairesponsesprompt import OpenAIResponsesPrompt, OpenAIResponsesPromptTypedDict
|
||||
from .openairesponsestoolchoice_union import (
|
||||
@@ -33,6 +34,7 @@ from .openresponseswebsearchtool import (
|
||||
OpenResponsesWebSearchToolTypedDict,
|
||||
)
|
||||
from .providername import ProviderName
|
||||
from .providersort import ProviderSort
|
||||
from .quantization import Quantization
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
@@ -151,20 +153,6 @@ Truncation = Union[
|
||||
]
|
||||
|
||||
|
||||
DataCollection = Union[
|
||||
Literal[
|
||||
"deny",
|
||||
"allow",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
||||
- allow: (default) allow providers which store user data non-transiently and may train on it
|
||||
- deny: use only providers which do not collect user data.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
OrderTypedDict = TypeAliasType("OrderTypedDict", Union[ProviderName, str])
|
||||
|
||||
|
||||
@@ -192,17 +180,6 @@ Ignore = TypeAliasType(
|
||||
)
|
||||
|
||||
|
||||
Sort = Union[
|
||||
Literal[
|
||||
"price",
|
||||
"throughput",
|
||||
"latency",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
|
||||
|
||||
|
||||
class MaxPriceTypedDict(TypedDict):
|
||||
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
|
||||
|
||||
@@ -251,8 +228,8 @@ class ProviderTypedDict(TypedDict):
|
||||
data_collection: NotRequired[Nullable[DataCollection]]
|
||||
r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
||||
- allow: (default) allow providers which store user data non-transiently and may train on it
|
||||
- deny: use only providers which do not collect user data.
|
||||
|
||||
- deny: use only providers which do not collect user data.
|
||||
"""
|
||||
zdr: NotRequired[Nullable[bool]]
|
||||
r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used."""
|
||||
@@ -266,7 +243,7 @@ class ProviderTypedDict(TypedDict):
|
||||
r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
|
||||
quantizations: NotRequired[Nullable[List[Quantization]]]
|
||||
r"""A list of quantization levels to filter the provider by."""
|
||||
sort: NotRequired[Nullable[Sort]]
|
||||
sort: NotRequired[Nullable[ProviderSort]]
|
||||
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
|
||||
max_price: NotRequired[MaxPriceTypedDict]
|
||||
r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
|
||||
@@ -290,8 +267,8 @@ class Provider(BaseModel):
|
||||
] = UNSET
|
||||
r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
|
||||
- allow: (default) allow providers which store user data non-transiently and may train on it
|
||||
- deny: use only providers which do not collect user data.
|
||||
|
||||
- deny: use only providers which do not collect user data.
|
||||
"""
|
||||
|
||||
zdr: OptionalNullable[bool] = UNSET
|
||||
@@ -315,7 +292,7 @@ class Provider(BaseModel):
|
||||
r"""A list of quantization levels to filter the provider by."""
|
||||
|
||||
sort: Annotated[
|
||||
OptionalNullable[Sort], PlainValidator(validate_open_enum(False))
|
||||
OptionalNullable[ProviderSort], PlainValidator(validate_open_enum(False))
|
||||
] = UNSET
|
||||
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
|
||||
|
||||
|
||||
@@ -7,44 +7,26 @@ from typing import Literal, Union
|
||||
|
||||
ProviderName = Union[
|
||||
Literal[
|
||||
"AnyScale",
|
||||
"Cent-ML",
|
||||
"HuggingFace",
|
||||
"Hyperbolic 2",
|
||||
"Lepton",
|
||||
"Lynn 2",
|
||||
"Lynn",
|
||||
"Mancer",
|
||||
"Modal",
|
||||
"OctoAI",
|
||||
"Recursal",
|
||||
"Reflection",
|
||||
"Replicate",
|
||||
"SambaNova 2",
|
||||
"SF Compute",
|
||||
"Together 2",
|
||||
"01.AI",
|
||||
"AI21",
|
||||
"AionLabs",
|
||||
"Alibaba",
|
||||
"Amazon Bedrock",
|
||||
"Anthropic",
|
||||
"Arcee",
|
||||
"AtlasCloud",
|
||||
"Atoma",
|
||||
"Avian",
|
||||
"Azure",
|
||||
"BaseTen",
|
||||
"Black Forest Labs",
|
||||
"Cerebras",
|
||||
"Chutes",
|
||||
"Cirrascale",
|
||||
"Clarifai",
|
||||
"Cloudflare",
|
||||
"Cohere",
|
||||
"CrofAI",
|
||||
"Crusoe",
|
||||
"DeepInfra",
|
||||
"DeepSeek",
|
||||
"Enfer",
|
||||
"Featherless",
|
||||
"Fireworks",
|
||||
"Friendli",
|
||||
@@ -57,12 +39,8 @@ ProviderName = Union[
|
||||
"InferenceNet",
|
||||
"Infermatic",
|
||||
"Inflection",
|
||||
"InoCloud",
|
||||
"Kluster",
|
||||
"Lambda",
|
||||
"Liquid",
|
||||
"Mancer 2",
|
||||
"Meta",
|
||||
"Minimax",
|
||||
"ModelRun",
|
||||
"Mistral",
|
||||
@@ -72,7 +50,6 @@ ProviderName = Union[
|
||||
"NCompass",
|
||||
"Nebius",
|
||||
"NextBit",
|
||||
"Nineteen",
|
||||
"Novita",
|
||||
"Nvidia",
|
||||
"OpenAI",
|
||||
@@ -87,7 +64,6 @@ ProviderName = Union[
|
||||
"Switchpoint",
|
||||
"Targon",
|
||||
"Together",
|
||||
"Ubicloud",
|
||||
"Venice",
|
||||
"WandB",
|
||||
"xAI",
|
||||
|
||||
+5
-6
@@ -5,13 +5,12 @@ from openrouter.types import UnrecognizedStr
|
||||
from typing import Literal, Union
|
||||
|
||||
|
||||
ChatCompletionFinishReason = Union[
|
||||
ProviderSort = Union[
|
||||
Literal[
|
||||
"tool_calls",
|
||||
"stop",
|
||||
"length",
|
||||
"content_filter",
|
||||
"error",
|
||||
"price",
|
||||
"throughput",
|
||||
"latency",
|
||||
],
|
||||
UnrecognizedStr,
|
||||
]
|
||||
r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
|
||||
@@ -21,6 +21,8 @@ class PricingTypedDict(TypedDict):
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image_token: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image_output: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
audio: NotRequired[Any]
|
||||
@@ -51,6 +53,9 @@ class Pricing(BaseModel):
|
||||
image: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
image_token: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
image_output: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ class PublicPricingTypedDict(TypedDict):
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image_token: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
image_output: NotRequired[Any]
|
||||
r"""A value in string or number format that is a large number"""
|
||||
audio: NotRequired[Any]
|
||||
@@ -49,6 +51,9 @@ class PublicPricing(BaseModel):
|
||||
image: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
image_token: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
image_output: Optional[Any] = None
|
||||
r"""A value in string or number format that is a large number"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user