more updates

This commit is contained in:
Matt Apperson
2025-12-04 13:07:08 -05:00
parent aed8199b2b
commit d4474da1b8
57 changed files with 588 additions and 415 deletions
+2 -2
View File
@@ -3,10 +3,10 @@
import importlib.metadata
__title__: str = "openrouter"
__version__: str = "0.0.16"
__version__: str = "0.0.21"
__openapi_doc_version__: str = "1.0.0"
__gen_version__: str = "2.768.0"
__user_agent__: str = "speakeasy-sdk/python 0.0.16 2.768.0 1.0.0 openrouter"
__user_agent__: str = "speakeasy-sdk/python 0.0.21 2.768.0 1.0.0 openrouter"
try:
if __package__ is not None:
+14
View File
@@ -61,6 +61,7 @@ class Chat(BaseSDK):
] = None,
top_p: OptionalNullable[float] = UNSET,
user: Optional[str] = None,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -92,6 +93,7 @@ class Chat(BaseSDK):
:param tools:
:param top_p:
:param user:
:param debug:
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -144,6 +146,7 @@ class Chat(BaseSDK):
] = None,
top_p: OptionalNullable[float] = UNSET,
user: Optional[str] = None,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -175,6 +178,7 @@ class Chat(BaseSDK):
:param tools:
:param top_p:
:param user:
:param debug:
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -226,6 +230,7 @@ class Chat(BaseSDK):
] = None,
top_p: OptionalNullable[float] = UNSET,
user: Optional[str] = None,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -257,6 +262,7 @@ class Chat(BaseSDK):
:param tools:
:param top_p:
:param user:
:param debug:
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -305,6 +311,7 @@ class Chat(BaseSDK):
),
top_p=top_p,
user=user,
debug=utils.get_pydantic_model(debug, Optional[components.Debug]),
)
req = self._build_request(
@@ -439,6 +446,7 @@ class Chat(BaseSDK):
] = None,
top_p: OptionalNullable[float] = UNSET,
user: Optional[str] = None,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -470,6 +478,7 @@ class Chat(BaseSDK):
:param tools:
:param top_p:
:param user:
:param debug:
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -522,6 +531,7 @@ class Chat(BaseSDK):
] = None,
top_p: OptionalNullable[float] = UNSET,
user: Optional[str] = None,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -553,6 +563,7 @@ class Chat(BaseSDK):
:param tools:
:param top_p:
:param user:
:param debug:
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -604,6 +615,7 @@ class Chat(BaseSDK):
] = None,
top_p: OptionalNullable[float] = UNSET,
user: Optional[str] = None,
debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -635,6 +647,7 @@ class Chat(BaseSDK):
:param tools:
:param top_p:
:param user:
:param debug:
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -683,6 +696,7 @@ class Chat(BaseSDK):
),
top_p=top_p,
user=user,
debug=utils.get_pydantic_model(debug, Optional[components.Debug]),
)
req = self._build_request_async(
+43 -37
View File
@@ -21,6 +21,7 @@ if TYPE_CHECKING:
BadRequestResponseErrorData,
BadRequestResponseErrorDataTypedDict,
)
from .chatcompletionfinishreason import ChatCompletionFinishReason
from .chaterror import ChatErrorError, ChatErrorErrorTypedDict, Code, CodeTypedDict
from .chatgenerationparams import (
ChatGenerationParams,
@@ -35,6 +36,8 @@ if TYPE_CHECKING:
ChatGenerationParamsStop,
ChatGenerationParamsStopTypedDict,
ChatGenerationParamsTypedDict,
Debug,
DebugTypedDict,
Effort,
Reasoning,
ReasoningTypedDict,
@@ -53,16 +56,14 @@ if TYPE_CHECKING:
)
from .chatmessagecontentitemaudio import (
ChatMessageContentItemAudio,
ChatMessageContentItemAudioFormat,
ChatMessageContentItemAudioInputAudio,
ChatMessageContentItemAudioInputAudioTypedDict,
ChatMessageContentItemAudioTypedDict,
)
from .chatmessagecontentitemfile import (
ChatMessageContentItemFile,
ChatMessageContentItemFileTypedDict,
File,
FileTypedDict,
from .chatmessagecontentitemcachecontrol import (
ChatMessageContentItemCacheControl,
ChatMessageContentItemCacheControlTypedDict,
TTL,
)
from .chatmessagecontentitemimage import (
ChatMessageContentItemImage,
@@ -82,8 +83,10 @@ if TYPE_CHECKING:
ChatMessageContentItemVideoTypedDict,
ChatMessageContentItemVideoVideoURL,
ChatMessageContentItemVideoVideoURLTypedDict,
ChatMessageContentItemVideoVideoURLVideoURL,
ChatMessageContentItemVideoVideoURLVideoURLTypedDict,
VideoURL1,
VideoURL1TypedDict,
VideoURL2,
VideoURL2TypedDict,
)
from .chatmessagetokenlogprob import (
ChatMessageTokenLogprob,
@@ -102,13 +105,8 @@ if TYPE_CHECKING:
ChatMessageToolCallTypedDict,
)
from .chatresponse import ChatResponse, ChatResponseTypedDict
from .chatresponsechoice import (
ChatCompletionFinishReason,
ChatResponseChoice,
ChatResponseChoiceTypedDict,
ChatStreamingChoice,
ChatStreamingChoiceTypedDict,
)
from .chatresponsechoice import ChatResponseChoice, ChatResponseChoiceTypedDict
from .chatstreamingchoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict
from .chatstreamingmessagechunk import (
ChatStreamingMessageChunk,
ChatStreamingMessageChunkRole,
@@ -426,6 +424,7 @@ if TYPE_CHECKING:
Engine,
IDFileParser,
IDModeration,
IDResponseHealing,
IDWeb,
Ignore,
IgnoreTypedDict,
@@ -450,6 +449,8 @@ if TYPE_CHECKING:
PluginFileParserTypedDict,
PluginModeration,
PluginModerationTypedDict,
PluginResponseHealing,
PluginResponseHealingTypedDict,
PluginTypedDict,
PluginWeb,
PluginWebTypedDict,
@@ -784,7 +785,6 @@ if TYPE_CHECKING:
UserMessageContentTypedDict,
UserMessageTypedDict,
)
from .videourl import VideoURL, VideoURLTypedDict
from .websearchpreviewtooluserlocation import (
WebSearchPreviewToolUserLocation,
WebSearchPreviewToolUserLocationType,
@@ -825,12 +825,11 @@ __all__ = [
"ChatGenerationTokenUsageTypedDict",
"ChatMessageContentItem",
"ChatMessageContentItemAudio",
"ChatMessageContentItemAudioFormat",
"ChatMessageContentItemAudioInputAudio",
"ChatMessageContentItemAudioInputAudioTypedDict",
"ChatMessageContentItemAudioTypedDict",
"ChatMessageContentItemFile",
"ChatMessageContentItemFileTypedDict",
"ChatMessageContentItemCacheControl",
"ChatMessageContentItemCacheControlTypedDict",
"ChatMessageContentItemImage",
"ChatMessageContentItemImageDetail",
"ChatMessageContentItemImageTypedDict",
@@ -843,8 +842,6 @@ __all__ = [
"ChatMessageContentItemVideoTypedDict",
"ChatMessageContentItemVideoVideoURL",
"ChatMessageContentItemVideoVideoURLTypedDict",
"ChatMessageContentItemVideoVideoURLVideoURL",
"ChatMessageContentItemVideoVideoURLVideoURLTypedDict",
"ChatMessageTokenLogprob",
"ChatMessageTokenLogprobTypedDict",
"ChatMessageTokenLogprobs",
@@ -905,6 +902,8 @@ __all__ = [
"CreateChargeRequest",
"CreateChargeRequestTypedDict",
"DataCollection",
"Debug",
"DebugTypedDict",
"DefaultParameters",
"DefaultParametersTypedDict",
"EdgeNetworkTimeoutResponseErrorData",
@@ -912,18 +911,17 @@ __all__ = [
"Effort",
"EndpointStatus",
"Engine",
"File",
"FileCitation",
"FileCitationType",
"FileCitationTypedDict",
"FilePath",
"FilePathType",
"FilePathTypedDict",
"FileTypedDict",
"ForbiddenResponseErrorData",
"ForbiddenResponseErrorDataTypedDict",
"IDFileParser",
"IDModeration",
"IDResponseHealing",
"IDWeb",
"Ignore",
"IgnoreTypedDict",
@@ -1217,6 +1215,8 @@ __all__ = [
"PluginFileParserTypedDict",
"PluginModeration",
"PluginModerationTypedDict",
"PluginResponseHealing",
"PluginResponseHealingTypedDict",
"PluginTypedDict",
"PluginWeb",
"PluginWebTypedDict",
@@ -1342,6 +1342,7 @@ __all__ = [
"SystemMessageContent",
"SystemMessageContentTypedDict",
"SystemMessageTypedDict",
"TTL",
"Tokenizer",
"TooManyRequestsResponseErrorData",
"TooManyRequestsResponseErrorDataTypedDict",
@@ -1391,8 +1392,10 @@ __all__ = [
"UserMessageTypedDict",
"Variables",
"VariablesTypedDict",
"VideoURL",
"VideoURLTypedDict",
"VideoURL1",
"VideoURL1TypedDict",
"VideoURL2",
"VideoURL2TypedDict",
"WebSearchPreviewToolUserLocation",
"WebSearchPreviewToolUserLocationType",
"WebSearchPreviewToolUserLocationTypedDict",
@@ -1410,6 +1413,7 @@ _dynamic_imports: dict[str, str] = {
"BadGatewayResponseErrorDataTypedDict": ".badgatewayresponseerrordata",
"BadRequestResponseErrorData": ".badrequestresponseerrordata",
"BadRequestResponseErrorDataTypedDict": ".badrequestresponseerrordata",
"ChatCompletionFinishReason": ".chatcompletionfinishreason",
"ChatErrorError": ".chaterror",
"ChatErrorErrorTypedDict": ".chaterror",
"Code": ".chaterror",
@@ -1426,6 +1430,8 @@ _dynamic_imports: dict[str, str] = {
"ChatGenerationParamsStop": ".chatgenerationparams",
"ChatGenerationParamsStopTypedDict": ".chatgenerationparams",
"ChatGenerationParamsTypedDict": ".chatgenerationparams",
"Debug": ".chatgenerationparams",
"DebugTypedDict": ".chatgenerationparams",
"Effort": ".chatgenerationparams",
"Reasoning": ".chatgenerationparams",
"ReasoningTypedDict": ".chatgenerationparams",
@@ -1438,14 +1444,12 @@ _dynamic_imports: dict[str, str] = {
"ChatMessageContentItem": ".chatmessagecontentitem",
"ChatMessageContentItemTypedDict": ".chatmessagecontentitem",
"ChatMessageContentItemAudio": ".chatmessagecontentitemaudio",
"ChatMessageContentItemAudioFormat": ".chatmessagecontentitemaudio",
"ChatMessageContentItemAudioInputAudio": ".chatmessagecontentitemaudio",
"ChatMessageContentItemAudioInputAudioTypedDict": ".chatmessagecontentitemaudio",
"ChatMessageContentItemAudioTypedDict": ".chatmessagecontentitemaudio",
"ChatMessageContentItemFile": ".chatmessagecontentitemfile",
"ChatMessageContentItemFileTypedDict": ".chatmessagecontentitemfile",
"File": ".chatmessagecontentitemfile",
"FileTypedDict": ".chatmessagecontentitemfile",
"ChatMessageContentItemCacheControl": ".chatmessagecontentitemcachecontrol",
"ChatMessageContentItemCacheControlTypedDict": ".chatmessagecontentitemcachecontrol",
"TTL": ".chatmessagecontentitemcachecontrol",
"ChatMessageContentItemImage": ".chatmessagecontentitemimage",
"ChatMessageContentItemImageDetail": ".chatmessagecontentitemimage",
"ChatMessageContentItemImageTypedDict": ".chatmessagecontentitemimage",
@@ -1459,8 +1463,10 @@ _dynamic_imports: dict[str, str] = {
"ChatMessageContentItemVideoTypedDict": ".chatmessagecontentitemvideo",
"ChatMessageContentItemVideoVideoURL": ".chatmessagecontentitemvideo",
"ChatMessageContentItemVideoVideoURLTypedDict": ".chatmessagecontentitemvideo",
"ChatMessageContentItemVideoVideoURLVideoURL": ".chatmessagecontentitemvideo",
"ChatMessageContentItemVideoVideoURLVideoURLTypedDict": ".chatmessagecontentitemvideo",
"VideoURL1": ".chatmessagecontentitemvideo",
"VideoURL1TypedDict": ".chatmessagecontentitemvideo",
"VideoURL2": ".chatmessagecontentitemvideo",
"VideoURL2TypedDict": ".chatmessagecontentitemvideo",
"ChatMessageTokenLogprob": ".chatmessagetokenlogprob",
"ChatMessageTokenLogprobTypedDict": ".chatmessagetokenlogprob",
"TopLogprob": ".chatmessagetokenlogprob",
@@ -1473,11 +1479,10 @@ _dynamic_imports: dict[str, str] = {
"ChatMessageToolCallTypedDict": ".chatmessagetoolcall",
"ChatResponse": ".chatresponse",
"ChatResponseTypedDict": ".chatresponse",
"ChatCompletionFinishReason": ".chatresponsechoice",
"ChatResponseChoice": ".chatresponsechoice",
"ChatResponseChoiceTypedDict": ".chatresponsechoice",
"ChatStreamingChoice": ".chatresponsechoice",
"ChatStreamingChoiceTypedDict": ".chatresponsechoice",
"ChatStreamingChoice": ".chatstreamingchoice",
"ChatStreamingChoiceTypedDict": ".chatstreamingchoice",
"ChatStreamingMessageChunk": ".chatstreamingmessagechunk",
"ChatStreamingMessageChunkRole": ".chatstreamingmessagechunk",
"ChatStreamingMessageChunkTypedDict": ".chatstreamingmessagechunk",
@@ -1724,6 +1729,7 @@ _dynamic_imports: dict[str, str] = {
"Engine": ".openresponsesrequest",
"IDFileParser": ".openresponsesrequest",
"IDModeration": ".openresponsesrequest",
"IDResponseHealing": ".openresponsesrequest",
"IDWeb": ".openresponsesrequest",
"Ignore": ".openresponsesrequest",
"IgnoreTypedDict": ".openresponsesrequest",
@@ -1748,6 +1754,8 @@ _dynamic_imports: dict[str, str] = {
"PluginFileParserTypedDict": ".openresponsesrequest",
"PluginModeration": ".openresponsesrequest",
"PluginModerationTypedDict": ".openresponsesrequest",
"PluginResponseHealing": ".openresponsesrequest",
"PluginResponseHealingTypedDict": ".openresponsesrequest",
"PluginTypedDict": ".openresponsesrequest",
"PluginWeb": ".openresponsesrequest",
"PluginWebTypedDict": ".openresponsesrequest",
@@ -1998,8 +2006,6 @@ _dynamic_imports: dict[str, str] = {
"UserMessageContent": ".usermessage",
"UserMessageContentTypedDict": ".usermessage",
"UserMessageTypedDict": ".usermessage",
"VideoURL": ".videourl",
"VideoURLTypedDict": ".videourl",
"WebSearchPreviewToolUserLocation": ".websearchpreviewtooluserlocation",
"WebSearchPreviewToolUserLocationType": ".websearchpreviewtooluserlocation",
"WebSearchPreviewToolUserLocationTypedDict": ".websearchpreviewtooluserlocation",
@@ -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
ChatCompletionFinishReason = Union[
Literal[
"tool_calls",
"stop",
"length",
"content_filter",
"error",
],
UnrecognizedStr,
]
@@ -156,6 +156,14 @@ ChatGenerationParamsStop = TypeAliasType(
)
class DebugTypedDict(TypedDict):
echo_upstream_body: NotRequired[bool]
class Debug(BaseModel):
echo_upstream_body: Optional[bool] = None
class ChatGenerationParamsTypedDict(TypedDict):
messages: List[MessageTypedDict]
model: NotRequired[str]
@@ -179,6 +187,7 @@ class ChatGenerationParamsTypedDict(TypedDict):
tools: NotRequired[List[ToolDefinitionJSONTypedDict]]
top_p: NotRequired[Nullable[float]]
user: NotRequired[str]
debug: NotRequired[DebugTypedDict]
class ChatGenerationParams(BaseModel):
@@ -226,6 +235,8 @@ class ChatGenerationParams(BaseModel):
user: Optional[str] = None
debug: Optional[Debug] = None
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
@@ -250,6 +261,7 @@ class ChatGenerationParams(BaseModel):
"tools",
"top_p",
"user",
"debug",
]
nullable_fields = [
"frequency_penalty",
@@ -5,10 +5,6 @@ from .chatmessagecontentitemaudio import (
ChatMessageContentItemAudio,
ChatMessageContentItemAudioTypedDict,
)
from .chatmessagecontentitemfile import (
ChatMessageContentItemFile,
ChatMessageContentItemFileTypedDict,
)
from .chatmessagecontentitemimage import (
ChatMessageContentItemImage,
ChatMessageContentItemImageTypedDict,
@@ -30,10 +26,9 @@ from typing_extensions import Annotated, TypeAliasType
ChatMessageContentItemTypedDict = TypeAliasType(
"ChatMessageContentItemTypedDict",
Union[
ChatMessageContentItemTextTypedDict,
ChatMessageContentItemImageTypedDict,
ChatMessageContentItemAudioTypedDict,
ChatMessageContentItemFileTypedDict,
ChatMessageContentItemTextTypedDict,
ChatMessageContentItemVideoTypedDict,
],
)
@@ -46,7 +41,6 @@ ChatMessageContentItem = Annotated[
Annotated[ChatMessageContentItemAudio, Tag("input_audio")],
Annotated[ChatMessageContentItemVideo, Tag("input_video")],
Annotated[ChatMessageContentItemVideo, Tag("video_url")],
Annotated[ChatMessageContentItemFile, Tag("file")],
],
Discriminator(lambda m: get_discriminator(m, "type", "type")),
]
@@ -1,42 +1,23 @@
"""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_const, validate_open_enum
from openrouter.types import BaseModel
from openrouter.utils import validate_const
import pydantic
from pydantic.functional_validators import AfterValidator, PlainValidator
from typing import Literal, Union
from pydantic.functional_validators import AfterValidator
from typing import Literal
from typing_extensions import Annotated, TypedDict
ChatMessageContentItemAudioFormat = Union[
Literal[
"wav",
"mp3",
"flac",
"m4a",
"ogg",
"pcm16",
"pcm24",
],
UnrecognizedStr,
]
class ChatMessageContentItemAudioInputAudioTypedDict(TypedDict):
data: str
format_: ChatMessageContentItemAudioFormat
format_: str
class ChatMessageContentItemAudioInputAudio(BaseModel):
data: str
format_: Annotated[
Annotated[
ChatMessageContentItemAudioFormat, PlainValidator(validate_open_enum(False))
],
pydantic.Field(alias="format"),
]
format_: Annotated[str, pydantic.Field(alias="format")]
class ChatMessageContentItemAudioTypedDict(TypedDict):
@@ -0,0 +1,32 @@
"""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_const, validate_open_enum
import pydantic
from pydantic.functional_validators import AfterValidator, PlainValidator
from typing import Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
TTL = Union[
Literal[
"5m",
"1h",
],
UnrecognizedStr,
]
class ChatMessageContentItemCacheControlTypedDict(TypedDict):
type: Literal["ephemeral"]
ttl: NotRequired[TTL]
class ChatMessageContentItemCacheControl(BaseModel):
TYPE: Annotated[
Annotated[Literal["ephemeral"], AfterValidator(validate_const("ephemeral"))],
pydantic.Field(alias="type"),
] = "ephemeral"
ttl: Annotated[Optional[TTL], PlainValidator(validate_open_enum(False))] = None
@@ -1,37 +0,0 @@
"""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, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class FileTypedDict(TypedDict):
file_data: str
file_id: NotRequired[str]
filename: NotRequired[str]
class File(BaseModel):
file_data: str
file_id: Optional[str] = None
filename: Optional[str] = None
class ChatMessageContentItemFileTypedDict(TypedDict):
file: FileTypedDict
type: Literal["file"]
class ChatMessageContentItemFile(BaseModel):
file: File
TYPE: Annotated[
Annotated[Literal["file"], AfterValidator(validate_const("file"))],
pydantic.Field(alias="type"),
] = "file"
@@ -1,17 +1,22 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .chatmessagecontentitemcachecontrol import (
ChatMessageContentItemCacheControl,
ChatMessageContentItemCacheControlTypedDict,
)
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, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class ChatMessageContentItemTextTypedDict(TypedDict):
text: str
type: Literal["text"]
cache_control: NotRequired[ChatMessageContentItemCacheControlTypedDict]
class ChatMessageContentItemText(BaseModel):
@@ -21,3 +26,5 @@ class ChatMessageContentItemText(BaseModel):
Annotated[Literal["text"], AfterValidator(validate_const("text"))],
pydantic.Field(alias="type"),
] = "text"
cache_control: Optional[ChatMessageContentItemCacheControl] = None
@@ -1,7 +1,6 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from .videourl import VideoURL, VideoURLTypedDict
from openrouter.types import BaseModel
from openrouter.utils import get_discriminator, validate_const
import pydantic
@@ -11,21 +10,21 @@ from typing import Literal, Union
from typing_extensions import Annotated, TypeAliasType, TypedDict
class ChatMessageContentItemVideoVideoURLVideoURLTypedDict(TypedDict):
class VideoURL2TypedDict(TypedDict):
url: str
class ChatMessageContentItemVideoVideoURLVideoURL(BaseModel):
class VideoURL2(BaseModel):
url: str
class ChatMessageContentItemVideoVideoURLTypedDict(TypedDict):
video_url: ChatMessageContentItemVideoVideoURLVideoURLTypedDict
video_url: VideoURL2TypedDict
type: Literal["video_url"]
class ChatMessageContentItemVideoVideoURL(BaseModel):
video_url: ChatMessageContentItemVideoVideoURLVideoURL
video_url: VideoURL2
TYPE: Annotated[
Annotated[Literal["video_url"], AfterValidator(validate_const("video_url"))],
@@ -33,13 +32,21 @@ class ChatMessageContentItemVideoVideoURL(BaseModel):
] = "video_url"
class VideoURL1TypedDict(TypedDict):
url: str
class VideoURL1(BaseModel):
url: str
class ChatMessageContentItemVideoInputVideoTypedDict(TypedDict):
video_url: VideoURLTypedDict
video_url: VideoURL1TypedDict
type: Literal["input_video"]
class ChatMessageContentItemVideoInputVideo(BaseModel):
video_url: VideoURL
video_url: VideoURL1
TYPE: Annotated[
Annotated[
@@ -2,41 +2,24 @@
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
@@ -84,52 +67,3 @@ 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
@@ -0,0 +1,72 @@
"""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 .chatresponsechoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict
from .chatstreamingchoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict
from openrouter.types import (
BaseModel,
Nullable,
+18 -5
View File
@@ -2,12 +2,19 @@
from __future__ import annotations
from .completionlogprobs import CompletionLogprobs, CompletionLogprobsTypedDict
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr
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, TypedDict
from typing import Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict
CompletionFinishReason = Union[
@@ -25,6 +32,8 @@ class CompletionChoiceTypedDict(TypedDict):
index: float
logprobs: Nullable[CompletionLogprobsTypedDict]
finish_reason: Nullable[CompletionFinishReason]
native_finish_reason: NotRequired[str]
reasoning: NotRequired[Nullable[str]]
class CompletionChoice(BaseModel):
@@ -38,10 +47,14 @@ class CompletionChoice(BaseModel):
Nullable[CompletionFinishReason], PlainValidator(validate_open_enum(False))
]
native_finish_reason: Optional[str] = None
reasoning: OptionalNullable[str] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = []
nullable_fields = ["logprobs", "finish_reason"]
optional_fields = ["native_finish_reason", "reasoning"]
nullable_fields = ["logprobs", "finish_reason", "reasoning"]
null_default_fields = []
serialized = handler(self)
@@ -17,6 +17,7 @@ class CompletionResponseTypedDict(TypedDict):
model: str
choices: List[CompletionChoiceTypedDict]
object: Literal["text_completion"]
provider: NotRequired[str]
system_fingerprint: NotRequired[str]
usage: NotRequired[CompletionUsageTypedDict]
@@ -38,6 +39,8 @@ class CompletionResponse(BaseModel):
pydantic.Field(alias="object"),
] = "text_completion"
provider: Optional[str] = None
system_fingerprint: Optional[str] = None
usage: Optional[CompletionUsage] = None
@@ -44,9 +44,10 @@ from openrouter.types import (
UNSET_SENTINEL,
UnrecognizedStr,
)
from openrouter.utils import get_discriminator, validate_open_enum
from openrouter.utils import get_discriminator, validate_const, validate_open_enum
import pydantic
from pydantic import Discriminator, Tag, model_serializer
from pydantic.functional_validators import PlainValidator
from pydantic.functional_validators import AfterValidator, PlainValidator
from typing import Any, Dict, List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
@@ -135,16 +136,7 @@ OpenResponsesRequestToolUnion = Annotated[
]
ServiceTier = Union[
Literal[
"auto",
"default",
"flex",
"priority",
"scale",
],
UnrecognizedStr,
]
ServiceTier = Literal["auto",]
Truncation = Union[
@@ -356,6 +348,17 @@ class Provider(BaseModel):
return m
IDResponseHealing = Literal["response-healing",]
class PluginResponseHealingTypedDict(TypedDict):
id: IDResponseHealing
class PluginResponseHealing(BaseModel):
id: IDResponseHealing
IDFileParser = Literal["file-parser",]
@@ -437,7 +440,12 @@ class PluginModeration(BaseModel):
PluginTypedDict = TypeAliasType(
"PluginTypedDict",
Union[PluginModerationTypedDict, PluginFileParserTypedDict, PluginWebTypedDict],
Union[
PluginModerationTypedDict,
PluginResponseHealingTypedDict,
PluginFileParserTypedDict,
PluginWebTypedDict,
],
)
@@ -446,6 +454,7 @@ Plugin = Annotated[
Annotated[PluginModeration, Tag("moderation")],
Annotated[PluginWeb, Tag("web")],
Annotated[PluginFileParser, Tag("file-parser")],
Annotated[PluginResponseHealing, Tag("response-healing")],
],
Discriminator(lambda m: get_discriminator(m, "id", "id")),
]
@@ -478,8 +487,8 @@ class OpenResponsesRequestTypedDict(TypedDict):
include: NotRequired[Nullable[List[OpenAIResponsesIncludable]]]
background: NotRequired[Nullable[bool]]
safety_identifier: NotRequired[Nullable[str]]
store: NotRequired[Nullable[bool]]
service_tier: NotRequired[Nullable[ServiceTier]]
store: Literal[False]
service_tier: NotRequired[ServiceTier]
truncation: NotRequired[Nullable[Truncation]]
stream: NotRequired[bool]
provider: NotRequired[Nullable[ProviderTypedDict]]
@@ -488,6 +497,8 @@ class OpenResponsesRequestTypedDict(TypedDict):
r"""Plugins you want to enable for this request, including their settings."""
user: NotRequired[str]
r"""A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters."""
session_id: NotRequired[str]
r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters."""
class OpenResponsesRequest(BaseModel):
@@ -543,11 +554,12 @@ class OpenResponsesRequest(BaseModel):
safety_identifier: OptionalNullable[str] = UNSET
store: OptionalNullable[bool] = UNSET
STORE: Annotated[
Annotated[Optional[Literal[False]], AfterValidator(validate_const(False))],
pydantic.Field(alias="store"),
] = False
service_tier: Annotated[
OptionalNullable[ServiceTier], PlainValidator(validate_open_enum(False))
] = UNSET
service_tier: Optional[ServiceTier] = "auto"
truncation: Annotated[
OptionalNullable[Truncation], PlainValidator(validate_open_enum(False))
@@ -564,6 +576,9 @@ class OpenResponsesRequest(BaseModel):
user: Optional[str] = None
r"""A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters."""
session_id: Optional[str] = None
r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = [
@@ -594,6 +609,7 @@ class OpenResponsesRequest(BaseModel):
"provider",
"plugins",
"user",
"session_id",
]
nullable_fields = [
"instructions",
@@ -609,8 +625,6 @@ class OpenResponsesRequest(BaseModel):
"include",
"background",
"safety_identifier",
"store",
"service_tier",
"truncation",
"provider",
]
+6 -1
View File
@@ -11,12 +11,14 @@ ProviderName = Union[
"AionLabs",
"Alibaba",
"Amazon Bedrock",
"Amazon Nova",
"Anthropic",
"Arcee",
"Arcee AI",
"AtlasCloud",
"Avian",
"Azure",
"BaseTen",
"BytePlus",
"Black Forest Labs",
"Cerebras",
"Chutes",
@@ -31,6 +33,7 @@ ProviderName = Union[
"Fireworks",
"Friendli",
"GMICloud",
"GoPomelo",
"Google",
"Google AI Studio",
"Groq",
@@ -60,7 +63,9 @@ ProviderName = Union[
"Relace",
"SambaNova",
"SiliconFlow",
"Sourceful",
"Stealth",
"StreamLake",
"Switchpoint",
"Targon",
"Together",
-13
View File
@@ -1,13 +0,0 @@
"""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 VideoURLTypedDict(TypedDict):
url: str
class VideoURL(BaseModel):
url: str
+10 -1
View File
@@ -100,7 +100,12 @@ if TYPE_CHECKING:
ExchangeAuthCodeForAPIKeyResponse,
ExchangeAuthCodeForAPIKeyResponseTypedDict,
)
from .getcredits import GetCreditsResponse, GetCreditsResponseTypedDict
from .getcredits import (
GetCreditsData,
GetCreditsDataTypedDict,
GetCreditsResponse,
GetCreditsResponseTypedDict,
)
from .getcurrentkey import (
GetCurrentKeyData,
GetCurrentKeyDataTypedDict,
@@ -242,6 +247,8 @@ __all__ = [
"ExchangeAuthCodeForAPIKeyRequestTypedDict",
"ExchangeAuthCodeForAPIKeyResponse",
"ExchangeAuthCodeForAPIKeyResponseTypedDict",
"GetCreditsData",
"GetCreditsDataTypedDict",
"GetCreditsResponse",
"GetCreditsResponseTypedDict",
"GetCurrentKeyData",
@@ -416,6 +423,8 @@ _dynamic_imports: dict[str, str] = {
"ExchangeAuthCodeForAPIKeyRequestTypedDict": ".exchangeauthcodeforapikey",
"ExchangeAuthCodeForAPIKeyResponse": ".exchangeauthcodeforapikey",
"ExchangeAuthCodeForAPIKeyResponseTypedDict": ".exchangeauthcodeforapikey",
"GetCreditsData": ".getcredits",
"GetCreditsDataTypedDict": ".getcredits",
"GetCreditsResponse": ".getcredits",
"GetCreditsResponseTypedDict": ".getcredits",
"GetCurrentKeyData": ".getcurrentkey",
+19
View File
@@ -5,9 +5,28 @@ from openrouter.types import BaseModel
from typing_extensions import TypedDict
class GetCreditsDataTypedDict(TypedDict):
total_credits: float
r"""Total credits purchased"""
total_usage: float
r"""Total credits used"""
class GetCreditsData(BaseModel):
total_credits: float
r"""Total credits purchased"""
total_usage: float
r"""Total credits used"""
class GetCreditsResponseTypedDict(TypedDict):
r"""Total credits purchased and used"""
data: GetCreditsDataTypedDict
class GetCreditsResponse(BaseModel):
r"""Total credits purchased and used"""
data: GetCreditsData
+6 -1
View File
@@ -38,12 +38,14 @@ GetParametersProvider = Union[
"AionLabs",
"Alibaba",
"Amazon Bedrock",
"Amazon Nova",
"Anthropic",
"Arcee",
"Arcee AI",
"AtlasCloud",
"Avian",
"Azure",
"BaseTen",
"BytePlus",
"Black Forest Labs",
"Cerebras",
"Chutes",
@@ -58,6 +60,7 @@ GetParametersProvider = Union[
"Fireworks",
"Friendli",
"GMICloud",
"GoPomelo",
"Google",
"Google AI Studio",
"Groq",
@@ -87,7 +90,9 @@ GetParametersProvider = Union[
"Relace",
"SambaNova",
"SiliconFlow",
"Sourceful",
"Stealth",
"StreamLake",
"Switchpoint",
"Targon",
"Together",
+20 -20
View File
@@ -69,8 +69,7 @@ class Responses(BaseSDK):
include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET,
background: OptionalNullable[bool] = UNSET,
safety_identifier: OptionalNullable[str] = UNSET,
store: OptionalNullable[bool] = UNSET,
service_tier: OptionalNullable[components.ServiceTier] = UNSET,
service_tier: Optional[components.ServiceTier] = "auto",
truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Union[Literal[False], None] = None,
provider: OptionalNullable[
@@ -80,6 +79,7 @@ class Responses(BaseSDK):
Union[List[components.Plugin], List[components.PluginTypedDict]]
] = None,
user: Optional[str] = None,
session_id: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -109,13 +109,13 @@ class Responses(BaseSDK):
:param include:
:param background:
:param safety_identifier:
:param store:
:param service_tier:
:param truncation:
:param stream:
:param provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings.
:param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -174,8 +174,7 @@ class Responses(BaseSDK):
include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET,
background: OptionalNullable[bool] = UNSET,
safety_identifier: OptionalNullable[str] = UNSET,
store: OptionalNullable[bool] = UNSET,
service_tier: OptionalNullable[components.ServiceTier] = UNSET,
service_tier: Optional[components.ServiceTier] = "auto",
truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Literal[True],
provider: OptionalNullable[
@@ -185,6 +184,7 @@ class Responses(BaseSDK):
Union[List[components.Plugin], List[components.PluginTypedDict]]
] = None,
user: Optional[str] = None,
session_id: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -214,13 +214,13 @@ class Responses(BaseSDK):
:param include:
:param background:
:param safety_identifier:
:param store:
:param service_tier:
:param truncation:
:param stream:
:param provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings.
:param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -278,8 +278,7 @@ class Responses(BaseSDK):
include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET,
background: OptionalNullable[bool] = UNSET,
safety_identifier: OptionalNullable[str] = UNSET,
store: OptionalNullable[bool] = UNSET,
service_tier: OptionalNullable[components.ServiceTier] = UNSET,
service_tier: Optional[components.ServiceTier] = "auto",
truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Optional[bool] = False,
provider: OptionalNullable[
@@ -289,6 +288,7 @@ class Responses(BaseSDK):
Union[List[components.Plugin], List[components.PluginTypedDict]]
] = None,
user: Optional[str] = None,
session_id: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -318,13 +318,13 @@ class Responses(BaseSDK):
:param include:
:param background:
:param safety_identifier:
:param store:
:param service_tier:
:param truncation:
:param stream:
:param provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings.
:param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -374,7 +374,6 @@ class Responses(BaseSDK):
include=include,
background=background,
safety_identifier=safety_identifier,
store=store,
service_tier=service_tier,
truncation=truncation,
stream=stream,
@@ -385,6 +384,7 @@ class Responses(BaseSDK):
plugins, Optional[List[components.Plugin]]
),
user=user,
session_id=session_id,
)
req = self._build_request(
@@ -627,8 +627,7 @@ class Responses(BaseSDK):
include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET,
background: OptionalNullable[bool] = UNSET,
safety_identifier: OptionalNullable[str] = UNSET,
store: OptionalNullable[bool] = UNSET,
service_tier: OptionalNullable[components.ServiceTier] = UNSET,
service_tier: Optional[components.ServiceTier] = "auto",
truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Union[Literal[False], None] = None,
provider: OptionalNullable[
@@ -638,6 +637,7 @@ class Responses(BaseSDK):
Union[List[components.Plugin], List[components.PluginTypedDict]]
] = None,
user: Optional[str] = None,
session_id: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -667,13 +667,13 @@ class Responses(BaseSDK):
:param include:
:param background:
:param safety_identifier:
:param store:
:param service_tier:
:param truncation:
:param stream:
:param provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings.
:param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -732,8 +732,7 @@ class Responses(BaseSDK):
include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET,
background: OptionalNullable[bool] = UNSET,
safety_identifier: OptionalNullable[str] = UNSET,
store: OptionalNullable[bool] = UNSET,
service_tier: OptionalNullable[components.ServiceTier] = UNSET,
service_tier: Optional[components.ServiceTier] = "auto",
truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Literal[True],
provider: OptionalNullable[
@@ -743,6 +742,7 @@ class Responses(BaseSDK):
Union[List[components.Plugin], List[components.PluginTypedDict]]
] = None,
user: Optional[str] = None,
session_id: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -772,13 +772,13 @@ class Responses(BaseSDK):
:param include:
:param background:
:param safety_identifier:
:param store:
:param service_tier:
:param truncation:
:param stream:
:param provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings.
:param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -836,8 +836,7 @@ class Responses(BaseSDK):
include: OptionalNullable[List[components.OpenAIResponsesIncludable]] = UNSET,
background: OptionalNullable[bool] = UNSET,
safety_identifier: OptionalNullable[str] = UNSET,
store: OptionalNullable[bool] = UNSET,
service_tier: OptionalNullable[components.ServiceTier] = UNSET,
service_tier: Optional[components.ServiceTier] = "auto",
truncation: OptionalNullable[components.Truncation] = UNSET,
stream: Optional[bool] = False,
provider: OptionalNullable[
@@ -847,6 +846,7 @@ class Responses(BaseSDK):
Union[List[components.Plugin], List[components.PluginTypedDict]]
] = None,
user: Optional[str] = None,
session_id: Optional[str] = None,
retries: OptionalNullable[utils.RetryConfig] = UNSET,
server_url: Optional[str] = None,
timeout_ms: Optional[int] = None,
@@ -876,13 +876,13 @@ class Responses(BaseSDK):
:param include:
:param background:
:param safety_identifier:
:param store:
:param service_tier:
:param truncation:
:param stream:
:param provider: When multiple model providers are available, optionally indicate your routing preference.
:param plugins: Plugins you want to enable for this request, including their settings.
:param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
:param retries: Override the default retry configuration for this method
:param server_url: Override the default server URL for this method
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -932,7 +932,6 @@ class Responses(BaseSDK):
include=include,
background=background,
safety_identifier=safety_identifier,
store=store,
service_tier=service_tier,
truncation=truncation,
stream=stream,
@@ -943,6 +942,7 @@ class Responses(BaseSDK):
plugins, Optional[List[components.Plugin]]
),
user=user,
session_id=session_id,
)
req = self._build_request_async(