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.
Files changed (84) hide show
  1. openrouter/_version.py +2 -2
  2. openrouter/analytics.py +28 -2
  3. openrouter/api_keys.py +210 -14
  4. openrouter/chat.py +192 -200
  5. openrouter/components/__init__.py +229 -285
  6. openrouter/components/_schema10.py +39 -0
  7. openrouter/components/_schema14.py +11 -0
  8. openrouter/components/_schema17.py +154 -0
  9. openrouter/components/{_schema3.py → _schema19.py} +28 -22
  10. openrouter/components/{_schema0.py → _schema5.py} +7 -5
  11. openrouter/components/assistantmessage.py +32 -1
  12. openrouter/components/chatgenerationparams.py +57 -343
  13. openrouter/components/chatmessagecontentitemimage.py +4 -4
  14. openrouter/components/chatresponsechoice.py +1 -6
  15. openrouter/components/chatstreamingmessagechunk.py +3 -3
  16. openrouter/components/developermessage.py +41 -0
  17. openrouter/components/message.py +6 -39
  18. openrouter/components/model.py +7 -1
  19. openrouter/components/openresponsesrequest.py +31 -39
  20. openrouter/components/outputmodality.py +1 -0
  21. openrouter/components/providername.py +2 -0
  22. openrouter/components/providerpreferences.py +2 -10
  23. openrouter/components/publicendpoint.py +8 -24
  24. openrouter/components/publicpricing.py +3 -24
  25. openrouter/credits.py +86 -14
  26. openrouter/embeddings.py +92 -20
  27. openrouter/endpoints.py +62 -2
  28. openrouter/generations.py +26 -0
  29. openrouter/guardrails.py +3367 -0
  30. openrouter/models_.py +120 -12
  31. openrouter/oauth.py +90 -22
  32. openrouter/operations/__init__.py +601 -30
  33. openrouter/operations/bulkassignkeystoguardrail.py +116 -0
  34. openrouter/operations/bulkassignmemberstoguardrail.py +116 -0
  35. openrouter/operations/bulkunassignkeysfromguardrail.py +116 -0
  36. openrouter/operations/bulkunassignmembersfromguardrail.py +116 -0
  37. openrouter/operations/createauthkeyscode.py +81 -3
  38. openrouter/operations/createcoinbasecharge.py +82 -2
  39. openrouter/operations/createembeddings.py +82 -3
  40. openrouter/operations/createguardrail.py +325 -0
  41. openrouter/operations/createkeys.py +81 -3
  42. openrouter/operations/createresponses.py +84 -3
  43. openrouter/operations/deleteguardrail.py +104 -0
  44. openrouter/operations/deletekeys.py +69 -3
  45. openrouter/operations/exchangeauthcodeforapikey.py +81 -3
  46. openrouter/operations/getcredits.py +70 -1
  47. openrouter/operations/getcurrentkey.py +81 -3
  48. openrouter/operations/getgeneration.py +248 -3
  49. openrouter/operations/getguardrail.py +228 -0
  50. openrouter/operations/getkey.py +64 -1
  51. openrouter/operations/getmodels.py +95 -5
  52. openrouter/operations/getuseractivity.py +62 -1
  53. openrouter/operations/list.py +63 -1
  54. openrouter/operations/listembeddingsmodels.py +74 -0
  55. openrouter/operations/listendpoints.py +65 -2
  56. openrouter/operations/listendpointszdr.py +70 -2
  57. openrouter/operations/listguardrailkeyassignments.py +192 -0
  58. openrouter/operations/listguardrailmemberassignments.py +187 -0
  59. openrouter/operations/listguardrails.py +238 -0
  60. openrouter/operations/listkeyassignments.py +180 -0
  61. openrouter/operations/listmemberassignments.py +175 -0
  62. openrouter/operations/listmodelscount.py +74 -0
  63. openrouter/operations/listmodelsuser.py +70 -2
  64. openrouter/operations/listproviders.py +70 -2
  65. openrouter/operations/sendchatcompletionrequest.py +87 -3
  66. openrouter/operations/updateguardrail.py +334 -0
  67. openrouter/operations/updatekeys.py +63 -0
  68. openrouter/providers.py +36 -2
  69. openrouter/responses.py +178 -148
  70. openrouter/sdk.py +5 -8
  71. openrouter/types/models.py +378 -0
  72. {openrouter-0.1.2.dist-info → openrouter-0.6.0.dist-info}/METADATA +5 -1
  73. {openrouter-0.1.2.dist-info → openrouter-0.6.0.dist-info}/RECORD +76 -63
  74. {openrouter-0.1.2.dist-info → openrouter-0.6.0.dist-info}/WHEEL +1 -1
  75. openrouter/completions.py +0 -361
  76. openrouter/components/completionchoice.py +0 -82
  77. openrouter/components/completioncreateparams.py +0 -277
  78. openrouter/components/completionlogprobs.py +0 -54
  79. openrouter/components/completionresponse.py +0 -46
  80. openrouter/components/completionusage.py +0 -19
  81. openrouter/operations/getparameters.py +0 -123
  82. openrouter/parameters.py +0 -237
  83. {openrouter-0.1.2.dist-info → openrouter-0.6.0.dist-info}/licenses/LICENSE +0 -0
  84. {openrouter-0.1.2.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.2"
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.2 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
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
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,6 +27,13 @@ class APIKeys(BaseSDK):
25
27
  ) -> operations.ListResponse:
26
28
  r"""List API keys
27
29
 
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.
36
+
28
37
  :param include_disabled: Whether to include disabled API keys in the response
29
38
  :param offset: Number of API keys to skip for pagination
30
39
  :param retries: Override the default retry configuration for this method
@@ -43,6 +52,8 @@ class APIKeys(BaseSDK):
43
52
  base_url = self._get_url(base_url, url_variables)
44
53
 
45
54
  request = operations.ListRequest(
55
+ http_referer=http_referer,
56
+ x_title=x_title,
46
57
  include_disabled=include_disabled,
47
58
  offset=offset,
48
59
  )
@@ -59,6 +70,10 @@ class APIKeys(BaseSDK):
59
70
  user_agent_header="user-agent",
60
71
  accept_header_value="application/json",
61
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
+ ),
62
77
  security=self.sdk_configuration.security,
63
78
  allow_empty_value=None,
64
79
  timeout_ms=timeout_ms,
@@ -121,6 +136,8 @@ class APIKeys(BaseSDK):
121
136
  async def list_async(
122
137
  self,
123
138
  *,
139
+ http_referer: Optional[str] = None,
140
+ x_title: Optional[str] = None,
124
141
  include_disabled: Optional[str] = None,
125
142
  offset: Optional[str] = None,
126
143
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
@@ -130,6 +147,13 @@ class APIKeys(BaseSDK):
130
147
  ) -> operations.ListResponse:
131
148
  r"""List API keys
132
149
 
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.
156
+
133
157
  :param include_disabled: Whether to include disabled API keys in the response
134
158
  :param offset: Number of API keys to skip for pagination
135
159
  :param retries: Override the default retry configuration for this method
@@ -148,6 +172,8 @@ class APIKeys(BaseSDK):
148
172
  base_url = self._get_url(base_url, url_variables)
149
173
 
150
174
  request = operations.ListRequest(
175
+ http_referer=http_referer,
176
+ x_title=x_title,
151
177
  include_disabled=include_disabled,
152
178
  offset=offset,
153
179
  )
@@ -164,6 +190,10 @@ class APIKeys(BaseSDK):
164
190
  user_agent_header="user-agent",
165
191
  accept_header_value="application/json",
166
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
+ ),
167
197
  security=self.sdk_configuration.security,
168
198
  allow_empty_value=None,
169
199
  timeout_ms=timeout_ms,
@@ -227,6 +257,8 @@ class APIKeys(BaseSDK):
227
257
  self,
228
258
  *,
229
259
  name: str,
260
+ http_referer: Optional[str] = None,
261
+ x_title: Optional[str] = None,
230
262
  limit: OptionalNullable[float] = UNSET,
231
263
  limit_reset: OptionalNullable[operations.CreateKeysLimitReset] = UNSET,
232
264
  include_byok_in_limit: Optional[bool] = None,
@@ -238,7 +270,14 @@ class APIKeys(BaseSDK):
238
270
  ) -> operations.CreateKeysResponse:
239
271
  r"""Create a new API key
240
272
 
273
+ Create a new API key for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
274
+
241
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
+
242
281
  :param limit: Optional spending limit for the API key in USD
243
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.
244
283
  :param include_byok_in_limit: Whether to include BYOK usage in the limit
@@ -259,11 +298,15 @@ class APIKeys(BaseSDK):
259
298
  base_url = self._get_url(base_url, url_variables)
260
299
 
261
300
  request = operations.CreateKeysRequest(
262
- name=name,
263
- limit=limit,
264
- limit_reset=limit_reset,
265
- include_byok_in_limit=include_byok_in_limit,
266
- 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
+ ),
267
310
  )
268
311
 
269
312
  req = self._build_request(
@@ -278,9 +321,17 @@ class APIKeys(BaseSDK):
278
321
  user_agent_header="user-agent",
279
322
  accept_header_value="application/json",
280
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
+ ),
281
328
  security=self.sdk_configuration.security,
282
329
  get_serialized_body=lambda: utils.serialize_request_body(
283
- request, False, False, "json", operations.CreateKeysRequest
330
+ request.request_body,
331
+ False,
332
+ False,
333
+ "json",
334
+ operations.CreateKeysRequestBody,
284
335
  ),
285
336
  allow_empty_value=None,
286
337
  timeout_ms=timeout_ms,
@@ -349,6 +400,8 @@ class APIKeys(BaseSDK):
349
400
  self,
350
401
  *,
351
402
  name: str,
403
+ http_referer: Optional[str] = None,
404
+ x_title: Optional[str] = None,
352
405
  limit: OptionalNullable[float] = UNSET,
353
406
  limit_reset: OptionalNullable[operations.CreateKeysLimitReset] = UNSET,
354
407
  include_byok_in_limit: Optional[bool] = None,
@@ -360,7 +413,14 @@ class APIKeys(BaseSDK):
360
413
  ) -> operations.CreateKeysResponse:
361
414
  r"""Create a new API key
362
415
 
416
+ Create a new API key for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
417
+
363
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
+
364
424
  :param limit: Optional spending limit for the API key in USD
365
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.
366
426
  :param include_byok_in_limit: Whether to include BYOK usage in the limit
@@ -381,11 +441,15 @@ class APIKeys(BaseSDK):
381
441
  base_url = self._get_url(base_url, url_variables)
382
442
 
383
443
  request = operations.CreateKeysRequest(
384
- name=name,
385
- limit=limit,
386
- limit_reset=limit_reset,
387
- include_byok_in_limit=include_byok_in_limit,
388
- 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
+ ),
389
453
  )
390
454
 
391
455
  req = self._build_request_async(
@@ -400,9 +464,17 @@ class APIKeys(BaseSDK):
400
464
  user_agent_header="user-agent",
401
465
  accept_header_value="application/json",
402
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
+ ),
403
471
  security=self.sdk_configuration.security,
404
472
  get_serialized_body=lambda: utils.serialize_request_body(
405
- request, False, False, "json", operations.CreateKeysRequest
473
+ request.request_body,
474
+ False,
475
+ False,
476
+ "json",
477
+ operations.CreateKeysRequestBody,
406
478
  ),
407
479
  allow_empty_value=None,
408
480
  timeout_ms=timeout_ms,
@@ -471,6 +543,8 @@ class APIKeys(BaseSDK):
471
543
  self,
472
544
  *,
473
545
  hash: str,
546
+ http_referer: Optional[str] = None,
547
+ x_title: Optional[str] = None,
474
548
  name: Optional[str] = None,
475
549
  disabled: Optional[bool] = None,
476
550
  limit: OptionalNullable[float] = UNSET,
@@ -483,7 +557,14 @@ class APIKeys(BaseSDK):
483
557
  ) -> operations.UpdateKeysResponse:
484
558
  r"""Update an API key
485
559
 
560
+ Update an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required.
561
+
486
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
+
487
568
  :param name: New name for the API key
488
569
  :param disabled: Whether to disable the API key
489
570
  :param limit: New spending limit for the API key in USD
@@ -505,6 +586,8 @@ class APIKeys(BaseSDK):
505
586
  base_url = self._get_url(base_url, url_variables)
506
587
 
507
588
  request = operations.UpdateKeysRequest(
589
+ http_referer=http_referer,
590
+ x_title=x_title,
508
591
  hash=hash,
509
592
  request_body=operations.UpdateKeysRequestBody(
510
593
  name=name,
@@ -527,6 +610,10 @@ class APIKeys(BaseSDK):
527
610
  user_agent_header="user-agent",
528
611
  accept_header_value="application/json",
529
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
+ ),
530
617
  security=self.sdk_configuration.security,
531
618
  get_serialized_body=lambda: utils.serialize_request_body(
532
619
  request.request_body,
@@ -607,6 +694,8 @@ class APIKeys(BaseSDK):
607
694
  self,
608
695
  *,
609
696
  hash: str,
697
+ http_referer: Optional[str] = None,
698
+ x_title: Optional[str] = None,
610
699
  name: Optional[str] = None,
611
700
  disabled: Optional[bool] = None,
612
701
  limit: OptionalNullable[float] = UNSET,
@@ -619,7 +708,14 @@ class APIKeys(BaseSDK):
619
708
  ) -> operations.UpdateKeysResponse:
620
709
  r"""Update an API key
621
710
 
711
+ Update an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required.
712
+
622
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
+
623
719
  :param name: New name for the API key
624
720
  :param disabled: Whether to disable the API key
625
721
  :param limit: New spending limit for the API key in USD
@@ -641,6 +737,8 @@ class APIKeys(BaseSDK):
641
737
  base_url = self._get_url(base_url, url_variables)
642
738
 
643
739
  request = operations.UpdateKeysRequest(
740
+ http_referer=http_referer,
741
+ x_title=x_title,
644
742
  hash=hash,
645
743
  request_body=operations.UpdateKeysRequestBody(
646
744
  name=name,
@@ -663,6 +761,10 @@ class APIKeys(BaseSDK):
663
761
  user_agent_header="user-agent",
664
762
  accept_header_value="application/json",
665
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
+ ),
666
768
  security=self.sdk_configuration.security,
667
769
  get_serialized_body=lambda: utils.serialize_request_body(
668
770
  request.request_body,
@@ -743,6 +845,8 @@ class APIKeys(BaseSDK):
743
845
  self,
744
846
  *,
745
847
  hash: str,
848
+ http_referer: Optional[str] = None,
849
+ x_title: Optional[str] = None,
746
850
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
747
851
  server_url: Optional[str] = None,
748
852
  timeout_ms: Optional[int] = None,
@@ -750,7 +854,14 @@ class APIKeys(BaseSDK):
750
854
  ) -> operations.DeleteKeysResponse:
751
855
  r"""Delete an API key
752
856
 
857
+ Delete an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required.
858
+
753
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
+
754
865
  :param retries: Override the default retry configuration for this method
755
866
  :param server_url: Override the default server URL for this method
756
867
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -767,6 +878,8 @@ class APIKeys(BaseSDK):
767
878
  base_url = self._get_url(base_url, url_variables)
768
879
 
769
880
  request = operations.DeleteKeysRequest(
881
+ http_referer=http_referer,
882
+ x_title=x_title,
770
883
  hash=hash,
771
884
  )
772
885
 
@@ -782,6 +895,10 @@ class APIKeys(BaseSDK):
782
895
  user_agent_header="user-agent",
783
896
  accept_header_value="application/json",
784
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
+ ),
785
902
  security=self.sdk_configuration.security,
786
903
  allow_empty_value=None,
787
904
  timeout_ms=timeout_ms,
@@ -850,6 +967,8 @@ class APIKeys(BaseSDK):
850
967
  self,
851
968
  *,
852
969
  hash: str,
970
+ http_referer: Optional[str] = None,
971
+ x_title: Optional[str] = None,
853
972
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
854
973
  server_url: Optional[str] = None,
855
974
  timeout_ms: Optional[int] = None,
@@ -857,7 +976,14 @@ class APIKeys(BaseSDK):
857
976
  ) -> operations.DeleteKeysResponse:
858
977
  r"""Delete an API key
859
978
 
979
+ Delete an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required.
980
+
860
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
+
861
987
  :param retries: Override the default retry configuration for this method
862
988
  :param server_url: Override the default server URL for this method
863
989
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -874,6 +1000,8 @@ class APIKeys(BaseSDK):
874
1000
  base_url = self._get_url(base_url, url_variables)
875
1001
 
876
1002
  request = operations.DeleteKeysRequest(
1003
+ http_referer=http_referer,
1004
+ x_title=x_title,
877
1005
  hash=hash,
878
1006
  )
879
1007
 
@@ -889,6 +1017,10 @@ class APIKeys(BaseSDK):
889
1017
  user_agent_header="user-agent",
890
1018
  accept_header_value="application/json",
891
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
+ ),
892
1024
  security=self.sdk_configuration.security,
893
1025
  allow_empty_value=None,
894
1026
  timeout_ms=timeout_ms,
@@ -957,6 +1089,8 @@ class APIKeys(BaseSDK):
957
1089
  self,
958
1090
  *,
959
1091
  hash: str,
1092
+ http_referer: Optional[str] = None,
1093
+ x_title: Optional[str] = None,
960
1094
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
961
1095
  server_url: Optional[str] = None,
962
1096
  timeout_ms: Optional[int] = None,
@@ -964,7 +1098,14 @@ class APIKeys(BaseSDK):
964
1098
  ) -> operations.GetKeyResponse:
965
1099
  r"""Get a single API key
966
1100
 
1101
+ Get a single API key by hash. [Management key](/docs/guides/overview/auth/management-api-keys) required.
1102
+
967
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
+
968
1109
  :param retries: Override the default retry configuration for this method
969
1110
  :param server_url: Override the default server URL for this method
970
1111
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -981,6 +1122,8 @@ class APIKeys(BaseSDK):
981
1122
  base_url = self._get_url(base_url, url_variables)
982
1123
 
983
1124
  request = operations.GetKeyRequest(
1125
+ http_referer=http_referer,
1126
+ x_title=x_title,
984
1127
  hash=hash,
985
1128
  )
986
1129
 
@@ -996,6 +1139,10 @@ class APIKeys(BaseSDK):
996
1139
  user_agent_header="user-agent",
997
1140
  accept_header_value="application/json",
998
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
+ ),
999
1146
  security=self.sdk_configuration.security,
1000
1147
  allow_empty_value=None,
1001
1148
  timeout_ms=timeout_ms,
@@ -1064,6 +1211,8 @@ class APIKeys(BaseSDK):
1064
1211
  self,
1065
1212
  *,
1066
1213
  hash: str,
1214
+ http_referer: Optional[str] = None,
1215
+ x_title: Optional[str] = None,
1067
1216
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
1068
1217
  server_url: Optional[str] = None,
1069
1218
  timeout_ms: Optional[int] = None,
@@ -1071,7 +1220,14 @@ class APIKeys(BaseSDK):
1071
1220
  ) -> operations.GetKeyResponse:
1072
1221
  r"""Get a single API key
1073
1222
 
1223
+ Get a single API key by hash. [Management key](/docs/guides/overview/auth/management-api-keys) required.
1224
+
1074
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
+
1075
1231
  :param retries: Override the default retry configuration for this method
1076
1232
  :param server_url: Override the default server URL for this method
1077
1233
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -1088,6 +1244,8 @@ class APIKeys(BaseSDK):
1088
1244
  base_url = self._get_url(base_url, url_variables)
1089
1245
 
1090
1246
  request = operations.GetKeyRequest(
1247
+ http_referer=http_referer,
1248
+ x_title=x_title,
1091
1249
  hash=hash,
1092
1250
  )
1093
1251
 
@@ -1103,6 +1261,10 @@ class APIKeys(BaseSDK):
1103
1261
  user_agent_header="user-agent",
1104
1262
  accept_header_value="application/json",
1105
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
+ ),
1106
1268
  security=self.sdk_configuration.security,
1107
1269
  allow_empty_value=None,
1108
1270
  timeout_ms=timeout_ms,
@@ -1170,6 +1332,8 @@ class APIKeys(BaseSDK):
1170
1332
  def get_current_key_metadata(
1171
1333
  self,
1172
1334
  *,
1335
+ http_referer: Optional[str] = None,
1336
+ x_title: Optional[str] = None,
1173
1337
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
1174
1338
  server_url: Optional[str] = None,
1175
1339
  timeout_ms: Optional[int] = None,
@@ -1179,6 +1343,11 @@ class APIKeys(BaseSDK):
1179
1343
 
1180
1344
  Get information on the API key associated with the current authentication session
1181
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
+
1182
1351
  :param retries: Override the default retry configuration for this method
1183
1352
  :param server_url: Override the default server URL for this method
1184
1353
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -1193,18 +1362,28 @@ class APIKeys(BaseSDK):
1193
1362
  base_url = server_url
1194
1363
  else:
1195
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
+
1196
1371
  req = self._build_request(
1197
1372
  method="GET",
1198
1373
  path="/key",
1199
1374
  base_url=base_url,
1200
1375
  url_variables=url_variables,
1201
- request=None,
1376
+ request=request,
1202
1377
  request_body_required=False,
1203
1378
  request_has_path_params=False,
1204
1379
  request_has_query_params=True,
1205
1380
  user_agent_header="user-agent",
1206
1381
  accept_header_value="application/json",
1207
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
+ ),
1208
1387
  security=self.sdk_configuration.security,
1209
1388
  allow_empty_value=None,
1210
1389
  timeout_ms=timeout_ms,
@@ -1262,6 +1441,8 @@ class APIKeys(BaseSDK):
1262
1441
  async def get_current_key_metadata_async(
1263
1442
  self,
1264
1443
  *,
1444
+ http_referer: Optional[str] = None,
1445
+ x_title: Optional[str] = None,
1265
1446
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
1266
1447
  server_url: Optional[str] = None,
1267
1448
  timeout_ms: Optional[int] = None,
@@ -1271,6 +1452,11 @@ class APIKeys(BaseSDK):
1271
1452
 
1272
1453
  Get information on the API key associated with the current authentication session
1273
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
+
1274
1460
  :param retries: Override the default retry configuration for this method
1275
1461
  :param server_url: Override the default server URL for this method
1276
1462
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -1285,18 +1471,28 @@ class APIKeys(BaseSDK):
1285
1471
  base_url = server_url
1286
1472
  else:
1287
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
+
1288
1480
  req = self._build_request_async(
1289
1481
  method="GET",
1290
1482
  path="/key",
1291
1483
  base_url=base_url,
1292
1484
  url_variables=url_variables,
1293
- request=None,
1485
+ request=request,
1294
1486
  request_body_required=False,
1295
1487
  request_has_path_params=False,
1296
1488
  request_has_query_params=True,
1297
1489
  user_agent_header="user-agent",
1298
1490
  accept_header_value="application/json",
1299
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
+ ),
1300
1496
  security=self.sdk_configuration.security,
1301
1497
  allow_empty_value=None,
1302
1498
  timeout_ms=timeout_ms,