openrouter 0.0.18__py3-none-any.whl → 0.0.19__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openrouter/_version.py +3 -3
- openrouter/analytics.py +0 -2
- openrouter/api_keys.py +4 -24
- openrouter/basesdk.py +0 -6
- openrouter/chat.py +14 -212
- openrouter/completions.py +0 -2
- openrouter/components/__init__.py +105 -447
- openrouter/components/chatgenerationparams.py +17 -559
- openrouter/components/chatgenerationtokenusage.py +0 -3
- openrouter/components/chatmessagecontentitem.py +1 -1
- openrouter/components/chatmessagecontentitemaudio.py +25 -6
- openrouter/components/chatmessagecontentitemtext.py +2 -9
- openrouter/components/chatmessagecontentitemvideo.py +5 -9
- openrouter/components/chatmessagetokenlogprob.py +4 -4
- openrouter/components/chatresponsechoice.py +67 -6
- openrouter/components/chatstreamingmessagechunk.py +1 -12
- openrouter/components/chatstreamingresponsechunk.py +1 -1
- openrouter/components/completionchoice.py +5 -18
- openrouter/components/completioncreateparams.py +10 -10
- openrouter/components/completionresponse.py +0 -3
- openrouter/components/message.py +9 -10
- openrouter/components/openairesponsesannotation.py +4 -11
- openrouter/components/openairesponsesreasoningeffort.py +0 -1
- openrouter/components/openresponseseasyinputmessage.py +20 -93
- openrouter/components/openresponsesinput.py +2 -2
- openrouter/components/openresponsesinputmessageitem.py +14 -87
- openrouter/components/openresponsesnonstreamingresponse.py +19 -33
- openrouter/components/openresponsesreasoning.py +0 -1
- openrouter/components/openresponsesrequest.py +119 -246
- openrouter/components/openresponsesstreamevent.py +39 -110
- openrouter/components/outputmessage.py +4 -10
- openrouter/components/parameter.py +0 -1
- openrouter/components/providername.py +2 -10
- openrouter/components/providersort.py +1 -0
- openrouter/components/publicendpoint.py +49 -60
- openrouter/components/publicpricing.py +49 -49
- openrouter/components/responseformattextconfig.py +7 -9
- openrouter/components/responseoutputtext.py +1 -36
- openrouter/components/responsesoutputitem.py +11 -13
- openrouter/components/responsesoutputitemreasoning.py +3 -43
- openrouter/components/responsesoutputmessage.py +5 -10
- openrouter/credits.py +0 -4
- openrouter/embeddings.py +8 -10
- openrouter/endpoints.py +0 -4
- openrouter/generations.py +0 -2
- openrouter/models_.py +0 -6
- openrouter/oauth.py +0 -4
- openrouter/operations/__init__.py +34 -10
- openrouter/operations/createembeddings.py +247 -16
- openrouter/operations/getcredits.py +0 -19
- openrouter/operations/getgeneration.py +0 -6
- openrouter/operations/getparameters.py +71 -5
- openrouter/operations/updatekeys.py +2 -2
- openrouter/parameters.py +2 -4
- openrouter/providers.py +0 -2
- openrouter/responses.py +36 -188
- openrouter/sdk.py +0 -13
- openrouter/sdkconfiguration.py +0 -2
- openrouter/utils/forms.py +10 -21
- openrouter/utils/queryparams.py +2 -14
- openrouter/utils/retries.py +5 -69
- {openrouter-0.0.18.dist-info → openrouter-0.0.19.dist-info}/METADATA +1 -1
- {openrouter-0.0.18.dist-info → openrouter-0.0.19.dist-info}/RECORD +66 -87
- openrouter/components/_schema0.py +0 -94
- openrouter/components/_schema3.py +0 -229
- openrouter/components/chatcompletionfinishreason.py +0 -17
- openrouter/components/chatmessagecontentitemcachecontrol.py +0 -32
- openrouter/components/chatstreamingchoice.py +0 -72
- openrouter/components/pdfparserengine.py +0 -16
- openrouter/components/pdfparseroptions.py +0 -25
- openrouter/components/percentilelatencycutoffs.py +0 -71
- openrouter/components/percentilestats.py +0 -34
- openrouter/components/percentilethroughputcutoffs.py +0 -71
- openrouter/components/preferredmaxlatency.py +0 -21
- openrouter/components/preferredminthroughput.py +0 -22
- openrouter/components/providerpreferences.py +0 -355
- openrouter/components/providersortconfig.py +0 -71
- openrouter/components/providersortunion.py +0 -23
- openrouter/components/responseinputvideo.py +0 -26
- openrouter/components/responsesoutputmodality.py +0 -14
- openrouter/components/websearchengine.py +0 -15
- openrouter/models/__init__.py +0 -3
- openrouter/models/internal/__init__.py +0 -54
- openrouter/models/internal/globals.py +0 -41
- {openrouter-0.0.18.dist-info → openrouter-0.0.19.dist-info}/WHEEL +0 -0
- {openrouter-0.0.18.dist-info → openrouter-0.0.19.dist-info}/licenses/LICENSE +0 -0
- {openrouter-0.0.18.dist-info → openrouter-0.0.19.dist-info}/top_level.txt +0 -0
openrouter/_version.py
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import importlib.metadata
|
|
4
4
|
|
|
5
5
|
__title__: str = "openrouter"
|
|
6
|
-
__version__: str = "0.0.
|
|
6
|
+
__version__: str = "0.0.19"
|
|
7
7
|
__openapi_doc_version__: str = "1.0.0"
|
|
8
|
-
__gen_version__: str = "2.
|
|
9
|
-
__user_agent__: str = "speakeasy-sdk/python 0.0.
|
|
8
|
+
__gen_version__: str = "2.755.9"
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 0.0.19 2.755.9 1.0.0 openrouter"
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
if __package__ is not None:
|
openrouter/analytics.py
CHANGED
|
@@ -58,7 +58,6 @@ class Analytics(BaseSDK):
|
|
|
58
58
|
accept_header_value="application/json",
|
|
59
59
|
http_headers=http_headers,
|
|
60
60
|
security=self.sdk_configuration.security,
|
|
61
|
-
allow_empty_value=None,
|
|
62
61
|
timeout_ms=timeout_ms,
|
|
63
62
|
)
|
|
64
63
|
|
|
@@ -167,7 +166,6 @@ class Analytics(BaseSDK):
|
|
|
167
166
|
accept_header_value="application/json",
|
|
168
167
|
http_headers=http_headers,
|
|
169
168
|
security=self.sdk_configuration.security,
|
|
170
|
-
allow_empty_value=None,
|
|
171
169
|
timeout_ms=timeout_ms,
|
|
172
170
|
)
|
|
173
171
|
|
openrouter/api_keys.py
CHANGED
|
@@ -60,7 +60,6 @@ class APIKeys(BaseSDK):
|
|
|
60
60
|
accept_header_value="application/json",
|
|
61
61
|
http_headers=http_headers,
|
|
62
62
|
security=self.sdk_configuration.security,
|
|
63
|
-
allow_empty_value=None,
|
|
64
63
|
timeout_ms=timeout_ms,
|
|
65
64
|
)
|
|
66
65
|
|
|
@@ -165,7 +164,6 @@ class APIKeys(BaseSDK):
|
|
|
165
164
|
accept_header_value="application/json",
|
|
166
165
|
http_headers=http_headers,
|
|
167
166
|
security=self.sdk_configuration.security,
|
|
168
|
-
allow_empty_value=None,
|
|
169
167
|
timeout_ms=timeout_ms,
|
|
170
168
|
)
|
|
171
169
|
|
|
@@ -282,7 +280,6 @@ class APIKeys(BaseSDK):
|
|
|
282
280
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
283
281
|
request, False, False, "json", operations.CreateKeysRequest
|
|
284
282
|
),
|
|
285
|
-
allow_empty_value=None,
|
|
286
283
|
timeout_ms=timeout_ms,
|
|
287
284
|
)
|
|
288
285
|
|
|
@@ -404,7 +401,6 @@ class APIKeys(BaseSDK):
|
|
|
404
401
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
405
402
|
request, False, False, "json", operations.CreateKeysRequest
|
|
406
403
|
),
|
|
407
|
-
allow_empty_value=None,
|
|
408
404
|
timeout_ms=timeout_ms,
|
|
409
405
|
)
|
|
410
406
|
|
|
@@ -506,7 +502,7 @@ class APIKeys(BaseSDK):
|
|
|
506
502
|
|
|
507
503
|
request = operations.UpdateKeysRequest(
|
|
508
504
|
hash=hash,
|
|
509
|
-
|
|
505
|
+
body=operations.UpdateKeysRequestBody(
|
|
510
506
|
name=name,
|
|
511
507
|
disabled=disabled,
|
|
512
508
|
limit=limit,
|
|
@@ -529,13 +525,8 @@ class APIKeys(BaseSDK):
|
|
|
529
525
|
http_headers=http_headers,
|
|
530
526
|
security=self.sdk_configuration.security,
|
|
531
527
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
532
|
-
request.
|
|
533
|
-
False,
|
|
534
|
-
False,
|
|
535
|
-
"json",
|
|
536
|
-
operations.UpdateKeysRequestBody,
|
|
528
|
+
request.body, False, False, "json", operations.UpdateKeysRequestBody
|
|
537
529
|
),
|
|
538
|
-
allow_empty_value=None,
|
|
539
530
|
timeout_ms=timeout_ms,
|
|
540
531
|
)
|
|
541
532
|
|
|
@@ -642,7 +633,7 @@ class APIKeys(BaseSDK):
|
|
|
642
633
|
|
|
643
634
|
request = operations.UpdateKeysRequest(
|
|
644
635
|
hash=hash,
|
|
645
|
-
|
|
636
|
+
body=operations.UpdateKeysRequestBody(
|
|
646
637
|
name=name,
|
|
647
638
|
disabled=disabled,
|
|
648
639
|
limit=limit,
|
|
@@ -665,13 +656,8 @@ class APIKeys(BaseSDK):
|
|
|
665
656
|
http_headers=http_headers,
|
|
666
657
|
security=self.sdk_configuration.security,
|
|
667
658
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
668
|
-
request.
|
|
669
|
-
False,
|
|
670
|
-
False,
|
|
671
|
-
"json",
|
|
672
|
-
operations.UpdateKeysRequestBody,
|
|
659
|
+
request.body, False, False, "json", operations.UpdateKeysRequestBody
|
|
673
660
|
),
|
|
674
|
-
allow_empty_value=None,
|
|
675
661
|
timeout_ms=timeout_ms,
|
|
676
662
|
)
|
|
677
663
|
|
|
@@ -783,7 +769,6 @@ class APIKeys(BaseSDK):
|
|
|
783
769
|
accept_header_value="application/json",
|
|
784
770
|
http_headers=http_headers,
|
|
785
771
|
security=self.sdk_configuration.security,
|
|
786
|
-
allow_empty_value=None,
|
|
787
772
|
timeout_ms=timeout_ms,
|
|
788
773
|
)
|
|
789
774
|
|
|
@@ -890,7 +875,6 @@ class APIKeys(BaseSDK):
|
|
|
890
875
|
accept_header_value="application/json",
|
|
891
876
|
http_headers=http_headers,
|
|
892
877
|
security=self.sdk_configuration.security,
|
|
893
|
-
allow_empty_value=None,
|
|
894
878
|
timeout_ms=timeout_ms,
|
|
895
879
|
)
|
|
896
880
|
|
|
@@ -997,7 +981,6 @@ class APIKeys(BaseSDK):
|
|
|
997
981
|
accept_header_value="application/json",
|
|
998
982
|
http_headers=http_headers,
|
|
999
983
|
security=self.sdk_configuration.security,
|
|
1000
|
-
allow_empty_value=None,
|
|
1001
984
|
timeout_ms=timeout_ms,
|
|
1002
985
|
)
|
|
1003
986
|
|
|
@@ -1104,7 +1087,6 @@ class APIKeys(BaseSDK):
|
|
|
1104
1087
|
accept_header_value="application/json",
|
|
1105
1088
|
http_headers=http_headers,
|
|
1106
1089
|
security=self.sdk_configuration.security,
|
|
1107
|
-
allow_empty_value=None,
|
|
1108
1090
|
timeout_ms=timeout_ms,
|
|
1109
1091
|
)
|
|
1110
1092
|
|
|
@@ -1206,7 +1188,6 @@ class APIKeys(BaseSDK):
|
|
|
1206
1188
|
accept_header_value="application/json",
|
|
1207
1189
|
http_headers=http_headers,
|
|
1208
1190
|
security=self.sdk_configuration.security,
|
|
1209
|
-
allow_empty_value=None,
|
|
1210
1191
|
timeout_ms=timeout_ms,
|
|
1211
1192
|
)
|
|
1212
1193
|
|
|
@@ -1298,7 +1279,6 @@ class APIKeys(BaseSDK):
|
|
|
1298
1279
|
accept_header_value="application/json",
|
|
1299
1280
|
http_headers=http_headers,
|
|
1300
1281
|
security=self.sdk_configuration.security,
|
|
1301
|
-
allow_empty_value=None,
|
|
1302
1282
|
timeout_ms=timeout_ms,
|
|
1303
1283
|
)
|
|
1304
1284
|
|
openrouter/basesdk.py
CHANGED
|
@@ -60,7 +60,6 @@ class BaseSDK:
|
|
|
60
60
|
] = None,
|
|
61
61
|
url_override: Optional[str] = None,
|
|
62
62
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
63
|
-
allow_empty_value: Optional[List[str]] = None,
|
|
64
63
|
) -> httpx.Request:
|
|
65
64
|
client = self.sdk_configuration.async_client
|
|
66
65
|
return self._build_request_with_client(
|
|
@@ -81,7 +80,6 @@ class BaseSDK:
|
|
|
81
80
|
get_serialized_body,
|
|
82
81
|
url_override,
|
|
83
82
|
http_headers,
|
|
84
|
-
allow_empty_value,
|
|
85
83
|
)
|
|
86
84
|
|
|
87
85
|
def _build_request(
|
|
@@ -104,7 +102,6 @@ class BaseSDK:
|
|
|
104
102
|
] = None,
|
|
105
103
|
url_override: Optional[str] = None,
|
|
106
104
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
107
|
-
allow_empty_value: Optional[List[str]] = None,
|
|
108
105
|
) -> httpx.Request:
|
|
109
106
|
client = self.sdk_configuration.client
|
|
110
107
|
return self._build_request_with_client(
|
|
@@ -125,7 +122,6 @@ class BaseSDK:
|
|
|
125
122
|
get_serialized_body,
|
|
126
123
|
url_override,
|
|
127
124
|
http_headers,
|
|
128
|
-
allow_empty_value,
|
|
129
125
|
)
|
|
130
126
|
|
|
131
127
|
def _build_request_with_client(
|
|
@@ -149,7 +145,6 @@ class BaseSDK:
|
|
|
149
145
|
] = None,
|
|
150
146
|
url_override: Optional[str] = None,
|
|
151
147
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
152
|
-
allow_empty_value: Optional[List[str]] = None,
|
|
153
148
|
) -> httpx.Request:
|
|
154
149
|
query_params = {}
|
|
155
150
|
|
|
@@ -165,7 +160,6 @@ class BaseSDK:
|
|
|
165
160
|
query_params = utils.get_query_params(
|
|
166
161
|
request if request_has_query_params else None,
|
|
167
162
|
_globals if request_has_query_params else None,
|
|
168
|
-
allow_empty_value,
|
|
169
163
|
)
|
|
170
164
|
else:
|
|
171
165
|
# Pick up the query parameter from the override so they can be
|
openrouter/chat.py
CHANGED
|
@@ -21,21 +21,6 @@ class Chat(BaseSDK):
|
|
|
21
21
|
self,
|
|
22
22
|
*,
|
|
23
23
|
messages: Union[List[components.Message], List[components.MessageTypedDict]],
|
|
24
|
-
provider: OptionalNullable[
|
|
25
|
-
Union[
|
|
26
|
-
components.ChatGenerationParamsProvider,
|
|
27
|
-
components.ChatGenerationParamsProviderTypedDict,
|
|
28
|
-
]
|
|
29
|
-
] = UNSET,
|
|
30
|
-
plugins: Optional[
|
|
31
|
-
Union[
|
|
32
|
-
List[components.ChatGenerationParamsPluginUnion],
|
|
33
|
-
List[components.ChatGenerationParamsPluginUnionTypedDict],
|
|
34
|
-
]
|
|
35
|
-
] = None,
|
|
36
|
-
route: OptionalNullable[components.Route] = UNSET,
|
|
37
|
-
user: Optional[str] = None,
|
|
38
|
-
session_id: Optional[str] = None,
|
|
39
24
|
model: Optional[str] = None,
|
|
40
25
|
models: Optional[List[str]] = None,
|
|
41
26
|
frequency_penalty: OptionalNullable[float] = UNSET,
|
|
@@ -75,14 +60,7 @@ class Chat(BaseSDK):
|
|
|
75
60
|
]
|
|
76
61
|
] = None,
|
|
77
62
|
top_p: OptionalNullable[float] = UNSET,
|
|
78
|
-
|
|
79
|
-
image_config: Optional[
|
|
80
|
-
Union[
|
|
81
|
-
Dict[str, components.ChatGenerationParamsImageConfig],
|
|
82
|
-
Dict[str, components.ChatGenerationParamsImageConfigTypedDict],
|
|
83
|
-
]
|
|
84
|
-
] = None,
|
|
85
|
-
modalities: Optional[List[components.Modality]] = None,
|
|
63
|
+
user: Optional[str] = None,
|
|
86
64
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
87
65
|
server_url: Optional[str] = None,
|
|
88
66
|
timeout_ms: Optional[int] = None,
|
|
@@ -93,11 +71,6 @@ class Chat(BaseSDK):
|
|
|
93
71
|
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
|
94
72
|
|
|
95
73
|
:param messages:
|
|
96
|
-
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
|
97
|
-
:param plugins: Plugins you want to enable for this request, including their settings.
|
|
98
|
-
:param route:
|
|
99
|
-
:param user:
|
|
100
|
-
: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.
|
|
101
74
|
:param model:
|
|
102
75
|
:param models:
|
|
103
76
|
:param frequency_penalty:
|
|
@@ -118,9 +91,7 @@ class Chat(BaseSDK):
|
|
|
118
91
|
:param tool_choice:
|
|
119
92
|
:param tools:
|
|
120
93
|
:param top_p:
|
|
121
|
-
:param
|
|
122
|
-
:param image_config:
|
|
123
|
-
:param modalities:
|
|
94
|
+
:param user:
|
|
124
95
|
:param retries: Override the default retry configuration for this method
|
|
125
96
|
:param server_url: Override the default server URL for this method
|
|
126
97
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -133,21 +104,6 @@ class Chat(BaseSDK):
|
|
|
133
104
|
self,
|
|
134
105
|
*,
|
|
135
106
|
messages: Union[List[components.Message], List[components.MessageTypedDict]],
|
|
136
|
-
provider: OptionalNullable[
|
|
137
|
-
Union[
|
|
138
|
-
components.ChatGenerationParamsProvider,
|
|
139
|
-
components.ChatGenerationParamsProviderTypedDict,
|
|
140
|
-
]
|
|
141
|
-
] = UNSET,
|
|
142
|
-
plugins: Optional[
|
|
143
|
-
Union[
|
|
144
|
-
List[components.ChatGenerationParamsPluginUnion],
|
|
145
|
-
List[components.ChatGenerationParamsPluginUnionTypedDict],
|
|
146
|
-
]
|
|
147
|
-
] = None,
|
|
148
|
-
route: OptionalNullable[components.Route] = UNSET,
|
|
149
|
-
user: Optional[str] = None,
|
|
150
|
-
session_id: Optional[str] = None,
|
|
151
107
|
model: Optional[str] = None,
|
|
152
108
|
models: Optional[List[str]] = None,
|
|
153
109
|
frequency_penalty: OptionalNullable[float] = UNSET,
|
|
@@ -187,14 +143,7 @@ class Chat(BaseSDK):
|
|
|
187
143
|
]
|
|
188
144
|
] = None,
|
|
189
145
|
top_p: OptionalNullable[float] = UNSET,
|
|
190
|
-
|
|
191
|
-
image_config: Optional[
|
|
192
|
-
Union[
|
|
193
|
-
Dict[str, components.ChatGenerationParamsImageConfig],
|
|
194
|
-
Dict[str, components.ChatGenerationParamsImageConfigTypedDict],
|
|
195
|
-
]
|
|
196
|
-
] = None,
|
|
197
|
-
modalities: Optional[List[components.Modality]] = None,
|
|
146
|
+
user: Optional[str] = None,
|
|
198
147
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
199
148
|
server_url: Optional[str] = None,
|
|
200
149
|
timeout_ms: Optional[int] = None,
|
|
@@ -205,11 +154,6 @@ class Chat(BaseSDK):
|
|
|
205
154
|
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
|
206
155
|
|
|
207
156
|
:param messages:
|
|
208
|
-
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
|
209
|
-
:param plugins: Plugins you want to enable for this request, including their settings.
|
|
210
|
-
:param route:
|
|
211
|
-
:param user:
|
|
212
|
-
: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.
|
|
213
157
|
:param model:
|
|
214
158
|
:param models:
|
|
215
159
|
:param frequency_penalty:
|
|
@@ -230,9 +174,7 @@ class Chat(BaseSDK):
|
|
|
230
174
|
:param tool_choice:
|
|
231
175
|
:param tools:
|
|
232
176
|
:param top_p:
|
|
233
|
-
:param
|
|
234
|
-
:param image_config:
|
|
235
|
-
:param modalities:
|
|
177
|
+
:param user:
|
|
236
178
|
:param retries: Override the default retry configuration for this method
|
|
237
179
|
:param server_url: Override the default server URL for this method
|
|
238
180
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -244,21 +186,6 @@ class Chat(BaseSDK):
|
|
|
244
186
|
self,
|
|
245
187
|
*,
|
|
246
188
|
messages: Union[List[components.Message], List[components.MessageTypedDict]],
|
|
247
|
-
provider: OptionalNullable[
|
|
248
|
-
Union[
|
|
249
|
-
components.ChatGenerationParamsProvider,
|
|
250
|
-
components.ChatGenerationParamsProviderTypedDict,
|
|
251
|
-
]
|
|
252
|
-
] = UNSET,
|
|
253
|
-
plugins: Optional[
|
|
254
|
-
Union[
|
|
255
|
-
List[components.ChatGenerationParamsPluginUnion],
|
|
256
|
-
List[components.ChatGenerationParamsPluginUnionTypedDict],
|
|
257
|
-
]
|
|
258
|
-
] = None,
|
|
259
|
-
route: OptionalNullable[components.Route] = UNSET,
|
|
260
|
-
user: Optional[str] = None,
|
|
261
|
-
session_id: Optional[str] = None,
|
|
262
189
|
model: Optional[str] = None,
|
|
263
190
|
models: Optional[List[str]] = None,
|
|
264
191
|
frequency_penalty: OptionalNullable[float] = UNSET,
|
|
@@ -298,14 +225,7 @@ class Chat(BaseSDK):
|
|
|
298
225
|
]
|
|
299
226
|
] = None,
|
|
300
227
|
top_p: OptionalNullable[float] = UNSET,
|
|
301
|
-
|
|
302
|
-
image_config: Optional[
|
|
303
|
-
Union[
|
|
304
|
-
Dict[str, components.ChatGenerationParamsImageConfig],
|
|
305
|
-
Dict[str, components.ChatGenerationParamsImageConfigTypedDict],
|
|
306
|
-
]
|
|
307
|
-
] = None,
|
|
308
|
-
modalities: Optional[List[components.Modality]] = None,
|
|
228
|
+
user: Optional[str] = None,
|
|
309
229
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
310
230
|
server_url: Optional[str] = None,
|
|
311
231
|
timeout_ms: Optional[int] = None,
|
|
@@ -316,11 +236,6 @@ class Chat(BaseSDK):
|
|
|
316
236
|
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
|
317
237
|
|
|
318
238
|
:param messages:
|
|
319
|
-
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
|
320
|
-
:param plugins: Plugins you want to enable for this request, including their settings.
|
|
321
|
-
:param route:
|
|
322
|
-
:param user:
|
|
323
|
-
: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.
|
|
324
239
|
:param model:
|
|
325
240
|
:param models:
|
|
326
241
|
:param frequency_penalty:
|
|
@@ -341,9 +256,7 @@ class Chat(BaseSDK):
|
|
|
341
256
|
:param tool_choice:
|
|
342
257
|
:param tools:
|
|
343
258
|
:param top_p:
|
|
344
|
-
:param
|
|
345
|
-
:param image_config:
|
|
346
|
-
:param modalities:
|
|
259
|
+
:param user:
|
|
347
260
|
:param retries: Override the default retry configuration for this method
|
|
348
261
|
:param server_url: Override the default server URL for this method
|
|
349
262
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -361,15 +274,6 @@ class Chat(BaseSDK):
|
|
|
361
274
|
base_url = self._get_url(base_url, url_variables)
|
|
362
275
|
|
|
363
276
|
request = components.ChatGenerationParams(
|
|
364
|
-
provider=utils.get_pydantic_model(
|
|
365
|
-
provider, OptionalNullable[components.ChatGenerationParamsProvider]
|
|
366
|
-
),
|
|
367
|
-
plugins=utils.get_pydantic_model(
|
|
368
|
-
plugins, Optional[List[components.ChatGenerationParamsPluginUnion]]
|
|
369
|
-
),
|
|
370
|
-
route=route,
|
|
371
|
-
user=user,
|
|
372
|
-
session_id=session_id,
|
|
373
277
|
messages=utils.get_pydantic_model(messages, List[components.Message]),
|
|
374
278
|
model=model,
|
|
375
279
|
models=models,
|
|
@@ -400,9 +304,7 @@ class Chat(BaseSDK):
|
|
|
400
304
|
tools, Optional[List[components.ToolDefinitionJSON]]
|
|
401
305
|
),
|
|
402
306
|
top_p=top_p,
|
|
403
|
-
|
|
404
|
-
image_config=image_config,
|
|
405
|
-
modalities=modalities,
|
|
307
|
+
user=user,
|
|
406
308
|
)
|
|
407
309
|
|
|
408
310
|
req = self._build_request(
|
|
@@ -421,7 +323,6 @@ class Chat(BaseSDK):
|
|
|
421
323
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
422
324
|
request, False, False, "json", components.ChatGenerationParams
|
|
423
325
|
),
|
|
424
|
-
allow_empty_value=None,
|
|
425
326
|
timeout_ms=timeout_ms,
|
|
426
327
|
)
|
|
427
328
|
|
|
@@ -497,21 +398,6 @@ class Chat(BaseSDK):
|
|
|
497
398
|
self,
|
|
498
399
|
*,
|
|
499
400
|
messages: Union[List[components.Message], List[components.MessageTypedDict]],
|
|
500
|
-
provider: OptionalNullable[
|
|
501
|
-
Union[
|
|
502
|
-
components.ChatGenerationParamsProvider,
|
|
503
|
-
components.ChatGenerationParamsProviderTypedDict,
|
|
504
|
-
]
|
|
505
|
-
] = UNSET,
|
|
506
|
-
plugins: Optional[
|
|
507
|
-
Union[
|
|
508
|
-
List[components.ChatGenerationParamsPluginUnion],
|
|
509
|
-
List[components.ChatGenerationParamsPluginUnionTypedDict],
|
|
510
|
-
]
|
|
511
|
-
] = None,
|
|
512
|
-
route: OptionalNullable[components.Route] = UNSET,
|
|
513
|
-
user: Optional[str] = None,
|
|
514
|
-
session_id: Optional[str] = None,
|
|
515
401
|
model: Optional[str] = None,
|
|
516
402
|
models: Optional[List[str]] = None,
|
|
517
403
|
frequency_penalty: OptionalNullable[float] = UNSET,
|
|
@@ -551,14 +437,7 @@ class Chat(BaseSDK):
|
|
|
551
437
|
]
|
|
552
438
|
] = None,
|
|
553
439
|
top_p: OptionalNullable[float] = UNSET,
|
|
554
|
-
|
|
555
|
-
image_config: Optional[
|
|
556
|
-
Union[
|
|
557
|
-
Dict[str, components.ChatGenerationParamsImageConfig],
|
|
558
|
-
Dict[str, components.ChatGenerationParamsImageConfigTypedDict],
|
|
559
|
-
]
|
|
560
|
-
] = None,
|
|
561
|
-
modalities: Optional[List[components.Modality]] = None,
|
|
440
|
+
user: Optional[str] = None,
|
|
562
441
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
563
442
|
server_url: Optional[str] = None,
|
|
564
443
|
timeout_ms: Optional[int] = None,
|
|
@@ -569,11 +448,6 @@ class Chat(BaseSDK):
|
|
|
569
448
|
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
|
570
449
|
|
|
571
450
|
:param messages:
|
|
572
|
-
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
|
573
|
-
:param plugins: Plugins you want to enable for this request, including their settings.
|
|
574
|
-
:param route:
|
|
575
|
-
:param user:
|
|
576
|
-
: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.
|
|
577
451
|
:param model:
|
|
578
452
|
:param models:
|
|
579
453
|
:param frequency_penalty:
|
|
@@ -594,9 +468,7 @@ class Chat(BaseSDK):
|
|
|
594
468
|
:param tool_choice:
|
|
595
469
|
:param tools:
|
|
596
470
|
:param top_p:
|
|
597
|
-
:param
|
|
598
|
-
:param image_config:
|
|
599
|
-
:param modalities:
|
|
471
|
+
:param user:
|
|
600
472
|
:param retries: Override the default retry configuration for this method
|
|
601
473
|
:param server_url: Override the default server URL for this method
|
|
602
474
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -609,21 +481,6 @@ class Chat(BaseSDK):
|
|
|
609
481
|
self,
|
|
610
482
|
*,
|
|
611
483
|
messages: Union[List[components.Message], List[components.MessageTypedDict]],
|
|
612
|
-
provider: OptionalNullable[
|
|
613
|
-
Union[
|
|
614
|
-
components.ChatGenerationParamsProvider,
|
|
615
|
-
components.ChatGenerationParamsProviderTypedDict,
|
|
616
|
-
]
|
|
617
|
-
] = UNSET,
|
|
618
|
-
plugins: Optional[
|
|
619
|
-
Union[
|
|
620
|
-
List[components.ChatGenerationParamsPluginUnion],
|
|
621
|
-
List[components.ChatGenerationParamsPluginUnionTypedDict],
|
|
622
|
-
]
|
|
623
|
-
] = None,
|
|
624
|
-
route: OptionalNullable[components.Route] = UNSET,
|
|
625
|
-
user: Optional[str] = None,
|
|
626
|
-
session_id: Optional[str] = None,
|
|
627
484
|
model: Optional[str] = None,
|
|
628
485
|
models: Optional[List[str]] = None,
|
|
629
486
|
frequency_penalty: OptionalNullable[float] = UNSET,
|
|
@@ -663,14 +520,7 @@ class Chat(BaseSDK):
|
|
|
663
520
|
]
|
|
664
521
|
] = None,
|
|
665
522
|
top_p: OptionalNullable[float] = UNSET,
|
|
666
|
-
|
|
667
|
-
image_config: Optional[
|
|
668
|
-
Union[
|
|
669
|
-
Dict[str, components.ChatGenerationParamsImageConfig],
|
|
670
|
-
Dict[str, components.ChatGenerationParamsImageConfigTypedDict],
|
|
671
|
-
]
|
|
672
|
-
] = None,
|
|
673
|
-
modalities: Optional[List[components.Modality]] = None,
|
|
523
|
+
user: Optional[str] = None,
|
|
674
524
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
675
525
|
server_url: Optional[str] = None,
|
|
676
526
|
timeout_ms: Optional[int] = None,
|
|
@@ -681,11 +531,6 @@ class Chat(BaseSDK):
|
|
|
681
531
|
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
|
682
532
|
|
|
683
533
|
:param messages:
|
|
684
|
-
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
|
685
|
-
:param plugins: Plugins you want to enable for this request, including their settings.
|
|
686
|
-
:param route:
|
|
687
|
-
:param user:
|
|
688
|
-
: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.
|
|
689
534
|
:param model:
|
|
690
535
|
:param models:
|
|
691
536
|
:param frequency_penalty:
|
|
@@ -706,9 +551,7 @@ class Chat(BaseSDK):
|
|
|
706
551
|
:param tool_choice:
|
|
707
552
|
:param tools:
|
|
708
553
|
:param top_p:
|
|
709
|
-
:param
|
|
710
|
-
:param image_config:
|
|
711
|
-
:param modalities:
|
|
554
|
+
:param user:
|
|
712
555
|
:param retries: Override the default retry configuration for this method
|
|
713
556
|
:param server_url: Override the default server URL for this method
|
|
714
557
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -720,21 +563,6 @@ class Chat(BaseSDK):
|
|
|
720
563
|
self,
|
|
721
564
|
*,
|
|
722
565
|
messages: Union[List[components.Message], List[components.MessageTypedDict]],
|
|
723
|
-
provider: OptionalNullable[
|
|
724
|
-
Union[
|
|
725
|
-
components.ChatGenerationParamsProvider,
|
|
726
|
-
components.ChatGenerationParamsProviderTypedDict,
|
|
727
|
-
]
|
|
728
|
-
] = UNSET,
|
|
729
|
-
plugins: Optional[
|
|
730
|
-
Union[
|
|
731
|
-
List[components.ChatGenerationParamsPluginUnion],
|
|
732
|
-
List[components.ChatGenerationParamsPluginUnionTypedDict],
|
|
733
|
-
]
|
|
734
|
-
] = None,
|
|
735
|
-
route: OptionalNullable[components.Route] = UNSET,
|
|
736
|
-
user: Optional[str] = None,
|
|
737
|
-
session_id: Optional[str] = None,
|
|
738
566
|
model: Optional[str] = None,
|
|
739
567
|
models: Optional[List[str]] = None,
|
|
740
568
|
frequency_penalty: OptionalNullable[float] = UNSET,
|
|
@@ -774,14 +602,7 @@ class Chat(BaseSDK):
|
|
|
774
602
|
]
|
|
775
603
|
] = None,
|
|
776
604
|
top_p: OptionalNullable[float] = UNSET,
|
|
777
|
-
|
|
778
|
-
image_config: Optional[
|
|
779
|
-
Union[
|
|
780
|
-
Dict[str, components.ChatGenerationParamsImageConfig],
|
|
781
|
-
Dict[str, components.ChatGenerationParamsImageConfigTypedDict],
|
|
782
|
-
]
|
|
783
|
-
] = None,
|
|
784
|
-
modalities: Optional[List[components.Modality]] = None,
|
|
605
|
+
user: Optional[str] = None,
|
|
785
606
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
786
607
|
server_url: Optional[str] = None,
|
|
787
608
|
timeout_ms: Optional[int] = None,
|
|
@@ -792,11 +613,6 @@ class Chat(BaseSDK):
|
|
|
792
613
|
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
|
793
614
|
|
|
794
615
|
:param messages:
|
|
795
|
-
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
|
796
|
-
:param plugins: Plugins you want to enable for this request, including their settings.
|
|
797
|
-
:param route:
|
|
798
|
-
:param user:
|
|
799
|
-
: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.
|
|
800
616
|
:param model:
|
|
801
617
|
:param models:
|
|
802
618
|
:param frequency_penalty:
|
|
@@ -817,9 +633,7 @@ class Chat(BaseSDK):
|
|
|
817
633
|
:param tool_choice:
|
|
818
634
|
:param tools:
|
|
819
635
|
:param top_p:
|
|
820
|
-
:param
|
|
821
|
-
:param image_config:
|
|
822
|
-
:param modalities:
|
|
636
|
+
:param user:
|
|
823
637
|
:param retries: Override the default retry configuration for this method
|
|
824
638
|
:param server_url: Override the default server URL for this method
|
|
825
639
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -837,15 +651,6 @@ class Chat(BaseSDK):
|
|
|
837
651
|
base_url = self._get_url(base_url, url_variables)
|
|
838
652
|
|
|
839
653
|
request = components.ChatGenerationParams(
|
|
840
|
-
provider=utils.get_pydantic_model(
|
|
841
|
-
provider, OptionalNullable[components.ChatGenerationParamsProvider]
|
|
842
|
-
),
|
|
843
|
-
plugins=utils.get_pydantic_model(
|
|
844
|
-
plugins, Optional[List[components.ChatGenerationParamsPluginUnion]]
|
|
845
|
-
),
|
|
846
|
-
route=route,
|
|
847
|
-
user=user,
|
|
848
|
-
session_id=session_id,
|
|
849
654
|
messages=utils.get_pydantic_model(messages, List[components.Message]),
|
|
850
655
|
model=model,
|
|
851
656
|
models=models,
|
|
@@ -876,9 +681,7 @@ class Chat(BaseSDK):
|
|
|
876
681
|
tools, Optional[List[components.ToolDefinitionJSON]]
|
|
877
682
|
),
|
|
878
683
|
top_p=top_p,
|
|
879
|
-
|
|
880
|
-
image_config=image_config,
|
|
881
|
-
modalities=modalities,
|
|
684
|
+
user=user,
|
|
882
685
|
)
|
|
883
686
|
|
|
884
687
|
req = self._build_request_async(
|
|
@@ -897,7 +700,6 @@ class Chat(BaseSDK):
|
|
|
897
700
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
898
701
|
request, False, False, "json", components.ChatGenerationParams
|
|
899
702
|
),
|
|
900
|
-
allow_empty_value=None,
|
|
901
703
|
timeout_ms=timeout_ms,
|
|
902
704
|
)
|
|
903
705
|
|
openrouter/completions.py
CHANGED
|
@@ -136,7 +136,6 @@ class Completions(BaseSDK):
|
|
|
136
136
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
137
137
|
request, False, False, "json", components.CompletionCreateParams
|
|
138
138
|
),
|
|
139
|
-
allow_empty_value=None,
|
|
140
139
|
timeout_ms=timeout_ms,
|
|
141
140
|
)
|
|
142
141
|
|
|
@@ -311,7 +310,6 @@ class Completions(BaseSDK):
|
|
|
311
310
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
312
311
|
request, False, False, "json", components.CompletionCreateParams
|
|
313
312
|
),
|
|
314
|
-
allow_empty_value=None,
|
|
315
313
|
timeout_ms=timeout_ms,
|
|
316
314
|
)
|
|
317
315
|
|