openrouter 0.1.2__py3-none-any.whl → 0.6.0__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 +2 -2
- openrouter/analytics.py +28 -2
- openrouter/api_keys.py +210 -14
- openrouter/chat.py +192 -200
- openrouter/components/__init__.py +229 -285
- openrouter/components/_schema10.py +39 -0
- openrouter/components/_schema14.py +11 -0
- openrouter/components/_schema17.py +154 -0
- openrouter/components/{_schema3.py → _schema19.py} +28 -22
- openrouter/components/{_schema0.py → _schema5.py} +7 -5
- openrouter/components/assistantmessage.py +32 -1
- openrouter/components/chatgenerationparams.py +57 -343
- openrouter/components/chatmessagecontentitemimage.py +4 -4
- openrouter/components/chatresponsechoice.py +1 -6
- openrouter/components/chatstreamingmessagechunk.py +3 -3
- openrouter/components/developermessage.py +41 -0
- openrouter/components/message.py +6 -39
- openrouter/components/model.py +7 -1
- openrouter/components/openresponsesrequest.py +31 -39
- openrouter/components/outputmodality.py +1 -0
- openrouter/components/providername.py +2 -0
- openrouter/components/providerpreferences.py +2 -10
- openrouter/components/publicendpoint.py +8 -24
- openrouter/components/publicpricing.py +3 -24
- openrouter/credits.py +86 -14
- openrouter/embeddings.py +92 -20
- openrouter/endpoints.py +62 -2
- openrouter/generations.py +26 -0
- openrouter/guardrails.py +3367 -0
- openrouter/models_.py +120 -12
- openrouter/oauth.py +90 -22
- openrouter/operations/__init__.py +601 -30
- openrouter/operations/bulkassignkeystoguardrail.py +116 -0
- openrouter/operations/bulkassignmemberstoguardrail.py +116 -0
- openrouter/operations/bulkunassignkeysfromguardrail.py +116 -0
- openrouter/operations/bulkunassignmembersfromguardrail.py +116 -0
- openrouter/operations/createauthkeyscode.py +81 -3
- openrouter/operations/createcoinbasecharge.py +82 -2
- openrouter/operations/createembeddings.py +82 -3
- openrouter/operations/createguardrail.py +325 -0
- openrouter/operations/createkeys.py +81 -3
- openrouter/operations/createresponses.py +84 -3
- openrouter/operations/deleteguardrail.py +104 -0
- openrouter/operations/deletekeys.py +69 -3
- openrouter/operations/exchangeauthcodeforapikey.py +81 -3
- openrouter/operations/getcredits.py +70 -1
- openrouter/operations/getcurrentkey.py +81 -3
- openrouter/operations/getgeneration.py +248 -3
- openrouter/operations/getguardrail.py +228 -0
- openrouter/operations/getkey.py +64 -1
- openrouter/operations/getmodels.py +95 -5
- openrouter/operations/getuseractivity.py +62 -1
- openrouter/operations/list.py +63 -1
- openrouter/operations/listembeddingsmodels.py +74 -0
- openrouter/operations/listendpoints.py +65 -2
- openrouter/operations/listendpointszdr.py +70 -2
- openrouter/operations/listguardrailkeyassignments.py +192 -0
- openrouter/operations/listguardrailmemberassignments.py +187 -0
- openrouter/operations/listguardrails.py +238 -0
- openrouter/operations/listkeyassignments.py +180 -0
- openrouter/operations/listmemberassignments.py +175 -0
- openrouter/operations/listmodelscount.py +74 -0
- openrouter/operations/listmodelsuser.py +70 -2
- openrouter/operations/listproviders.py +70 -2
- openrouter/operations/sendchatcompletionrequest.py +87 -3
- openrouter/operations/updateguardrail.py +334 -0
- openrouter/operations/updatekeys.py +63 -0
- openrouter/providers.py +36 -2
- openrouter/responses.py +178 -148
- openrouter/sdk.py +5 -8
- openrouter/types/models.py +378 -0
- {openrouter-0.1.2.dist-info → openrouter-0.6.0.dist-info}/METADATA +5 -1
- {openrouter-0.1.2.dist-info → openrouter-0.6.0.dist-info}/RECORD +76 -63
- {openrouter-0.1.2.dist-info → openrouter-0.6.0.dist-info}/WHEEL +1 -1
- openrouter/completions.py +0 -361
- openrouter/components/completionchoice.py +0 -82
- openrouter/components/completioncreateparams.py +0 -277
- openrouter/components/completionlogprobs.py +0 -54
- openrouter/components/completionresponse.py +0 -46
- openrouter/components/completionusage.py +0 -19
- openrouter/operations/getparameters.py +0 -123
- openrouter/parameters.py +0 -237
- {openrouter-0.1.2.dist-info → openrouter-0.6.0.dist-info}/licenses/LICENSE +0 -0
- {openrouter-0.1.2.dist-info → openrouter-0.6.0.dist-info}/top_level.txt +0 -0
openrouter/credits.py
CHANGED
|
@@ -15,6 +15,8 @@ class Credits(BaseSDK):
|
|
|
15
15
|
def get_credits(
|
|
16
16
|
self,
|
|
17
17
|
*,
|
|
18
|
+
http_referer: Optional[str] = None,
|
|
19
|
+
x_title: Optional[str] = None,
|
|
18
20
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
19
21
|
server_url: Optional[str] = None,
|
|
20
22
|
timeout_ms: Optional[int] = None,
|
|
@@ -22,7 +24,12 @@ class Credits(BaseSDK):
|
|
|
22
24
|
) -> operations.GetCreditsResponse:
|
|
23
25
|
r"""Get remaining credits
|
|
24
26
|
|
|
25
|
-
Get total credits purchased and used for the authenticated user
|
|
27
|
+
Get total credits purchased and used for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
28
|
+
|
|
29
|
+
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
30
|
+
This is used to track API usage per application.
|
|
31
|
+
|
|
32
|
+
:param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
26
33
|
|
|
27
34
|
:param retries: Override the default retry configuration for this method
|
|
28
35
|
:param server_url: Override the default server URL for this method
|
|
@@ -38,18 +45,28 @@ class Credits(BaseSDK):
|
|
|
38
45
|
base_url = server_url
|
|
39
46
|
else:
|
|
40
47
|
base_url = self._get_url(base_url, url_variables)
|
|
48
|
+
|
|
49
|
+
request = operations.GetCreditsRequest(
|
|
50
|
+
http_referer=http_referer,
|
|
51
|
+
x_title=x_title,
|
|
52
|
+
)
|
|
53
|
+
|
|
41
54
|
req = self._build_request(
|
|
42
55
|
method="GET",
|
|
43
56
|
path="/credits",
|
|
44
57
|
base_url=base_url,
|
|
45
58
|
url_variables=url_variables,
|
|
46
|
-
request=
|
|
59
|
+
request=request,
|
|
47
60
|
request_body_required=False,
|
|
48
61
|
request_has_path_params=False,
|
|
49
62
|
request_has_query_params=True,
|
|
50
63
|
user_agent_header="user-agent",
|
|
51
64
|
accept_header_value="application/json",
|
|
52
65
|
http_headers=http_headers,
|
|
66
|
+
_globals=operations.GetCreditsGlobals(
|
|
67
|
+
http_referer=self.sdk_configuration.globals.http_referer,
|
|
68
|
+
x_title=self.sdk_configuration.globals.x_title,
|
|
69
|
+
),
|
|
53
70
|
security=self.sdk_configuration.security,
|
|
54
71
|
allow_empty_value=None,
|
|
55
72
|
timeout_ms=timeout_ms,
|
|
@@ -112,6 +129,8 @@ class Credits(BaseSDK):
|
|
|
112
129
|
async def get_credits_async(
|
|
113
130
|
self,
|
|
114
131
|
*,
|
|
132
|
+
http_referer: Optional[str] = None,
|
|
133
|
+
x_title: Optional[str] = None,
|
|
115
134
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
116
135
|
server_url: Optional[str] = None,
|
|
117
136
|
timeout_ms: Optional[int] = None,
|
|
@@ -119,7 +138,12 @@ class Credits(BaseSDK):
|
|
|
119
138
|
) -> operations.GetCreditsResponse:
|
|
120
139
|
r"""Get remaining credits
|
|
121
140
|
|
|
122
|
-
Get total credits purchased and used for the authenticated user
|
|
141
|
+
Get total credits purchased and used for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
142
|
+
|
|
143
|
+
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
144
|
+
This is used to track API usage per application.
|
|
145
|
+
|
|
146
|
+
:param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
123
147
|
|
|
124
148
|
:param retries: Override the default retry configuration for this method
|
|
125
149
|
:param server_url: Override the default server URL for this method
|
|
@@ -135,18 +159,28 @@ class Credits(BaseSDK):
|
|
|
135
159
|
base_url = server_url
|
|
136
160
|
else:
|
|
137
161
|
base_url = self._get_url(base_url, url_variables)
|
|
162
|
+
|
|
163
|
+
request = operations.GetCreditsRequest(
|
|
164
|
+
http_referer=http_referer,
|
|
165
|
+
x_title=x_title,
|
|
166
|
+
)
|
|
167
|
+
|
|
138
168
|
req = self._build_request_async(
|
|
139
169
|
method="GET",
|
|
140
170
|
path="/credits",
|
|
141
171
|
base_url=base_url,
|
|
142
172
|
url_variables=url_variables,
|
|
143
|
-
request=
|
|
173
|
+
request=request,
|
|
144
174
|
request_body_required=False,
|
|
145
175
|
request_has_path_params=False,
|
|
146
176
|
request_has_query_params=True,
|
|
147
177
|
user_agent_header="user-agent",
|
|
148
178
|
accept_header_value="application/json",
|
|
149
179
|
http_headers=http_headers,
|
|
180
|
+
_globals=operations.GetCreditsGlobals(
|
|
181
|
+
http_referer=self.sdk_configuration.globals.http_referer,
|
|
182
|
+
x_title=self.sdk_configuration.globals.x_title,
|
|
183
|
+
),
|
|
150
184
|
security=self.sdk_configuration.security,
|
|
151
185
|
allow_empty_value=None,
|
|
152
186
|
timeout_ms=timeout_ms,
|
|
@@ -216,6 +250,8 @@ class Credits(BaseSDK):
|
|
|
216
250
|
amount: float,
|
|
217
251
|
sender: str,
|
|
218
252
|
chain_id: components.ChainID,
|
|
253
|
+
http_referer: Optional[str] = None,
|
|
254
|
+
x_title: Optional[str] = None,
|
|
219
255
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
220
256
|
server_url: Optional[str] = None,
|
|
221
257
|
timeout_ms: Optional[int] = None,
|
|
@@ -229,6 +265,11 @@ class Credits(BaseSDK):
|
|
|
229
265
|
:param amount:
|
|
230
266
|
:param sender:
|
|
231
267
|
:param chain_id:
|
|
268
|
+
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
269
|
+
This is used to track API usage per application.
|
|
270
|
+
|
|
271
|
+
:param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
272
|
+
|
|
232
273
|
:param retries: Override the default retry configuration for this method
|
|
233
274
|
:param server_url: Override the default server URL for this method
|
|
234
275
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -244,10 +285,14 @@ class Credits(BaseSDK):
|
|
|
244
285
|
else:
|
|
245
286
|
base_url = self._get_url(base_url, url_variables)
|
|
246
287
|
|
|
247
|
-
request =
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
288
|
+
request = operations.CreateCoinbaseChargeRequest(
|
|
289
|
+
http_referer=http_referer,
|
|
290
|
+
x_title=x_title,
|
|
291
|
+
create_charge_request=components.CreateChargeRequest(
|
|
292
|
+
amount=amount,
|
|
293
|
+
sender=sender,
|
|
294
|
+
chain_id=chain_id,
|
|
295
|
+
),
|
|
251
296
|
)
|
|
252
297
|
|
|
253
298
|
req = self._build_request(
|
|
@@ -262,11 +307,19 @@ class Credits(BaseSDK):
|
|
|
262
307
|
user_agent_header="user-agent",
|
|
263
308
|
accept_header_value="application/json",
|
|
264
309
|
http_headers=http_headers,
|
|
310
|
+
_globals=operations.CreateCoinbaseChargeGlobals(
|
|
311
|
+
http_referer=self.sdk_configuration.globals.http_referer,
|
|
312
|
+
x_title=self.sdk_configuration.globals.x_title,
|
|
313
|
+
),
|
|
265
314
|
security=utils.get_pydantic_model(
|
|
266
315
|
security, operations.CreateCoinbaseChargeSecurity
|
|
267
316
|
),
|
|
268
317
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
269
|
-
request,
|
|
318
|
+
request.create_charge_request,
|
|
319
|
+
False,
|
|
320
|
+
False,
|
|
321
|
+
"json",
|
|
322
|
+
components.CreateChargeRequest,
|
|
270
323
|
),
|
|
271
324
|
allow_empty_value=None,
|
|
272
325
|
timeout_ms=timeout_ms,
|
|
@@ -341,6 +394,8 @@ class Credits(BaseSDK):
|
|
|
341
394
|
amount: float,
|
|
342
395
|
sender: str,
|
|
343
396
|
chain_id: components.ChainID,
|
|
397
|
+
http_referer: Optional[str] = None,
|
|
398
|
+
x_title: Optional[str] = None,
|
|
344
399
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
345
400
|
server_url: Optional[str] = None,
|
|
346
401
|
timeout_ms: Optional[int] = None,
|
|
@@ -354,6 +409,11 @@ class Credits(BaseSDK):
|
|
|
354
409
|
:param amount:
|
|
355
410
|
:param sender:
|
|
356
411
|
:param chain_id:
|
|
412
|
+
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
413
|
+
This is used to track API usage per application.
|
|
414
|
+
|
|
415
|
+
:param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
416
|
+
|
|
357
417
|
:param retries: Override the default retry configuration for this method
|
|
358
418
|
:param server_url: Override the default server URL for this method
|
|
359
419
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -369,10 +429,14 @@ class Credits(BaseSDK):
|
|
|
369
429
|
else:
|
|
370
430
|
base_url = self._get_url(base_url, url_variables)
|
|
371
431
|
|
|
372
|
-
request =
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
432
|
+
request = operations.CreateCoinbaseChargeRequest(
|
|
433
|
+
http_referer=http_referer,
|
|
434
|
+
x_title=x_title,
|
|
435
|
+
create_charge_request=components.CreateChargeRequest(
|
|
436
|
+
amount=amount,
|
|
437
|
+
sender=sender,
|
|
438
|
+
chain_id=chain_id,
|
|
439
|
+
),
|
|
376
440
|
)
|
|
377
441
|
|
|
378
442
|
req = self._build_request_async(
|
|
@@ -387,11 +451,19 @@ class Credits(BaseSDK):
|
|
|
387
451
|
user_agent_header="user-agent",
|
|
388
452
|
accept_header_value="application/json",
|
|
389
453
|
http_headers=http_headers,
|
|
454
|
+
_globals=operations.CreateCoinbaseChargeGlobals(
|
|
455
|
+
http_referer=self.sdk_configuration.globals.http_referer,
|
|
456
|
+
x_title=self.sdk_configuration.globals.x_title,
|
|
457
|
+
),
|
|
390
458
|
security=utils.get_pydantic_model(
|
|
391
459
|
security, operations.CreateCoinbaseChargeSecurity
|
|
392
460
|
),
|
|
393
461
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
394
|
-
request,
|
|
462
|
+
request.create_charge_request,
|
|
463
|
+
False,
|
|
464
|
+
False,
|
|
465
|
+
"json",
|
|
466
|
+
components.CreateChargeRequest,
|
|
395
467
|
),
|
|
396
468
|
allow_empty_value=None,
|
|
397
469
|
timeout_ms=timeout_ms,
|
openrouter/embeddings.py
CHANGED
|
@@ -23,6 +23,8 @@ class Embeddings(BaseSDK):
|
|
|
23
23
|
*,
|
|
24
24
|
input: Union[operations.InputUnion, operations.InputUnionTypedDict],
|
|
25
25
|
model: str,
|
|
26
|
+
http_referer: Optional[str] = None,
|
|
27
|
+
x_title: Optional[str] = None,
|
|
26
28
|
encoding_format: Optional[operations.EncodingFormat] = None,
|
|
27
29
|
dimensions: Optional[int] = None,
|
|
28
30
|
user: Optional[str] = None,
|
|
@@ -44,6 +46,11 @@ class Embeddings(BaseSDK):
|
|
|
44
46
|
|
|
45
47
|
:param input:
|
|
46
48
|
:param model:
|
|
49
|
+
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
50
|
+
This is used to track API usage per application.
|
|
51
|
+
|
|
52
|
+
:param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
53
|
+
|
|
47
54
|
:param encoding_format:
|
|
48
55
|
:param dimensions:
|
|
49
56
|
:param user:
|
|
@@ -66,15 +73,19 @@ class Embeddings(BaseSDK):
|
|
|
66
73
|
base_url = self._get_url(base_url, url_variables)
|
|
67
74
|
|
|
68
75
|
request = operations.CreateEmbeddingsRequest(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
http_referer=http_referer,
|
|
77
|
+
x_title=x_title,
|
|
78
|
+
request_body=operations.CreateEmbeddingsRequestBody(
|
|
79
|
+
input=utils.get_pydantic_model(input, operations.InputUnion),
|
|
80
|
+
model=model,
|
|
81
|
+
encoding_format=encoding_format,
|
|
82
|
+
dimensions=dimensions,
|
|
83
|
+
user=user,
|
|
84
|
+
provider=utils.get_pydantic_model(
|
|
85
|
+
provider, Optional[components.ProviderPreferences]
|
|
86
|
+
),
|
|
87
|
+
input_type=input_type,
|
|
76
88
|
),
|
|
77
|
-
input_type=input_type,
|
|
78
89
|
)
|
|
79
90
|
|
|
80
91
|
req = self._build_request(
|
|
@@ -91,9 +102,17 @@ class Embeddings(BaseSDK):
|
|
|
91
102
|
if accept_header_override is not None
|
|
92
103
|
else "application/json;q=1, text/event-stream;q=0",
|
|
93
104
|
http_headers=http_headers,
|
|
105
|
+
_globals=operations.CreateEmbeddingsGlobals(
|
|
106
|
+
http_referer=self.sdk_configuration.globals.http_referer,
|
|
107
|
+
x_title=self.sdk_configuration.globals.x_title,
|
|
108
|
+
),
|
|
94
109
|
security=self.sdk_configuration.security,
|
|
95
110
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
96
|
-
request,
|
|
111
|
+
request.request_body,
|
|
112
|
+
False,
|
|
113
|
+
False,
|
|
114
|
+
"json",
|
|
115
|
+
operations.CreateEmbeddingsRequestBody,
|
|
97
116
|
),
|
|
98
117
|
allow_empty_value=None,
|
|
99
118
|
timeout_ms=timeout_ms,
|
|
@@ -210,6 +229,8 @@ class Embeddings(BaseSDK):
|
|
|
210
229
|
*,
|
|
211
230
|
input: Union[operations.InputUnion, operations.InputUnionTypedDict],
|
|
212
231
|
model: str,
|
|
232
|
+
http_referer: Optional[str] = None,
|
|
233
|
+
x_title: Optional[str] = None,
|
|
213
234
|
encoding_format: Optional[operations.EncodingFormat] = None,
|
|
214
235
|
dimensions: Optional[int] = None,
|
|
215
236
|
user: Optional[str] = None,
|
|
@@ -231,6 +252,11 @@ class Embeddings(BaseSDK):
|
|
|
231
252
|
|
|
232
253
|
:param input:
|
|
233
254
|
:param model:
|
|
255
|
+
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
256
|
+
This is used to track API usage per application.
|
|
257
|
+
|
|
258
|
+
:param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
259
|
+
|
|
234
260
|
:param encoding_format:
|
|
235
261
|
:param dimensions:
|
|
236
262
|
:param user:
|
|
@@ -253,15 +279,19 @@ class Embeddings(BaseSDK):
|
|
|
253
279
|
base_url = self._get_url(base_url, url_variables)
|
|
254
280
|
|
|
255
281
|
request = operations.CreateEmbeddingsRequest(
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
282
|
+
http_referer=http_referer,
|
|
283
|
+
x_title=x_title,
|
|
284
|
+
request_body=operations.CreateEmbeddingsRequestBody(
|
|
285
|
+
input=utils.get_pydantic_model(input, operations.InputUnion),
|
|
286
|
+
model=model,
|
|
287
|
+
encoding_format=encoding_format,
|
|
288
|
+
dimensions=dimensions,
|
|
289
|
+
user=user,
|
|
290
|
+
provider=utils.get_pydantic_model(
|
|
291
|
+
provider, Optional[components.ProviderPreferences]
|
|
292
|
+
),
|
|
293
|
+
input_type=input_type,
|
|
263
294
|
),
|
|
264
|
-
input_type=input_type,
|
|
265
295
|
)
|
|
266
296
|
|
|
267
297
|
req = self._build_request_async(
|
|
@@ -278,9 +308,17 @@ class Embeddings(BaseSDK):
|
|
|
278
308
|
if accept_header_override is not None
|
|
279
309
|
else "application/json;q=1, text/event-stream;q=0",
|
|
280
310
|
http_headers=http_headers,
|
|
311
|
+
_globals=operations.CreateEmbeddingsGlobals(
|
|
312
|
+
http_referer=self.sdk_configuration.globals.http_referer,
|
|
313
|
+
x_title=self.sdk_configuration.globals.x_title,
|
|
314
|
+
),
|
|
281
315
|
security=self.sdk_configuration.security,
|
|
282
316
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
283
|
-
request,
|
|
317
|
+
request.request_body,
|
|
318
|
+
False,
|
|
319
|
+
False,
|
|
320
|
+
"json",
|
|
321
|
+
operations.CreateEmbeddingsRequestBody,
|
|
284
322
|
),
|
|
285
323
|
allow_empty_value=None,
|
|
286
324
|
timeout_ms=timeout_ms,
|
|
@@ -395,6 +433,8 @@ class Embeddings(BaseSDK):
|
|
|
395
433
|
def list_models(
|
|
396
434
|
self,
|
|
397
435
|
*,
|
|
436
|
+
http_referer: Optional[str] = None,
|
|
437
|
+
x_title: Optional[str] = None,
|
|
398
438
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
399
439
|
server_url: Optional[str] = None,
|
|
400
440
|
timeout_ms: Optional[int] = None,
|
|
@@ -404,6 +444,11 @@ class Embeddings(BaseSDK):
|
|
|
404
444
|
|
|
405
445
|
Returns a list of all available embeddings models and their properties
|
|
406
446
|
|
|
447
|
+
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
448
|
+
This is used to track API usage per application.
|
|
449
|
+
|
|
450
|
+
:param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
451
|
+
|
|
407
452
|
:param retries: Override the default retry configuration for this method
|
|
408
453
|
:param server_url: Override the default server URL for this method
|
|
409
454
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -418,18 +463,28 @@ class Embeddings(BaseSDK):
|
|
|
418
463
|
base_url = server_url
|
|
419
464
|
else:
|
|
420
465
|
base_url = self._get_url(base_url, url_variables)
|
|
466
|
+
|
|
467
|
+
request = operations.ListEmbeddingsModelsRequest(
|
|
468
|
+
http_referer=http_referer,
|
|
469
|
+
x_title=x_title,
|
|
470
|
+
)
|
|
471
|
+
|
|
421
472
|
req = self._build_request(
|
|
422
473
|
method="GET",
|
|
423
474
|
path="/embeddings/models",
|
|
424
475
|
base_url=base_url,
|
|
425
476
|
url_variables=url_variables,
|
|
426
|
-
request=
|
|
477
|
+
request=request,
|
|
427
478
|
request_body_required=False,
|
|
428
479
|
request_has_path_params=False,
|
|
429
480
|
request_has_query_params=True,
|
|
430
481
|
user_agent_header="user-agent",
|
|
431
482
|
accept_header_value="application/json",
|
|
432
483
|
http_headers=http_headers,
|
|
484
|
+
_globals=operations.ListEmbeddingsModelsGlobals(
|
|
485
|
+
http_referer=self.sdk_configuration.globals.http_referer,
|
|
486
|
+
x_title=self.sdk_configuration.globals.x_title,
|
|
487
|
+
),
|
|
433
488
|
security=self.sdk_configuration.security,
|
|
434
489
|
allow_empty_value=None,
|
|
435
490
|
timeout_ms=timeout_ms,
|
|
@@ -487,6 +542,8 @@ class Embeddings(BaseSDK):
|
|
|
487
542
|
async def list_models_async(
|
|
488
543
|
self,
|
|
489
544
|
*,
|
|
545
|
+
http_referer: Optional[str] = None,
|
|
546
|
+
x_title: Optional[str] = None,
|
|
490
547
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
491
548
|
server_url: Optional[str] = None,
|
|
492
549
|
timeout_ms: Optional[int] = None,
|
|
@@ -496,6 +553,11 @@ class Embeddings(BaseSDK):
|
|
|
496
553
|
|
|
497
554
|
Returns a list of all available embeddings models and their properties
|
|
498
555
|
|
|
556
|
+
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
557
|
+
This is used to track API usage per application.
|
|
558
|
+
|
|
559
|
+
:param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
560
|
+
|
|
499
561
|
:param retries: Override the default retry configuration for this method
|
|
500
562
|
:param server_url: Override the default server URL for this method
|
|
501
563
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -510,18 +572,28 @@ class Embeddings(BaseSDK):
|
|
|
510
572
|
base_url = server_url
|
|
511
573
|
else:
|
|
512
574
|
base_url = self._get_url(base_url, url_variables)
|
|
575
|
+
|
|
576
|
+
request = operations.ListEmbeddingsModelsRequest(
|
|
577
|
+
http_referer=http_referer,
|
|
578
|
+
x_title=x_title,
|
|
579
|
+
)
|
|
580
|
+
|
|
513
581
|
req = self._build_request_async(
|
|
514
582
|
method="GET",
|
|
515
583
|
path="/embeddings/models",
|
|
516
584
|
base_url=base_url,
|
|
517
585
|
url_variables=url_variables,
|
|
518
|
-
request=
|
|
586
|
+
request=request,
|
|
519
587
|
request_body_required=False,
|
|
520
588
|
request_has_path_params=False,
|
|
521
589
|
request_has_query_params=True,
|
|
522
590
|
user_agent_header="user-agent",
|
|
523
591
|
accept_header_value="application/json",
|
|
524
592
|
http_headers=http_headers,
|
|
593
|
+
_globals=operations.ListEmbeddingsModelsGlobals(
|
|
594
|
+
http_referer=self.sdk_configuration.globals.http_referer,
|
|
595
|
+
x_title=self.sdk_configuration.globals.x_title,
|
|
596
|
+
),
|
|
525
597
|
security=self.sdk_configuration.security,
|
|
526
598
|
allow_empty_value=None,
|
|
527
599
|
timeout_ms=timeout_ms,
|
openrouter/endpoints.py
CHANGED
|
@@ -17,6 +17,8 @@ class Endpoints(BaseSDK):
|
|
|
17
17
|
*,
|
|
18
18
|
author: str,
|
|
19
19
|
slug: str,
|
|
20
|
+
http_referer: Optional[str] = None,
|
|
21
|
+
x_title: Optional[str] = None,
|
|
20
22
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
21
23
|
server_url: Optional[str] = None,
|
|
22
24
|
timeout_ms: Optional[int] = None,
|
|
@@ -26,6 +28,11 @@ class Endpoints(BaseSDK):
|
|
|
26
28
|
|
|
27
29
|
:param author:
|
|
28
30
|
:param slug:
|
|
31
|
+
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
32
|
+
This is used to track API usage per application.
|
|
33
|
+
|
|
34
|
+
:param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
35
|
+
|
|
29
36
|
:param retries: Override the default retry configuration for this method
|
|
30
37
|
:param server_url: Override the default server URL for this method
|
|
31
38
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -42,6 +49,8 @@ class Endpoints(BaseSDK):
|
|
|
42
49
|
base_url = self._get_url(base_url, url_variables)
|
|
43
50
|
|
|
44
51
|
request = operations.ListEndpointsRequest(
|
|
52
|
+
http_referer=http_referer,
|
|
53
|
+
x_title=x_title,
|
|
45
54
|
author=author,
|
|
46
55
|
slug=slug,
|
|
47
56
|
)
|
|
@@ -58,6 +67,10 @@ class Endpoints(BaseSDK):
|
|
|
58
67
|
user_agent_header="user-agent",
|
|
59
68
|
accept_header_value="application/json",
|
|
60
69
|
http_headers=http_headers,
|
|
70
|
+
_globals=operations.ListEndpointsGlobals(
|
|
71
|
+
http_referer=self.sdk_configuration.globals.http_referer,
|
|
72
|
+
x_title=self.sdk_configuration.globals.x_title,
|
|
73
|
+
),
|
|
61
74
|
security=self.sdk_configuration.security,
|
|
62
75
|
allow_empty_value=None,
|
|
63
76
|
timeout_ms=timeout_ms,
|
|
@@ -117,6 +130,8 @@ class Endpoints(BaseSDK):
|
|
|
117
130
|
*,
|
|
118
131
|
author: str,
|
|
119
132
|
slug: str,
|
|
133
|
+
http_referer: Optional[str] = None,
|
|
134
|
+
x_title: Optional[str] = None,
|
|
120
135
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
121
136
|
server_url: Optional[str] = None,
|
|
122
137
|
timeout_ms: Optional[int] = None,
|
|
@@ -126,6 +141,11 @@ class Endpoints(BaseSDK):
|
|
|
126
141
|
|
|
127
142
|
:param author:
|
|
128
143
|
:param slug:
|
|
144
|
+
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
145
|
+
This is used to track API usage per application.
|
|
146
|
+
|
|
147
|
+
:param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
148
|
+
|
|
129
149
|
:param retries: Override the default retry configuration for this method
|
|
130
150
|
:param server_url: Override the default server URL for this method
|
|
131
151
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -142,6 +162,8 @@ class Endpoints(BaseSDK):
|
|
|
142
162
|
base_url = self._get_url(base_url, url_variables)
|
|
143
163
|
|
|
144
164
|
request = operations.ListEndpointsRequest(
|
|
165
|
+
http_referer=http_referer,
|
|
166
|
+
x_title=x_title,
|
|
145
167
|
author=author,
|
|
146
168
|
slug=slug,
|
|
147
169
|
)
|
|
@@ -158,6 +180,10 @@ class Endpoints(BaseSDK):
|
|
|
158
180
|
user_agent_header="user-agent",
|
|
159
181
|
accept_header_value="application/json",
|
|
160
182
|
http_headers=http_headers,
|
|
183
|
+
_globals=operations.ListEndpointsGlobals(
|
|
184
|
+
http_referer=self.sdk_configuration.globals.http_referer,
|
|
185
|
+
x_title=self.sdk_configuration.globals.x_title,
|
|
186
|
+
),
|
|
161
187
|
security=self.sdk_configuration.security,
|
|
162
188
|
allow_empty_value=None,
|
|
163
189
|
timeout_ms=timeout_ms,
|
|
@@ -215,6 +241,8 @@ class Endpoints(BaseSDK):
|
|
|
215
241
|
def list_zdr_endpoints(
|
|
216
242
|
self,
|
|
217
243
|
*,
|
|
244
|
+
http_referer: Optional[str] = None,
|
|
245
|
+
x_title: Optional[str] = None,
|
|
218
246
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
219
247
|
server_url: Optional[str] = None,
|
|
220
248
|
timeout_ms: Optional[int] = None,
|
|
@@ -222,6 +250,11 @@ class Endpoints(BaseSDK):
|
|
|
222
250
|
) -> operations.ListEndpointsZdrResponse:
|
|
223
251
|
r"""Preview the impact of ZDR on the available endpoints
|
|
224
252
|
|
|
253
|
+
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
254
|
+
This is used to track API usage per application.
|
|
255
|
+
|
|
256
|
+
:param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
257
|
+
|
|
225
258
|
:param retries: Override the default retry configuration for this method
|
|
226
259
|
:param server_url: Override the default server URL for this method
|
|
227
260
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -236,18 +269,28 @@ class Endpoints(BaseSDK):
|
|
|
236
269
|
base_url = server_url
|
|
237
270
|
else:
|
|
238
271
|
base_url = self._get_url(base_url, url_variables)
|
|
272
|
+
|
|
273
|
+
request = operations.ListEndpointsZdrRequest(
|
|
274
|
+
http_referer=http_referer,
|
|
275
|
+
x_title=x_title,
|
|
276
|
+
)
|
|
277
|
+
|
|
239
278
|
req = self._build_request(
|
|
240
279
|
method="GET",
|
|
241
280
|
path="/endpoints/zdr",
|
|
242
281
|
base_url=base_url,
|
|
243
282
|
url_variables=url_variables,
|
|
244
|
-
request=
|
|
283
|
+
request=request,
|
|
245
284
|
request_body_required=False,
|
|
246
285
|
request_has_path_params=False,
|
|
247
286
|
request_has_query_params=True,
|
|
248
287
|
user_agent_header="user-agent",
|
|
249
288
|
accept_header_value="application/json",
|
|
250
289
|
http_headers=http_headers,
|
|
290
|
+
_globals=operations.ListEndpointsZdrGlobals(
|
|
291
|
+
http_referer=self.sdk_configuration.globals.http_referer,
|
|
292
|
+
x_title=self.sdk_configuration.globals.x_title,
|
|
293
|
+
),
|
|
251
294
|
security=self.sdk_configuration.security,
|
|
252
295
|
allow_empty_value=None,
|
|
253
296
|
timeout_ms=timeout_ms,
|
|
@@ -302,6 +345,8 @@ class Endpoints(BaseSDK):
|
|
|
302
345
|
async def list_zdr_endpoints_async(
|
|
303
346
|
self,
|
|
304
347
|
*,
|
|
348
|
+
http_referer: Optional[str] = None,
|
|
349
|
+
x_title: Optional[str] = None,
|
|
305
350
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
306
351
|
server_url: Optional[str] = None,
|
|
307
352
|
timeout_ms: Optional[int] = None,
|
|
@@ -309,6 +354,11 @@ class Endpoints(BaseSDK):
|
|
|
309
354
|
) -> operations.ListEndpointsZdrResponse:
|
|
310
355
|
r"""Preview the impact of ZDR on the available endpoints
|
|
311
356
|
|
|
357
|
+
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
358
|
+
This is used to track API usage per application.
|
|
359
|
+
|
|
360
|
+
:param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
361
|
+
|
|
312
362
|
:param retries: Override the default retry configuration for this method
|
|
313
363
|
:param server_url: Override the default server URL for this method
|
|
314
364
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -323,18 +373,28 @@ class Endpoints(BaseSDK):
|
|
|
323
373
|
base_url = server_url
|
|
324
374
|
else:
|
|
325
375
|
base_url = self._get_url(base_url, url_variables)
|
|
376
|
+
|
|
377
|
+
request = operations.ListEndpointsZdrRequest(
|
|
378
|
+
http_referer=http_referer,
|
|
379
|
+
x_title=x_title,
|
|
380
|
+
)
|
|
381
|
+
|
|
326
382
|
req = self._build_request_async(
|
|
327
383
|
method="GET",
|
|
328
384
|
path="/endpoints/zdr",
|
|
329
385
|
base_url=base_url,
|
|
330
386
|
url_variables=url_variables,
|
|
331
|
-
request=
|
|
387
|
+
request=request,
|
|
332
388
|
request_body_required=False,
|
|
333
389
|
request_has_path_params=False,
|
|
334
390
|
request_has_query_params=True,
|
|
335
391
|
user_agent_header="user-agent",
|
|
336
392
|
accept_header_value="application/json",
|
|
337
393
|
http_headers=http_headers,
|
|
394
|
+
_globals=operations.ListEndpointsZdrGlobals(
|
|
395
|
+
http_referer=self.sdk_configuration.globals.http_referer,
|
|
396
|
+
x_title=self.sdk_configuration.globals.x_title,
|
|
397
|
+
),
|
|
338
398
|
security=self.sdk_configuration.security,
|
|
339
399
|
allow_empty_value=None,
|
|
340
400
|
timeout_ms=timeout_ms,
|