openrouter 0.1.3__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.
Files changed (77) hide show
  1. openrouter/_version.py +2 -2
  2. openrouter/analytics.py +28 -2
  3. openrouter/api_keys.py +200 -24
  4. openrouter/chat.py +192 -200
  5. openrouter/components/__init__.py +213 -281
  6. openrouter/components/_schema10.py +39 -0
  7. openrouter/components/_schema14.py +11 -0
  8. openrouter/components/_schema17.py +154 -0
  9. openrouter/components/{_schema2.py → _schema19.py} +28 -22
  10. openrouter/components/{_schema0.py → _schema5.py} +7 -5
  11. openrouter/components/assistantmessage.py +3 -3
  12. openrouter/components/chatgenerationparams.py +57 -343
  13. openrouter/components/chatstreamingmessagechunk.py +3 -3
  14. openrouter/components/developermessage.py +41 -0
  15. openrouter/components/message.py +6 -39
  16. openrouter/components/openresponsesrequest.py +31 -39
  17. openrouter/components/providername.py +2 -0
  18. openrouter/components/providerpreferences.py +2 -10
  19. openrouter/components/publicendpoint.py +0 -26
  20. openrouter/components/publicpricing.py +0 -26
  21. openrouter/credits.py +86 -14
  22. openrouter/embeddings.py +92 -20
  23. openrouter/endpoints.py +62 -2
  24. openrouter/generations.py +26 -0
  25. openrouter/guardrails.py +392 -42
  26. openrouter/models_.py +116 -8
  27. openrouter/oauth.py +90 -22
  28. openrouter/operations/__init__.py +322 -2
  29. openrouter/operations/bulkassignkeystoguardrail.py +70 -3
  30. openrouter/operations/bulkassignmemberstoguardrail.py +70 -3
  31. openrouter/operations/bulkunassignkeysfromguardrail.py +70 -3
  32. openrouter/operations/bulkunassignmembersfromguardrail.py +70 -3
  33. openrouter/operations/createauthkeyscode.py +81 -3
  34. openrouter/operations/createcoinbasecharge.py +82 -2
  35. openrouter/operations/createembeddings.py +82 -3
  36. openrouter/operations/createguardrail.py +82 -4
  37. openrouter/operations/createkeys.py +81 -3
  38. openrouter/operations/createresponses.py +84 -3
  39. openrouter/operations/deleteguardrail.py +69 -3
  40. openrouter/operations/deletekeys.py +69 -3
  41. openrouter/operations/exchangeauthcodeforapikey.py +81 -3
  42. openrouter/operations/getcredits.py +70 -1
  43. openrouter/operations/getcurrentkey.py +81 -3
  44. openrouter/operations/getgeneration.py +248 -3
  45. openrouter/operations/getguardrail.py +69 -2
  46. openrouter/operations/getkey.py +64 -1
  47. openrouter/operations/getmodels.py +68 -1
  48. openrouter/operations/getuseractivity.py +62 -1
  49. openrouter/operations/list.py +63 -1
  50. openrouter/operations/listembeddingsmodels.py +74 -0
  51. openrouter/operations/listendpoints.py +65 -2
  52. openrouter/operations/listendpointszdr.py +70 -2
  53. openrouter/operations/listguardrailkeyassignments.py +68 -1
  54. openrouter/operations/listguardrailmemberassignments.py +68 -1
  55. openrouter/operations/listguardrails.py +68 -1
  56. openrouter/operations/listkeyassignments.py +63 -1
  57. openrouter/operations/listmemberassignments.py +63 -1
  58. openrouter/operations/listmodelscount.py +74 -0
  59. openrouter/operations/listmodelsuser.py +70 -2
  60. openrouter/operations/listproviders.py +70 -2
  61. openrouter/operations/sendchatcompletionrequest.py +87 -3
  62. openrouter/operations/updateguardrail.py +63 -0
  63. openrouter/operations/updatekeys.py +63 -0
  64. openrouter/providers.py +36 -2
  65. openrouter/responses.py +178 -148
  66. openrouter/sdk.py +1 -4
  67. {openrouter-0.1.3.dist-info → openrouter-0.6.0.dist-info}/METADATA +5 -1
  68. {openrouter-0.1.3.dist-info → openrouter-0.6.0.dist-info}/RECORD +71 -71
  69. {openrouter-0.1.3.dist-info → openrouter-0.6.0.dist-info}/WHEEL +1 -1
  70. openrouter/completions.py +0 -361
  71. openrouter/components/completionchoice.py +0 -82
  72. openrouter/components/completioncreateparams.py +0 -277
  73. openrouter/components/completionlogprobs.py +0 -54
  74. openrouter/components/completionresponse.py +0 -46
  75. openrouter/components/completionusage.py +0 -19
  76. {openrouter-0.1.3.dist-info → openrouter-0.6.0.dist-info}/licenses/LICENSE +0 -0
  77. {openrouter-0.1.3.dist-info → openrouter-0.6.0.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.1.3"
6
+ __version__: str = "0.6.0"
7
7
  __openapi_doc_version__: str = "1.0.0"
8
8
  __gen_version__: str = "2.768.0"
9
- __user_agent__: str = "speakeasy-sdk/python 0.1.3 2.768.0 1.0.0 openrouter"
9
+ __user_agent__: str = "speakeasy-sdk/python 0.6.0 2.768.0 1.0.0 openrouter"
10
10
 
11
11
  try:
12
12
  if __package__ is not None:
openrouter/analytics.py CHANGED
@@ -15,6 +15,8 @@ class Analytics(BaseSDK):
15
15
  def get_user_activity(
16
16
  self,
17
17
  *,
18
+ http_referer: Optional[str] = None,
19
+ x_title: Optional[str] = None,
18
20
  date_: Optional[str] = None,
19
21
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
20
22
  server_url: Optional[str] = None,
@@ -23,7 +25,12 @@ class Analytics(BaseSDK):
23
25
  ) -> operations.GetUserActivityResponse:
24
26
  r"""Get user activity grouped by endpoint
25
27
 
26
- Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
28
+ Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Management key](/docs/guides/overview/auth/management-api-keys) required.
29
+
30
+ :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
31
+ This is used to track API usage per application.
32
+
33
+ :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
27
34
 
28
35
  :param date_: Filter by a single UTC date in the last 30 days (YYYY-MM-DD format).
29
36
  :param retries: Override the default retry configuration for this method
@@ -42,6 +49,8 @@ class Analytics(BaseSDK):
42
49
  base_url = self._get_url(base_url, url_variables)
43
50
 
44
51
  request = operations.GetUserActivityRequest(
52
+ http_referer=http_referer,
53
+ x_title=x_title,
45
54
  date_=date_,
46
55
  )
47
56
 
@@ -57,6 +66,10 @@ class Analytics(BaseSDK):
57
66
  user_agent_header="user-agent",
58
67
  accept_header_value="application/json",
59
68
  http_headers=http_headers,
69
+ _globals=operations.GetUserActivityGlobals(
70
+ http_referer=self.sdk_configuration.globals.http_referer,
71
+ x_title=self.sdk_configuration.globals.x_title,
72
+ ),
60
73
  security=self.sdk_configuration.security,
61
74
  allow_empty_value=None,
62
75
  timeout_ms=timeout_ms,
@@ -124,6 +137,8 @@ class Analytics(BaseSDK):
124
137
  async def get_user_activity_async(
125
138
  self,
126
139
  *,
140
+ http_referer: Optional[str] = None,
141
+ x_title: Optional[str] = None,
127
142
  date_: Optional[str] = None,
128
143
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
129
144
  server_url: Optional[str] = None,
@@ -132,7 +147,12 @@ class Analytics(BaseSDK):
132
147
  ) -> operations.GetUserActivityResponse:
133
148
  r"""Get user activity grouped by endpoint
134
149
 
135
- Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
150
+ Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Management key](/docs/guides/overview/auth/management-api-keys) required.
151
+
152
+ :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
153
+ This is used to track API usage per application.
154
+
155
+ :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
136
156
 
137
157
  :param date_: Filter by a single UTC date in the last 30 days (YYYY-MM-DD format).
138
158
  :param retries: Override the default retry configuration for this method
@@ -151,6 +171,8 @@ class Analytics(BaseSDK):
151
171
  base_url = self._get_url(base_url, url_variables)
152
172
 
153
173
  request = operations.GetUserActivityRequest(
174
+ http_referer=http_referer,
175
+ x_title=x_title,
154
176
  date_=date_,
155
177
  )
156
178
 
@@ -166,6 +188,10 @@ class Analytics(BaseSDK):
166
188
  user_agent_header="user-agent",
167
189
  accept_header_value="application/json",
168
190
  http_headers=http_headers,
191
+ _globals=operations.GetUserActivityGlobals(
192
+ http_referer=self.sdk_configuration.globals.http_referer,
193
+ x_title=self.sdk_configuration.globals.x_title,
194
+ ),
169
195
  security=self.sdk_configuration.security,
170
196
  allow_empty_value=None,
171
197
  timeout_ms=timeout_ms,
openrouter/api_keys.py CHANGED
@@ -16,6 +16,8 @@ class APIKeys(BaseSDK):
16
16
  def list(
17
17
  self,
18
18
  *,
19
+ http_referer: Optional[str] = None,
20
+ x_title: Optional[str] = None,
19
21
  include_disabled: Optional[str] = None,
20
22
  offset: Optional[str] = None,
21
23
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
@@ -25,7 +27,12 @@ class APIKeys(BaseSDK):
25
27
  ) -> operations.ListResponse:
26
28
  r"""List API keys
27
29
 
28
- List all API keys for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
30
+ List all API keys for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
31
+
32
+ :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
33
+ This is used to track API usage per application.
34
+
35
+ :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
29
36
 
30
37
  :param include_disabled: Whether to include disabled API keys in the response
31
38
  :param offset: Number of API keys to skip for pagination
@@ -45,6 +52,8 @@ class APIKeys(BaseSDK):
45
52
  base_url = self._get_url(base_url, url_variables)
46
53
 
47
54
  request = operations.ListRequest(
55
+ http_referer=http_referer,
56
+ x_title=x_title,
48
57
  include_disabled=include_disabled,
49
58
  offset=offset,
50
59
  )
@@ -61,6 +70,10 @@ class APIKeys(BaseSDK):
61
70
  user_agent_header="user-agent",
62
71
  accept_header_value="application/json",
63
72
  http_headers=http_headers,
73
+ _globals=operations.ListGlobals(
74
+ http_referer=self.sdk_configuration.globals.http_referer,
75
+ x_title=self.sdk_configuration.globals.x_title,
76
+ ),
64
77
  security=self.sdk_configuration.security,
65
78
  allow_empty_value=None,
66
79
  timeout_ms=timeout_ms,
@@ -123,6 +136,8 @@ class APIKeys(BaseSDK):
123
136
  async def list_async(
124
137
  self,
125
138
  *,
139
+ http_referer: Optional[str] = None,
140
+ x_title: Optional[str] = None,
126
141
  include_disabled: Optional[str] = None,
127
142
  offset: Optional[str] = None,
128
143
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
@@ -132,7 +147,12 @@ class APIKeys(BaseSDK):
132
147
  ) -> operations.ListResponse:
133
148
  r"""List API keys
134
149
 
135
- List all API keys for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
150
+ List all API keys for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
151
+
152
+ :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
153
+ This is used to track API usage per application.
154
+
155
+ :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
136
156
 
137
157
  :param include_disabled: Whether to include disabled API keys in the response
138
158
  :param offset: Number of API keys to skip for pagination
@@ -152,6 +172,8 @@ class APIKeys(BaseSDK):
152
172
  base_url = self._get_url(base_url, url_variables)
153
173
 
154
174
  request = operations.ListRequest(
175
+ http_referer=http_referer,
176
+ x_title=x_title,
155
177
  include_disabled=include_disabled,
156
178
  offset=offset,
157
179
  )
@@ -168,6 +190,10 @@ class APIKeys(BaseSDK):
168
190
  user_agent_header="user-agent",
169
191
  accept_header_value="application/json",
170
192
  http_headers=http_headers,
193
+ _globals=operations.ListGlobals(
194
+ http_referer=self.sdk_configuration.globals.http_referer,
195
+ x_title=self.sdk_configuration.globals.x_title,
196
+ ),
171
197
  security=self.sdk_configuration.security,
172
198
  allow_empty_value=None,
173
199
  timeout_ms=timeout_ms,
@@ -231,6 +257,8 @@ class APIKeys(BaseSDK):
231
257
  self,
232
258
  *,
233
259
  name: str,
260
+ http_referer: Optional[str] = None,
261
+ x_title: Optional[str] = None,
234
262
  limit: OptionalNullable[float] = UNSET,
235
263
  limit_reset: OptionalNullable[operations.CreateKeysLimitReset] = UNSET,
236
264
  include_byok_in_limit: Optional[bool] = None,
@@ -242,9 +270,14 @@ class APIKeys(BaseSDK):
242
270
  ) -> operations.CreateKeysResponse:
243
271
  r"""Create a new API key
244
272
 
245
- Create a new API key for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
273
+ Create a new API key for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
246
274
 
247
275
  :param name: Name for the new API key
276
+ :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
277
+ This is used to track API usage per application.
278
+
279
+ :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
280
+
248
281
  :param limit: Optional spending limit for the API key in USD
249
282
  :param limit_reset: Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday.
250
283
  :param include_byok_in_limit: Whether to include BYOK usage in the limit
@@ -265,11 +298,15 @@ class APIKeys(BaseSDK):
265
298
  base_url = self._get_url(base_url, url_variables)
266
299
 
267
300
  request = operations.CreateKeysRequest(
268
- name=name,
269
- limit=limit,
270
- limit_reset=limit_reset,
271
- include_byok_in_limit=include_byok_in_limit,
272
- expires_at=expires_at,
301
+ http_referer=http_referer,
302
+ x_title=x_title,
303
+ request_body=operations.CreateKeysRequestBody(
304
+ name=name,
305
+ limit=limit,
306
+ limit_reset=limit_reset,
307
+ include_byok_in_limit=include_byok_in_limit,
308
+ expires_at=expires_at,
309
+ ),
273
310
  )
274
311
 
275
312
  req = self._build_request(
@@ -284,9 +321,17 @@ class APIKeys(BaseSDK):
284
321
  user_agent_header="user-agent",
285
322
  accept_header_value="application/json",
286
323
  http_headers=http_headers,
324
+ _globals=operations.CreateKeysGlobals(
325
+ http_referer=self.sdk_configuration.globals.http_referer,
326
+ x_title=self.sdk_configuration.globals.x_title,
327
+ ),
287
328
  security=self.sdk_configuration.security,
288
329
  get_serialized_body=lambda: utils.serialize_request_body(
289
- request, False, False, "json", operations.CreateKeysRequest
330
+ request.request_body,
331
+ False,
332
+ False,
333
+ "json",
334
+ operations.CreateKeysRequestBody,
290
335
  ),
291
336
  allow_empty_value=None,
292
337
  timeout_ms=timeout_ms,
@@ -355,6 +400,8 @@ class APIKeys(BaseSDK):
355
400
  self,
356
401
  *,
357
402
  name: str,
403
+ http_referer: Optional[str] = None,
404
+ x_title: Optional[str] = None,
358
405
  limit: OptionalNullable[float] = UNSET,
359
406
  limit_reset: OptionalNullable[operations.CreateKeysLimitReset] = UNSET,
360
407
  include_byok_in_limit: Optional[bool] = None,
@@ -366,9 +413,14 @@ class APIKeys(BaseSDK):
366
413
  ) -> operations.CreateKeysResponse:
367
414
  r"""Create a new API key
368
415
 
369
- Create a new API key for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
416
+ Create a new API key for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
370
417
 
371
418
  :param name: Name for the new API key
419
+ :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
420
+ This is used to track API usage per application.
421
+
422
+ :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
423
+
372
424
  :param limit: Optional spending limit for the API key in USD
373
425
  :param limit_reset: Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday.
374
426
  :param include_byok_in_limit: Whether to include BYOK usage in the limit
@@ -389,11 +441,15 @@ class APIKeys(BaseSDK):
389
441
  base_url = self._get_url(base_url, url_variables)
390
442
 
391
443
  request = operations.CreateKeysRequest(
392
- name=name,
393
- limit=limit,
394
- limit_reset=limit_reset,
395
- include_byok_in_limit=include_byok_in_limit,
396
- expires_at=expires_at,
444
+ http_referer=http_referer,
445
+ x_title=x_title,
446
+ request_body=operations.CreateKeysRequestBody(
447
+ name=name,
448
+ limit=limit,
449
+ limit_reset=limit_reset,
450
+ include_byok_in_limit=include_byok_in_limit,
451
+ expires_at=expires_at,
452
+ ),
397
453
  )
398
454
 
399
455
  req = self._build_request_async(
@@ -408,9 +464,17 @@ class APIKeys(BaseSDK):
408
464
  user_agent_header="user-agent",
409
465
  accept_header_value="application/json",
410
466
  http_headers=http_headers,
467
+ _globals=operations.CreateKeysGlobals(
468
+ http_referer=self.sdk_configuration.globals.http_referer,
469
+ x_title=self.sdk_configuration.globals.x_title,
470
+ ),
411
471
  security=self.sdk_configuration.security,
412
472
  get_serialized_body=lambda: utils.serialize_request_body(
413
- request, False, False, "json", operations.CreateKeysRequest
473
+ request.request_body,
474
+ False,
475
+ False,
476
+ "json",
477
+ operations.CreateKeysRequestBody,
414
478
  ),
415
479
  allow_empty_value=None,
416
480
  timeout_ms=timeout_ms,
@@ -479,6 +543,8 @@ class APIKeys(BaseSDK):
479
543
  self,
480
544
  *,
481
545
  hash: str,
546
+ http_referer: Optional[str] = None,
547
+ x_title: Optional[str] = None,
482
548
  name: Optional[str] = None,
483
549
  disabled: Optional[bool] = None,
484
550
  limit: OptionalNullable[float] = UNSET,
@@ -491,9 +557,14 @@ class APIKeys(BaseSDK):
491
557
  ) -> operations.UpdateKeysResponse:
492
558
  r"""Update an API key
493
559
 
494
- Update an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
560
+ Update an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required.
495
561
 
496
562
  :param hash: The hash identifier of the API key to update
563
+ :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
564
+ This is used to track API usage per application.
565
+
566
+ :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
567
+
497
568
  :param name: New name for the API key
498
569
  :param disabled: Whether to disable the API key
499
570
  :param limit: New spending limit for the API key in USD
@@ -515,6 +586,8 @@ class APIKeys(BaseSDK):
515
586
  base_url = self._get_url(base_url, url_variables)
516
587
 
517
588
  request = operations.UpdateKeysRequest(
589
+ http_referer=http_referer,
590
+ x_title=x_title,
518
591
  hash=hash,
519
592
  request_body=operations.UpdateKeysRequestBody(
520
593
  name=name,
@@ -537,6 +610,10 @@ class APIKeys(BaseSDK):
537
610
  user_agent_header="user-agent",
538
611
  accept_header_value="application/json",
539
612
  http_headers=http_headers,
613
+ _globals=operations.UpdateKeysGlobals(
614
+ http_referer=self.sdk_configuration.globals.http_referer,
615
+ x_title=self.sdk_configuration.globals.x_title,
616
+ ),
540
617
  security=self.sdk_configuration.security,
541
618
  get_serialized_body=lambda: utils.serialize_request_body(
542
619
  request.request_body,
@@ -617,6 +694,8 @@ class APIKeys(BaseSDK):
617
694
  self,
618
695
  *,
619
696
  hash: str,
697
+ http_referer: Optional[str] = None,
698
+ x_title: Optional[str] = None,
620
699
  name: Optional[str] = None,
621
700
  disabled: Optional[bool] = None,
622
701
  limit: OptionalNullable[float] = UNSET,
@@ -629,9 +708,14 @@ class APIKeys(BaseSDK):
629
708
  ) -> operations.UpdateKeysResponse:
630
709
  r"""Update an API key
631
710
 
632
- Update an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
711
+ Update an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required.
633
712
 
634
713
  :param hash: The hash identifier of the API key to update
714
+ :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
715
+ This is used to track API usage per application.
716
+
717
+ :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
718
+
635
719
  :param name: New name for the API key
636
720
  :param disabled: Whether to disable the API key
637
721
  :param limit: New spending limit for the API key in USD
@@ -653,6 +737,8 @@ class APIKeys(BaseSDK):
653
737
  base_url = self._get_url(base_url, url_variables)
654
738
 
655
739
  request = operations.UpdateKeysRequest(
740
+ http_referer=http_referer,
741
+ x_title=x_title,
656
742
  hash=hash,
657
743
  request_body=operations.UpdateKeysRequestBody(
658
744
  name=name,
@@ -675,6 +761,10 @@ class APIKeys(BaseSDK):
675
761
  user_agent_header="user-agent",
676
762
  accept_header_value="application/json",
677
763
  http_headers=http_headers,
764
+ _globals=operations.UpdateKeysGlobals(
765
+ http_referer=self.sdk_configuration.globals.http_referer,
766
+ x_title=self.sdk_configuration.globals.x_title,
767
+ ),
678
768
  security=self.sdk_configuration.security,
679
769
  get_serialized_body=lambda: utils.serialize_request_body(
680
770
  request.request_body,
@@ -755,6 +845,8 @@ class APIKeys(BaseSDK):
755
845
  self,
756
846
  *,
757
847
  hash: str,
848
+ http_referer: Optional[str] = None,
849
+ x_title: Optional[str] = None,
758
850
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
759
851
  server_url: Optional[str] = None,
760
852
  timeout_ms: Optional[int] = None,
@@ -762,9 +854,14 @@ class APIKeys(BaseSDK):
762
854
  ) -> operations.DeleteKeysResponse:
763
855
  r"""Delete an API key
764
856
 
765
- Delete an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
857
+ Delete an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required.
766
858
 
767
859
  :param hash: The hash identifier of the API key to delete
860
+ :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
861
+ This is used to track API usage per application.
862
+
863
+ :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
864
+
768
865
  :param retries: Override the default retry configuration for this method
769
866
  :param server_url: Override the default server URL for this method
770
867
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -781,6 +878,8 @@ class APIKeys(BaseSDK):
781
878
  base_url = self._get_url(base_url, url_variables)
782
879
 
783
880
  request = operations.DeleteKeysRequest(
881
+ http_referer=http_referer,
882
+ x_title=x_title,
784
883
  hash=hash,
785
884
  )
786
885
 
@@ -796,6 +895,10 @@ class APIKeys(BaseSDK):
796
895
  user_agent_header="user-agent",
797
896
  accept_header_value="application/json",
798
897
  http_headers=http_headers,
898
+ _globals=operations.DeleteKeysGlobals(
899
+ http_referer=self.sdk_configuration.globals.http_referer,
900
+ x_title=self.sdk_configuration.globals.x_title,
901
+ ),
799
902
  security=self.sdk_configuration.security,
800
903
  allow_empty_value=None,
801
904
  timeout_ms=timeout_ms,
@@ -864,6 +967,8 @@ class APIKeys(BaseSDK):
864
967
  self,
865
968
  *,
866
969
  hash: str,
970
+ http_referer: Optional[str] = None,
971
+ x_title: Optional[str] = None,
867
972
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
868
973
  server_url: Optional[str] = None,
869
974
  timeout_ms: Optional[int] = None,
@@ -871,9 +976,14 @@ class APIKeys(BaseSDK):
871
976
  ) -> operations.DeleteKeysResponse:
872
977
  r"""Delete an API key
873
978
 
874
- Delete an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
979
+ Delete an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required.
875
980
 
876
981
  :param hash: The hash identifier of the API key to delete
982
+ :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
983
+ This is used to track API usage per application.
984
+
985
+ :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
986
+
877
987
  :param retries: Override the default retry configuration for this method
878
988
  :param server_url: Override the default server URL for this method
879
989
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -890,6 +1000,8 @@ class APIKeys(BaseSDK):
890
1000
  base_url = self._get_url(base_url, url_variables)
891
1001
 
892
1002
  request = operations.DeleteKeysRequest(
1003
+ http_referer=http_referer,
1004
+ x_title=x_title,
893
1005
  hash=hash,
894
1006
  )
895
1007
 
@@ -905,6 +1017,10 @@ class APIKeys(BaseSDK):
905
1017
  user_agent_header="user-agent",
906
1018
  accept_header_value="application/json",
907
1019
  http_headers=http_headers,
1020
+ _globals=operations.DeleteKeysGlobals(
1021
+ http_referer=self.sdk_configuration.globals.http_referer,
1022
+ x_title=self.sdk_configuration.globals.x_title,
1023
+ ),
908
1024
  security=self.sdk_configuration.security,
909
1025
  allow_empty_value=None,
910
1026
  timeout_ms=timeout_ms,
@@ -973,6 +1089,8 @@ class APIKeys(BaseSDK):
973
1089
  self,
974
1090
  *,
975
1091
  hash: str,
1092
+ http_referer: Optional[str] = None,
1093
+ x_title: Optional[str] = None,
976
1094
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
977
1095
  server_url: Optional[str] = None,
978
1096
  timeout_ms: Optional[int] = None,
@@ -980,9 +1098,14 @@ class APIKeys(BaseSDK):
980
1098
  ) -> operations.GetKeyResponse:
981
1099
  r"""Get a single API key
982
1100
 
983
- Get a single API key by hash. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
1101
+ Get a single API key by hash. [Management key](/docs/guides/overview/auth/management-api-keys) required.
984
1102
 
985
1103
  :param hash: The hash identifier of the API key to retrieve
1104
+ :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
1105
+ This is used to track API usage per application.
1106
+
1107
+ :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
1108
+
986
1109
  :param retries: Override the default retry configuration for this method
987
1110
  :param server_url: Override the default server URL for this method
988
1111
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -999,6 +1122,8 @@ class APIKeys(BaseSDK):
999
1122
  base_url = self._get_url(base_url, url_variables)
1000
1123
 
1001
1124
  request = operations.GetKeyRequest(
1125
+ http_referer=http_referer,
1126
+ x_title=x_title,
1002
1127
  hash=hash,
1003
1128
  )
1004
1129
 
@@ -1014,6 +1139,10 @@ class APIKeys(BaseSDK):
1014
1139
  user_agent_header="user-agent",
1015
1140
  accept_header_value="application/json",
1016
1141
  http_headers=http_headers,
1142
+ _globals=operations.GetKeyGlobals(
1143
+ http_referer=self.sdk_configuration.globals.http_referer,
1144
+ x_title=self.sdk_configuration.globals.x_title,
1145
+ ),
1017
1146
  security=self.sdk_configuration.security,
1018
1147
  allow_empty_value=None,
1019
1148
  timeout_ms=timeout_ms,
@@ -1082,6 +1211,8 @@ class APIKeys(BaseSDK):
1082
1211
  self,
1083
1212
  *,
1084
1213
  hash: str,
1214
+ http_referer: Optional[str] = None,
1215
+ x_title: Optional[str] = None,
1085
1216
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
1086
1217
  server_url: Optional[str] = None,
1087
1218
  timeout_ms: Optional[int] = None,
@@ -1089,9 +1220,14 @@ class APIKeys(BaseSDK):
1089
1220
  ) -> operations.GetKeyResponse:
1090
1221
  r"""Get a single API key
1091
1222
 
1092
- Get a single API key by hash. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
1223
+ Get a single API key by hash. [Management key](/docs/guides/overview/auth/management-api-keys) required.
1093
1224
 
1094
1225
  :param hash: The hash identifier of the API key to retrieve
1226
+ :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
1227
+ This is used to track API usage per application.
1228
+
1229
+ :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
1230
+
1095
1231
  :param retries: Override the default retry configuration for this method
1096
1232
  :param server_url: Override the default server URL for this method
1097
1233
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -1108,6 +1244,8 @@ class APIKeys(BaseSDK):
1108
1244
  base_url = self._get_url(base_url, url_variables)
1109
1245
 
1110
1246
  request = operations.GetKeyRequest(
1247
+ http_referer=http_referer,
1248
+ x_title=x_title,
1111
1249
  hash=hash,
1112
1250
  )
1113
1251
 
@@ -1123,6 +1261,10 @@ class APIKeys(BaseSDK):
1123
1261
  user_agent_header="user-agent",
1124
1262
  accept_header_value="application/json",
1125
1263
  http_headers=http_headers,
1264
+ _globals=operations.GetKeyGlobals(
1265
+ http_referer=self.sdk_configuration.globals.http_referer,
1266
+ x_title=self.sdk_configuration.globals.x_title,
1267
+ ),
1126
1268
  security=self.sdk_configuration.security,
1127
1269
  allow_empty_value=None,
1128
1270
  timeout_ms=timeout_ms,
@@ -1190,6 +1332,8 @@ class APIKeys(BaseSDK):
1190
1332
  def get_current_key_metadata(
1191
1333
  self,
1192
1334
  *,
1335
+ http_referer: Optional[str] = None,
1336
+ x_title: Optional[str] = None,
1193
1337
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
1194
1338
  server_url: Optional[str] = None,
1195
1339
  timeout_ms: Optional[int] = None,
@@ -1199,6 +1343,11 @@ class APIKeys(BaseSDK):
1199
1343
 
1200
1344
  Get information on the API key associated with the current authentication session
1201
1345
 
1346
+ :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
1347
+ This is used to track API usage per application.
1348
+
1349
+ :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
1350
+
1202
1351
  :param retries: Override the default retry configuration for this method
1203
1352
  :param server_url: Override the default server URL for this method
1204
1353
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -1213,18 +1362,28 @@ class APIKeys(BaseSDK):
1213
1362
  base_url = server_url
1214
1363
  else:
1215
1364
  base_url = self._get_url(base_url, url_variables)
1365
+
1366
+ request = operations.GetCurrentKeyRequest(
1367
+ http_referer=http_referer,
1368
+ x_title=x_title,
1369
+ )
1370
+
1216
1371
  req = self._build_request(
1217
1372
  method="GET",
1218
1373
  path="/key",
1219
1374
  base_url=base_url,
1220
1375
  url_variables=url_variables,
1221
- request=None,
1376
+ request=request,
1222
1377
  request_body_required=False,
1223
1378
  request_has_path_params=False,
1224
1379
  request_has_query_params=True,
1225
1380
  user_agent_header="user-agent",
1226
1381
  accept_header_value="application/json",
1227
1382
  http_headers=http_headers,
1383
+ _globals=operations.GetCurrentKeyGlobals(
1384
+ http_referer=self.sdk_configuration.globals.http_referer,
1385
+ x_title=self.sdk_configuration.globals.x_title,
1386
+ ),
1228
1387
  security=self.sdk_configuration.security,
1229
1388
  allow_empty_value=None,
1230
1389
  timeout_ms=timeout_ms,
@@ -1282,6 +1441,8 @@ class APIKeys(BaseSDK):
1282
1441
  async def get_current_key_metadata_async(
1283
1442
  self,
1284
1443
  *,
1444
+ http_referer: Optional[str] = None,
1445
+ x_title: Optional[str] = None,
1285
1446
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
1286
1447
  server_url: Optional[str] = None,
1287
1448
  timeout_ms: Optional[int] = None,
@@ -1291,6 +1452,11 @@ class APIKeys(BaseSDK):
1291
1452
 
1292
1453
  Get information on the API key associated with the current authentication session
1293
1454
 
1455
+ :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
1456
+ This is used to track API usage per application.
1457
+
1458
+ :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
1459
+
1294
1460
  :param retries: Override the default retry configuration for this method
1295
1461
  :param server_url: Override the default server URL for this method
1296
1462
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -1305,18 +1471,28 @@ class APIKeys(BaseSDK):
1305
1471
  base_url = server_url
1306
1472
  else:
1307
1473
  base_url = self._get_url(base_url, url_variables)
1474
+
1475
+ request = operations.GetCurrentKeyRequest(
1476
+ http_referer=http_referer,
1477
+ x_title=x_title,
1478
+ )
1479
+
1308
1480
  req = self._build_request_async(
1309
1481
  method="GET",
1310
1482
  path="/key",
1311
1483
  base_url=base_url,
1312
1484
  url_variables=url_variables,
1313
- request=None,
1485
+ request=request,
1314
1486
  request_body_required=False,
1315
1487
  request_has_path_params=False,
1316
1488
  request_has_query_params=True,
1317
1489
  user_agent_header="user-agent",
1318
1490
  accept_header_value="application/json",
1319
1491
  http_headers=http_headers,
1492
+ _globals=operations.GetCurrentKeyGlobals(
1493
+ http_referer=self.sdk_configuration.globals.http_referer,
1494
+ x_title=self.sdk_configuration.globals.x_title,
1495
+ ),
1320
1496
  security=self.sdk_configuration.security,
1321
1497
  allow_empty_value=None,
1322
1498
  timeout_ms=timeout_ms,