openrouter 0.0.19__py3-none-any.whl → 0.0.21__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 (57) hide show
  1. openrouter/_version.py +3 -3
  2. openrouter/analytics.py +2 -0
  3. openrouter/api_keys.py +24 -4
  4. openrouter/basesdk.py +6 -0
  5. openrouter/chat.py +16 -0
  6. openrouter/completions.py +2 -0
  7. openrouter/components/__init__.py +32 -13
  8. openrouter/components/chatcompletionfinishreason.py +17 -0
  9. openrouter/components/chatgenerationparams.py +22 -10
  10. openrouter/components/chatmessagecontentitem.py +1 -1
  11. openrouter/components/chatmessagecontentitemaudio.py +6 -25
  12. openrouter/components/chatmessagecontentitemcachecontrol.py +32 -0
  13. openrouter/components/chatmessagecontentitemtext.py +9 -2
  14. openrouter/components/chatmessagecontentitemvideo.py +9 -5
  15. openrouter/components/chatresponsechoice.py +1 -67
  16. openrouter/components/chatstreamingchoice.py +72 -0
  17. openrouter/components/chatstreamingresponsechunk.py +1 -1
  18. openrouter/components/completionchoice.py +18 -5
  19. openrouter/components/completioncreateparams.py +10 -10
  20. openrouter/components/completionresponse.py +3 -0
  21. openrouter/components/message.py +10 -9
  22. openrouter/components/openairesponsesannotation.py +11 -4
  23. openrouter/components/openresponsesnonstreamingresponse.py +13 -10
  24. openrouter/components/openresponsesrequest.py +55 -31
  25. openrouter/components/openresponsesstreamevent.py +110 -39
  26. openrouter/components/outputmessage.py +10 -4
  27. openrouter/components/providername.py +6 -1
  28. openrouter/components/responseformattextconfig.py +9 -7
  29. openrouter/components/responsesoutputitem.py +12 -10
  30. openrouter/components/responsesoutputmessage.py +10 -5
  31. openrouter/credits.py +4 -0
  32. openrouter/embeddings.py +4 -0
  33. openrouter/endpoints.py +4 -0
  34. openrouter/generations.py +2 -0
  35. openrouter/models/__init__.py +3 -0
  36. openrouter/models/internal/__init__.py +54 -0
  37. openrouter/models/internal/globals.py +41 -0
  38. openrouter/models_.py +6 -0
  39. openrouter/oauth.py +4 -0
  40. openrouter/operations/__init__.py +10 -1
  41. openrouter/operations/createembeddings.py +9 -3
  42. openrouter/operations/getcredits.py +19 -0
  43. openrouter/operations/getparameters.py +6 -1
  44. openrouter/operations/updatekeys.py +2 -2
  45. openrouter/parameters.py +2 -0
  46. openrouter/providers.py +2 -0
  47. openrouter/responses.py +22 -20
  48. openrouter/sdk.py +13 -0
  49. openrouter/sdkconfiguration.py +2 -0
  50. openrouter/utils/forms.py +21 -10
  51. openrouter/utils/queryparams.py +14 -2
  52. openrouter/utils/retries.py +69 -5
  53. {openrouter-0.0.19.dist-info → openrouter-0.0.21.dist-info}/METADATA +1 -1
  54. {openrouter-0.0.19.dist-info → openrouter-0.0.21.dist-info}/RECORD +57 -51
  55. {openrouter-0.0.19.dist-info → openrouter-0.0.21.dist-info}/WHEEL +0 -0
  56. {openrouter-0.0.19.dist-info → openrouter-0.0.21.dist-info}/licenses/LICENSE +0 -0
  57. {openrouter-0.0.19.dist-info → openrouter-0.0.21.dist-info}/top_level.txt +0 -0
openrouter/_version.py CHANGED
@@ -3,10 +3,10 @@
3
3
  import importlib.metadata
4
4
 
5
5
  __title__: str = "openrouter"
6
- __version__: str = "0.0.19"
6
+ __version__: str = "0.0.21"
7
7
  __openapi_doc_version__: str = "1.0.0"
8
- __gen_version__: str = "2.755.9"
9
- __user_agent__: str = "speakeasy-sdk/python 0.0.19 2.755.9 1.0.0 openrouter"
8
+ __gen_version__: str = "2.768.0"
9
+ __user_agent__: str = "speakeasy-sdk/python 0.0.21 2.768.0 1.0.0 openrouter"
10
10
 
11
11
  try:
12
12
  if __package__ is not None:
openrouter/analytics.py CHANGED
@@ -58,6 +58,7 @@ class Analytics(BaseSDK):
58
58
  accept_header_value="application/json",
59
59
  http_headers=http_headers,
60
60
  security=self.sdk_configuration.security,
61
+ allow_empty_value=None,
61
62
  timeout_ms=timeout_ms,
62
63
  )
63
64
 
@@ -166,6 +167,7 @@ class Analytics(BaseSDK):
166
167
  accept_header_value="application/json",
167
168
  http_headers=http_headers,
168
169
  security=self.sdk_configuration.security,
170
+ allow_empty_value=None,
169
171
  timeout_ms=timeout_ms,
170
172
  )
171
173
 
openrouter/api_keys.py CHANGED
@@ -60,6 +60,7 @@ class APIKeys(BaseSDK):
60
60
  accept_header_value="application/json",
61
61
  http_headers=http_headers,
62
62
  security=self.sdk_configuration.security,
63
+ allow_empty_value=None,
63
64
  timeout_ms=timeout_ms,
64
65
  )
65
66
 
@@ -164,6 +165,7 @@ class APIKeys(BaseSDK):
164
165
  accept_header_value="application/json",
165
166
  http_headers=http_headers,
166
167
  security=self.sdk_configuration.security,
168
+ allow_empty_value=None,
167
169
  timeout_ms=timeout_ms,
168
170
  )
169
171
 
@@ -280,6 +282,7 @@ class APIKeys(BaseSDK):
280
282
  get_serialized_body=lambda: utils.serialize_request_body(
281
283
  request, False, False, "json", operations.CreateKeysRequest
282
284
  ),
285
+ allow_empty_value=None,
283
286
  timeout_ms=timeout_ms,
284
287
  )
285
288
 
@@ -401,6 +404,7 @@ class APIKeys(BaseSDK):
401
404
  get_serialized_body=lambda: utils.serialize_request_body(
402
405
  request, False, False, "json", operations.CreateKeysRequest
403
406
  ),
407
+ allow_empty_value=None,
404
408
  timeout_ms=timeout_ms,
405
409
  )
406
410
 
@@ -502,7 +506,7 @@ class APIKeys(BaseSDK):
502
506
 
503
507
  request = operations.UpdateKeysRequest(
504
508
  hash=hash,
505
- body=operations.UpdateKeysRequestBody(
509
+ request_body=operations.UpdateKeysRequestBody(
506
510
  name=name,
507
511
  disabled=disabled,
508
512
  limit=limit,
@@ -525,8 +529,13 @@ class APIKeys(BaseSDK):
525
529
  http_headers=http_headers,
526
530
  security=self.sdk_configuration.security,
527
531
  get_serialized_body=lambda: utils.serialize_request_body(
528
- request.body, False, False, "json", operations.UpdateKeysRequestBody
532
+ request.request_body,
533
+ False,
534
+ False,
535
+ "json",
536
+ operations.UpdateKeysRequestBody,
529
537
  ),
538
+ allow_empty_value=None,
530
539
  timeout_ms=timeout_ms,
531
540
  )
532
541
 
@@ -633,7 +642,7 @@ class APIKeys(BaseSDK):
633
642
 
634
643
  request = operations.UpdateKeysRequest(
635
644
  hash=hash,
636
- body=operations.UpdateKeysRequestBody(
645
+ request_body=operations.UpdateKeysRequestBody(
637
646
  name=name,
638
647
  disabled=disabled,
639
648
  limit=limit,
@@ -656,8 +665,13 @@ class APIKeys(BaseSDK):
656
665
  http_headers=http_headers,
657
666
  security=self.sdk_configuration.security,
658
667
  get_serialized_body=lambda: utils.serialize_request_body(
659
- request.body, False, False, "json", operations.UpdateKeysRequestBody
668
+ request.request_body,
669
+ False,
670
+ False,
671
+ "json",
672
+ operations.UpdateKeysRequestBody,
660
673
  ),
674
+ allow_empty_value=None,
661
675
  timeout_ms=timeout_ms,
662
676
  )
663
677
 
@@ -769,6 +783,7 @@ class APIKeys(BaseSDK):
769
783
  accept_header_value="application/json",
770
784
  http_headers=http_headers,
771
785
  security=self.sdk_configuration.security,
786
+ allow_empty_value=None,
772
787
  timeout_ms=timeout_ms,
773
788
  )
774
789
 
@@ -875,6 +890,7 @@ class APIKeys(BaseSDK):
875
890
  accept_header_value="application/json",
876
891
  http_headers=http_headers,
877
892
  security=self.sdk_configuration.security,
893
+ allow_empty_value=None,
878
894
  timeout_ms=timeout_ms,
879
895
  )
880
896
 
@@ -981,6 +997,7 @@ class APIKeys(BaseSDK):
981
997
  accept_header_value="application/json",
982
998
  http_headers=http_headers,
983
999
  security=self.sdk_configuration.security,
1000
+ allow_empty_value=None,
984
1001
  timeout_ms=timeout_ms,
985
1002
  )
986
1003
 
@@ -1087,6 +1104,7 @@ class APIKeys(BaseSDK):
1087
1104
  accept_header_value="application/json",
1088
1105
  http_headers=http_headers,
1089
1106
  security=self.sdk_configuration.security,
1107
+ allow_empty_value=None,
1090
1108
  timeout_ms=timeout_ms,
1091
1109
  )
1092
1110
 
@@ -1188,6 +1206,7 @@ class APIKeys(BaseSDK):
1188
1206
  accept_header_value="application/json",
1189
1207
  http_headers=http_headers,
1190
1208
  security=self.sdk_configuration.security,
1209
+ allow_empty_value=None,
1191
1210
  timeout_ms=timeout_ms,
1192
1211
  )
1193
1212
 
@@ -1279,6 +1298,7 @@ class APIKeys(BaseSDK):
1279
1298
  accept_header_value="application/json",
1280
1299
  http_headers=http_headers,
1281
1300
  security=self.sdk_configuration.security,
1301
+ allow_empty_value=None,
1282
1302
  timeout_ms=timeout_ms,
1283
1303
  )
1284
1304
 
openrouter/basesdk.py CHANGED
@@ -60,6 +60,7 @@ class BaseSDK:
60
60
  ] = None,
61
61
  url_override: Optional[str] = None,
62
62
  http_headers: Optional[Mapping[str, str]] = None,
63
+ allow_empty_value: Optional[List[str]] = None,
63
64
  ) -> httpx.Request:
64
65
  client = self.sdk_configuration.async_client
65
66
  return self._build_request_with_client(
@@ -80,6 +81,7 @@ class BaseSDK:
80
81
  get_serialized_body,
81
82
  url_override,
82
83
  http_headers,
84
+ allow_empty_value,
83
85
  )
84
86
 
85
87
  def _build_request(
@@ -102,6 +104,7 @@ class BaseSDK:
102
104
  ] = None,
103
105
  url_override: Optional[str] = None,
104
106
  http_headers: Optional[Mapping[str, str]] = None,
107
+ allow_empty_value: Optional[List[str]] = None,
105
108
  ) -> httpx.Request:
106
109
  client = self.sdk_configuration.client
107
110
  return self._build_request_with_client(
@@ -122,6 +125,7 @@ class BaseSDK:
122
125
  get_serialized_body,
123
126
  url_override,
124
127
  http_headers,
128
+ allow_empty_value,
125
129
  )
126
130
 
127
131
  def _build_request_with_client(
@@ -145,6 +149,7 @@ class BaseSDK:
145
149
  ] = None,
146
150
  url_override: Optional[str] = None,
147
151
  http_headers: Optional[Mapping[str, str]] = None,
152
+ allow_empty_value: Optional[List[str]] = None,
148
153
  ) -> httpx.Request:
149
154
  query_params = {}
150
155
 
@@ -160,6 +165,7 @@ class BaseSDK:
160
165
  query_params = utils.get_query_params(
161
166
  request if request_has_query_params else None,
162
167
  _globals if request_has_query_params else None,
168
+ allow_empty_value,
163
169
  )
164
170
  else:
165
171
  # Pick up the query parameter from the override so they can be
openrouter/chat.py CHANGED
@@ -61,6 +61,7 @@ class Chat(BaseSDK):
61
61
  ] = None,
62
62
  top_p: OptionalNullable[float] = UNSET,
63
63
  user: Optional[str] = None,
64
+ debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
64
65
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
65
66
  server_url: Optional[str] = None,
66
67
  timeout_ms: Optional[int] = None,
@@ -92,6 +93,7 @@ class Chat(BaseSDK):
92
93
  :param tools:
93
94
  :param top_p:
94
95
  :param user:
96
+ :param debug:
95
97
  :param retries: Override the default retry configuration for this method
96
98
  :param server_url: Override the default server URL for this method
97
99
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -144,6 +146,7 @@ class Chat(BaseSDK):
144
146
  ] = None,
145
147
  top_p: OptionalNullable[float] = UNSET,
146
148
  user: Optional[str] = None,
149
+ debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
147
150
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
148
151
  server_url: Optional[str] = None,
149
152
  timeout_ms: Optional[int] = None,
@@ -175,6 +178,7 @@ class Chat(BaseSDK):
175
178
  :param tools:
176
179
  :param top_p:
177
180
  :param user:
181
+ :param debug:
178
182
  :param retries: Override the default retry configuration for this method
179
183
  :param server_url: Override the default server URL for this method
180
184
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -226,6 +230,7 @@ class Chat(BaseSDK):
226
230
  ] = None,
227
231
  top_p: OptionalNullable[float] = UNSET,
228
232
  user: Optional[str] = None,
233
+ debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
229
234
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
230
235
  server_url: Optional[str] = None,
231
236
  timeout_ms: Optional[int] = None,
@@ -257,6 +262,7 @@ class Chat(BaseSDK):
257
262
  :param tools:
258
263
  :param top_p:
259
264
  :param user:
265
+ :param debug:
260
266
  :param retries: Override the default retry configuration for this method
261
267
  :param server_url: Override the default server URL for this method
262
268
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -305,6 +311,7 @@ class Chat(BaseSDK):
305
311
  ),
306
312
  top_p=top_p,
307
313
  user=user,
314
+ debug=utils.get_pydantic_model(debug, Optional[components.Debug]),
308
315
  )
309
316
 
310
317
  req = self._build_request(
@@ -323,6 +330,7 @@ class Chat(BaseSDK):
323
330
  get_serialized_body=lambda: utils.serialize_request_body(
324
331
  request, False, False, "json", components.ChatGenerationParams
325
332
  ),
333
+ allow_empty_value=None,
326
334
  timeout_ms=timeout_ms,
327
335
  )
328
336
 
@@ -438,6 +446,7 @@ class Chat(BaseSDK):
438
446
  ] = None,
439
447
  top_p: OptionalNullable[float] = UNSET,
440
448
  user: Optional[str] = None,
449
+ debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
441
450
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
442
451
  server_url: Optional[str] = None,
443
452
  timeout_ms: Optional[int] = None,
@@ -469,6 +478,7 @@ class Chat(BaseSDK):
469
478
  :param tools:
470
479
  :param top_p:
471
480
  :param user:
481
+ :param debug:
472
482
  :param retries: Override the default retry configuration for this method
473
483
  :param server_url: Override the default server URL for this method
474
484
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -521,6 +531,7 @@ class Chat(BaseSDK):
521
531
  ] = None,
522
532
  top_p: OptionalNullable[float] = UNSET,
523
533
  user: Optional[str] = None,
534
+ debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
524
535
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
525
536
  server_url: Optional[str] = None,
526
537
  timeout_ms: Optional[int] = None,
@@ -552,6 +563,7 @@ class Chat(BaseSDK):
552
563
  :param tools:
553
564
  :param top_p:
554
565
  :param user:
566
+ :param debug:
555
567
  :param retries: Override the default retry configuration for this method
556
568
  :param server_url: Override the default server URL for this method
557
569
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -603,6 +615,7 @@ class Chat(BaseSDK):
603
615
  ] = None,
604
616
  top_p: OptionalNullable[float] = UNSET,
605
617
  user: Optional[str] = None,
618
+ debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
606
619
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
607
620
  server_url: Optional[str] = None,
608
621
  timeout_ms: Optional[int] = None,
@@ -634,6 +647,7 @@ class Chat(BaseSDK):
634
647
  :param tools:
635
648
  :param top_p:
636
649
  :param user:
650
+ :param debug:
637
651
  :param retries: Override the default retry configuration for this method
638
652
  :param server_url: Override the default server URL for this method
639
653
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -682,6 +696,7 @@ class Chat(BaseSDK):
682
696
  ),
683
697
  top_p=top_p,
684
698
  user=user,
699
+ debug=utils.get_pydantic_model(debug, Optional[components.Debug]),
685
700
  )
686
701
 
687
702
  req = self._build_request_async(
@@ -700,6 +715,7 @@ class Chat(BaseSDK):
700
715
  get_serialized_body=lambda: utils.serialize_request_body(
701
716
  request, False, False, "json", components.ChatGenerationParams
702
717
  ),
718
+ allow_empty_value=None,
703
719
  timeout_ms=timeout_ms,
704
720
  )
705
721
 
openrouter/completions.py CHANGED
@@ -136,6 +136,7 @@ class Completions(BaseSDK):
136
136
  get_serialized_body=lambda: utils.serialize_request_body(
137
137
  request, False, False, "json", components.CompletionCreateParams
138
138
  ),
139
+ allow_empty_value=None,
139
140
  timeout_ms=timeout_ms,
140
141
  )
141
142
 
@@ -310,6 +311,7 @@ class Completions(BaseSDK):
310
311
  get_serialized_body=lambda: utils.serialize_request_body(
311
312
  request, False, False, "json", components.CompletionCreateParams
312
313
  ),
314
+ allow_empty_value=None,
313
315
  timeout_ms=timeout_ms,
314
316
  )
315
317
 
@@ -21,6 +21,7 @@ if TYPE_CHECKING:
21
21
  BadRequestResponseErrorData,
22
22
  BadRequestResponseErrorDataTypedDict,
23
23
  )
24
+ from .chatcompletionfinishreason import ChatCompletionFinishReason
24
25
  from .chaterror import ChatErrorError, ChatErrorErrorTypedDict, Code, CodeTypedDict
25
26
  from .chatgenerationparams import (
26
27
  ChatGenerationParams,
@@ -35,6 +36,8 @@ if TYPE_CHECKING:
35
36
  ChatGenerationParamsStop,
36
37
  ChatGenerationParamsStopTypedDict,
37
38
  ChatGenerationParamsTypedDict,
39
+ Debug,
40
+ DebugTypedDict,
38
41
  Effort,
39
42
  Reasoning,
40
43
  ReasoningTypedDict,
@@ -53,11 +56,15 @@ if TYPE_CHECKING:
53
56
  )
54
57
  from .chatmessagecontentitemaudio import (
55
58
  ChatMessageContentItemAudio,
56
- ChatMessageContentItemAudioFormat,
57
59
  ChatMessageContentItemAudioInputAudio,
58
60
  ChatMessageContentItemAudioInputAudioTypedDict,
59
61
  ChatMessageContentItemAudioTypedDict,
60
62
  )
63
+ from .chatmessagecontentitemcachecontrol import (
64
+ ChatMessageContentItemCacheControl,
65
+ ChatMessageContentItemCacheControlTypedDict,
66
+ TTL,
67
+ )
61
68
  from .chatmessagecontentitemimage import (
62
69
  ChatMessageContentItemImage,
63
70
  ChatMessageContentItemImageDetail,
@@ -98,13 +105,8 @@ if TYPE_CHECKING:
98
105
  ChatMessageToolCallTypedDict,
99
106
  )
100
107
  from .chatresponse import ChatResponse, ChatResponseTypedDict
101
- from .chatresponsechoice import (
102
- ChatCompletionFinishReason,
103
- ChatResponseChoice,
104
- ChatResponseChoiceTypedDict,
105
- ChatStreamingChoice,
106
- ChatStreamingChoiceTypedDict,
107
- )
108
+ from .chatresponsechoice import ChatResponseChoice, ChatResponseChoiceTypedDict
109
+ from .chatstreamingchoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict
108
110
  from .chatstreamingmessagechunk import (
109
111
  ChatStreamingMessageChunk,
110
112
  ChatStreamingMessageChunkRole,
@@ -422,6 +424,7 @@ if TYPE_CHECKING:
422
424
  Engine,
423
425
  IDFileParser,
424
426
  IDModeration,
427
+ IDResponseHealing,
425
428
  IDWeb,
426
429
  Ignore,
427
430
  IgnoreTypedDict,
@@ -446,6 +449,8 @@ if TYPE_CHECKING:
446
449
  PluginFileParserTypedDict,
447
450
  PluginModeration,
448
451
  PluginModerationTypedDict,
452
+ PluginResponseHealing,
453
+ PluginResponseHealingTypedDict,
449
454
  PluginTypedDict,
450
455
  PluginWeb,
451
456
  PluginWebTypedDict,
@@ -820,10 +825,11 @@ __all__ = [
820
825
  "ChatGenerationTokenUsageTypedDict",
821
826
  "ChatMessageContentItem",
822
827
  "ChatMessageContentItemAudio",
823
- "ChatMessageContentItemAudioFormat",
824
828
  "ChatMessageContentItemAudioInputAudio",
825
829
  "ChatMessageContentItemAudioInputAudioTypedDict",
826
830
  "ChatMessageContentItemAudioTypedDict",
831
+ "ChatMessageContentItemCacheControl",
832
+ "ChatMessageContentItemCacheControlTypedDict",
827
833
  "ChatMessageContentItemImage",
828
834
  "ChatMessageContentItemImageDetail",
829
835
  "ChatMessageContentItemImageTypedDict",
@@ -896,6 +902,8 @@ __all__ = [
896
902
  "CreateChargeRequest",
897
903
  "CreateChargeRequestTypedDict",
898
904
  "DataCollection",
905
+ "Debug",
906
+ "DebugTypedDict",
899
907
  "DefaultParameters",
900
908
  "DefaultParametersTypedDict",
901
909
  "EdgeNetworkTimeoutResponseErrorData",
@@ -913,6 +921,7 @@ __all__ = [
913
921
  "ForbiddenResponseErrorDataTypedDict",
914
922
  "IDFileParser",
915
923
  "IDModeration",
924
+ "IDResponseHealing",
916
925
  "IDWeb",
917
926
  "Ignore",
918
927
  "IgnoreTypedDict",
@@ -1206,6 +1215,8 @@ __all__ = [
1206
1215
  "PluginFileParserTypedDict",
1207
1216
  "PluginModeration",
1208
1217
  "PluginModerationTypedDict",
1218
+ "PluginResponseHealing",
1219
+ "PluginResponseHealingTypedDict",
1209
1220
  "PluginTypedDict",
1210
1221
  "PluginWeb",
1211
1222
  "PluginWebTypedDict",
@@ -1331,6 +1342,7 @@ __all__ = [
1331
1342
  "SystemMessageContent",
1332
1343
  "SystemMessageContentTypedDict",
1333
1344
  "SystemMessageTypedDict",
1345
+ "TTL",
1334
1346
  "Tokenizer",
1335
1347
  "TooManyRequestsResponseErrorData",
1336
1348
  "TooManyRequestsResponseErrorDataTypedDict",
@@ -1401,6 +1413,7 @@ _dynamic_imports: dict[str, str] = {
1401
1413
  "BadGatewayResponseErrorDataTypedDict": ".badgatewayresponseerrordata",
1402
1414
  "BadRequestResponseErrorData": ".badrequestresponseerrordata",
1403
1415
  "BadRequestResponseErrorDataTypedDict": ".badrequestresponseerrordata",
1416
+ "ChatCompletionFinishReason": ".chatcompletionfinishreason",
1404
1417
  "ChatErrorError": ".chaterror",
1405
1418
  "ChatErrorErrorTypedDict": ".chaterror",
1406
1419
  "Code": ".chaterror",
@@ -1417,6 +1430,8 @@ _dynamic_imports: dict[str, str] = {
1417
1430
  "ChatGenerationParamsStop": ".chatgenerationparams",
1418
1431
  "ChatGenerationParamsStopTypedDict": ".chatgenerationparams",
1419
1432
  "ChatGenerationParamsTypedDict": ".chatgenerationparams",
1433
+ "Debug": ".chatgenerationparams",
1434
+ "DebugTypedDict": ".chatgenerationparams",
1420
1435
  "Effort": ".chatgenerationparams",
1421
1436
  "Reasoning": ".chatgenerationparams",
1422
1437
  "ReasoningTypedDict": ".chatgenerationparams",
@@ -1429,10 +1444,12 @@ _dynamic_imports: dict[str, str] = {
1429
1444
  "ChatMessageContentItem": ".chatmessagecontentitem",
1430
1445
  "ChatMessageContentItemTypedDict": ".chatmessagecontentitem",
1431
1446
  "ChatMessageContentItemAudio": ".chatmessagecontentitemaudio",
1432
- "ChatMessageContentItemAudioFormat": ".chatmessagecontentitemaudio",
1433
1447
  "ChatMessageContentItemAudioInputAudio": ".chatmessagecontentitemaudio",
1434
1448
  "ChatMessageContentItemAudioInputAudioTypedDict": ".chatmessagecontentitemaudio",
1435
1449
  "ChatMessageContentItemAudioTypedDict": ".chatmessagecontentitemaudio",
1450
+ "ChatMessageContentItemCacheControl": ".chatmessagecontentitemcachecontrol",
1451
+ "ChatMessageContentItemCacheControlTypedDict": ".chatmessagecontentitemcachecontrol",
1452
+ "TTL": ".chatmessagecontentitemcachecontrol",
1436
1453
  "ChatMessageContentItemImage": ".chatmessagecontentitemimage",
1437
1454
  "ChatMessageContentItemImageDetail": ".chatmessagecontentitemimage",
1438
1455
  "ChatMessageContentItemImageTypedDict": ".chatmessagecontentitemimage",
@@ -1462,11 +1479,10 @@ _dynamic_imports: dict[str, str] = {
1462
1479
  "ChatMessageToolCallTypedDict": ".chatmessagetoolcall",
1463
1480
  "ChatResponse": ".chatresponse",
1464
1481
  "ChatResponseTypedDict": ".chatresponse",
1465
- "ChatCompletionFinishReason": ".chatresponsechoice",
1466
1482
  "ChatResponseChoice": ".chatresponsechoice",
1467
1483
  "ChatResponseChoiceTypedDict": ".chatresponsechoice",
1468
- "ChatStreamingChoice": ".chatresponsechoice",
1469
- "ChatStreamingChoiceTypedDict": ".chatresponsechoice",
1484
+ "ChatStreamingChoice": ".chatstreamingchoice",
1485
+ "ChatStreamingChoiceTypedDict": ".chatstreamingchoice",
1470
1486
  "ChatStreamingMessageChunk": ".chatstreamingmessagechunk",
1471
1487
  "ChatStreamingMessageChunkRole": ".chatstreamingmessagechunk",
1472
1488
  "ChatStreamingMessageChunkTypedDict": ".chatstreamingmessagechunk",
@@ -1713,6 +1729,7 @@ _dynamic_imports: dict[str, str] = {
1713
1729
  "Engine": ".openresponsesrequest",
1714
1730
  "IDFileParser": ".openresponsesrequest",
1715
1731
  "IDModeration": ".openresponsesrequest",
1732
+ "IDResponseHealing": ".openresponsesrequest",
1716
1733
  "IDWeb": ".openresponsesrequest",
1717
1734
  "Ignore": ".openresponsesrequest",
1718
1735
  "IgnoreTypedDict": ".openresponsesrequest",
@@ -1737,6 +1754,8 @@ _dynamic_imports: dict[str, str] = {
1737
1754
  "PluginFileParserTypedDict": ".openresponsesrequest",
1738
1755
  "PluginModeration": ".openresponsesrequest",
1739
1756
  "PluginModerationTypedDict": ".openresponsesrequest",
1757
+ "PluginResponseHealing": ".openresponsesrequest",
1758
+ "PluginResponseHealingTypedDict": ".openresponsesrequest",
1740
1759
  "PluginTypedDict": ".openresponsesrequest",
1741
1760
  "PluginWeb": ".openresponsesrequest",
1742
1761
  "PluginWebTypedDict": ".openresponsesrequest",
@@ -0,0 +1,17 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from openrouter.types import UnrecognizedStr
5
+ from typing import Literal, Union
6
+
7
+
8
+ ChatCompletionFinishReason = Union[
9
+ Literal[
10
+ "tool_calls",
11
+ "stop",
12
+ "length",
13
+ "content_filter",
14
+ "error",
15
+ ],
16
+ UnrecognizedStr,
17
+ ]
@@ -21,9 +21,9 @@ from openrouter.types import (
21
21
  UNSET_SENTINEL,
22
22
  UnrecognizedStr,
23
23
  )
24
- from openrouter.utils import validate_const, validate_open_enum
24
+ from openrouter.utils import get_discriminator, validate_const, validate_open_enum
25
25
  import pydantic
26
- from pydantic import model_serializer
26
+ from pydantic import Discriminator, Tag, model_serializer
27
27
  from pydantic.functional_validators import AfterValidator, PlainValidator
28
28
  from typing import Any, Dict, List, Literal, Optional, Union
29
29
  from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
@@ -134,16 +134,16 @@ ChatGenerationParamsResponseFormatUnionTypedDict = TypeAliasType(
134
134
  )
135
135
 
136
136
 
137
- ChatGenerationParamsResponseFormatUnion = TypeAliasType(
138
- "ChatGenerationParamsResponseFormatUnion",
137
+ ChatGenerationParamsResponseFormatUnion = Annotated[
139
138
  Union[
140
- ChatGenerationParamsResponseFormatText,
141
- ChatGenerationParamsResponseFormatJSONObject,
142
- ChatGenerationParamsResponseFormatPython,
143
- ResponseFormatJSONSchema,
144
- ResponseFormatTextGrammar,
139
+ Annotated[ChatGenerationParamsResponseFormatText, Tag("text")],
140
+ Annotated[ChatGenerationParamsResponseFormatJSONObject, Tag("json_object")],
141
+ Annotated[ResponseFormatJSONSchema, Tag("json_schema")],
142
+ Annotated[ResponseFormatTextGrammar, Tag("grammar")],
143
+ Annotated[ChatGenerationParamsResponseFormatPython, Tag("python")],
145
144
  ],
146
- )
145
+ Discriminator(lambda m: get_discriminator(m, "type", "type")),
146
+ ]
147
147
 
148
148
 
149
149
  ChatGenerationParamsStopTypedDict = TypeAliasType(
@@ -156,6 +156,14 @@ ChatGenerationParamsStop = TypeAliasType(
156
156
  )
157
157
 
158
158
 
159
+ class DebugTypedDict(TypedDict):
160
+ echo_upstream_body: NotRequired[bool]
161
+
162
+
163
+ class Debug(BaseModel):
164
+ echo_upstream_body: Optional[bool] = None
165
+
166
+
159
167
  class ChatGenerationParamsTypedDict(TypedDict):
160
168
  messages: List[MessageTypedDict]
161
169
  model: NotRequired[str]
@@ -179,6 +187,7 @@ class ChatGenerationParamsTypedDict(TypedDict):
179
187
  tools: NotRequired[List[ToolDefinitionJSONTypedDict]]
180
188
  top_p: NotRequired[Nullable[float]]
181
189
  user: NotRequired[str]
190
+ debug: NotRequired[DebugTypedDict]
182
191
 
183
192
 
184
193
  class ChatGenerationParams(BaseModel):
@@ -226,6 +235,8 @@ class ChatGenerationParams(BaseModel):
226
235
 
227
236
  user: Optional[str] = None
228
237
 
238
+ debug: Optional[Debug] = None
239
+
229
240
  @model_serializer(mode="wrap")
230
241
  def serialize_model(self, handler):
231
242
  optional_fields = [
@@ -250,6 +261,7 @@ class ChatGenerationParams(BaseModel):
250
261
  "tools",
251
262
  "top_p",
252
263
  "user",
264
+ "debug",
253
265
  ]
254
266
  nullable_fields = [
255
267
  "frequency_penalty",
@@ -26,9 +26,9 @@ from typing_extensions import Annotated, TypeAliasType
26
26
  ChatMessageContentItemTypedDict = TypeAliasType(
27
27
  "ChatMessageContentItemTypedDict",
28
28
  Union[
29
- ChatMessageContentItemTextTypedDict,
30
29
  ChatMessageContentItemImageTypedDict,
31
30
  ChatMessageContentItemAudioTypedDict,
31
+ ChatMessageContentItemTextTypedDict,
32
32
  ChatMessageContentItemVideoTypedDict,
33
33
  ],
34
34
  )
@@ -1,42 +1,23 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from openrouter.types import BaseModel, UnrecognizedStr
5
- from openrouter.utils import validate_const, validate_open_enum
4
+ from openrouter.types import BaseModel
5
+ from openrouter.utils import validate_const
6
6
  import pydantic
7
- from pydantic.functional_validators import AfterValidator, PlainValidator
8
- from typing import Literal, Union
7
+ from pydantic.functional_validators import AfterValidator
8
+ from typing import Literal
9
9
  from typing_extensions import Annotated, TypedDict
10
10
 
11
11
 
12
- ChatMessageContentItemAudioFormat = Union[
13
- Literal[
14
- "wav",
15
- "mp3",
16
- "flac",
17
- "m4a",
18
- "ogg",
19
- "pcm16",
20
- "pcm24",
21
- ],
22
- UnrecognizedStr,
23
- ]
24
-
25
-
26
12
  class ChatMessageContentItemAudioInputAudioTypedDict(TypedDict):
27
13
  data: str
28
- format_: ChatMessageContentItemAudioFormat
14
+ format_: str
29
15
 
30
16
 
31
17
  class ChatMessageContentItemAudioInputAudio(BaseModel):
32
18
  data: str
33
19
 
34
- format_: Annotated[
35
- Annotated[
36
- ChatMessageContentItemAudioFormat, PlainValidator(validate_open_enum(False))
37
- ],
38
- pydantic.Field(alias="format"),
39
- ]
20
+ format_: Annotated[str, pydantic.Field(alias="format")]
40
21
 
41
22
 
42
23
  class ChatMessageContentItemAudioTypedDict(TypedDict):