openrouter 0.0.21__py3-none-any.whl → 0.0.22__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
openrouter/_version.py CHANGED
@@ -3,10 +3,10 @@
3
3
  import importlib.metadata
4
4
 
5
5
  __title__: str = "openrouter"
6
- __version__: str = "0.0.21"
6
+ __version__: str = "0.0.22"
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.0.21 2.768.0 1.0.0 openrouter"
9
+ __user_agent__: str = "speakeasy-sdk/python 0.0.22 2.768.0 1.0.0 openrouter"
10
10
 
11
11
  try:
12
12
  if __package__ is not None:
openrouter/chat.py CHANGED
@@ -21,6 +21,21 @@ class Chat(BaseSDK):
21
21
  self,
22
22
  *,
23
23
  messages: Union[List[components.Message], List[components.MessageTypedDict]],
24
+ provider: OptionalNullable[
25
+ Union[
26
+ components.ChatGenerationParamsProvider,
27
+ components.ChatGenerationParamsProviderTypedDict,
28
+ ]
29
+ ] = UNSET,
30
+ plugins: Optional[
31
+ Union[
32
+ List[components.ChatGenerationParamsPluginUnion],
33
+ List[components.ChatGenerationParamsPluginUnionTypedDict],
34
+ ]
35
+ ] = None,
36
+ route: OptionalNullable[components.ChatGenerationParamsRoute] = UNSET,
37
+ user: Optional[str] = None,
38
+ session_id: Optional[str] = None,
24
39
  model: Optional[str] = None,
25
40
  models: Optional[List[str]] = None,
26
41
  frequency_penalty: OptionalNullable[float] = UNSET,
@@ -60,7 +75,6 @@ class Chat(BaseSDK):
60
75
  ]
61
76
  ] = None,
62
77
  top_p: OptionalNullable[float] = UNSET,
63
- user: Optional[str] = None,
64
78
  debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
65
79
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
66
80
  server_url: Optional[str] = None,
@@ -72,6 +86,11 @@ class Chat(BaseSDK):
72
86
  Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
73
87
 
74
88
  :param messages:
89
+ :param provider: When multiple model providers are available, optionally indicate your routing preference.
90
+ :param plugins: Plugins you want to enable for this request, including their settings.
91
+ :param route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
92
+ :param user:
93
+ :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
75
94
  :param model:
76
95
  :param models:
77
96
  :param frequency_penalty:
@@ -92,7 +111,6 @@ class Chat(BaseSDK):
92
111
  :param tool_choice:
93
112
  :param tools:
94
113
  :param top_p:
95
- :param user:
96
114
  :param debug:
97
115
  :param retries: Override the default retry configuration for this method
98
116
  :param server_url: Override the default server URL for this method
@@ -106,6 +124,21 @@ class Chat(BaseSDK):
106
124
  self,
107
125
  *,
108
126
  messages: Union[List[components.Message], List[components.MessageTypedDict]],
127
+ provider: OptionalNullable[
128
+ Union[
129
+ components.ChatGenerationParamsProvider,
130
+ components.ChatGenerationParamsProviderTypedDict,
131
+ ]
132
+ ] = UNSET,
133
+ plugins: Optional[
134
+ Union[
135
+ List[components.ChatGenerationParamsPluginUnion],
136
+ List[components.ChatGenerationParamsPluginUnionTypedDict],
137
+ ]
138
+ ] = None,
139
+ route: OptionalNullable[components.ChatGenerationParamsRoute] = UNSET,
140
+ user: Optional[str] = None,
141
+ session_id: Optional[str] = None,
109
142
  model: Optional[str] = None,
110
143
  models: Optional[List[str]] = None,
111
144
  frequency_penalty: OptionalNullable[float] = UNSET,
@@ -145,7 +178,6 @@ class Chat(BaseSDK):
145
178
  ]
146
179
  ] = None,
147
180
  top_p: OptionalNullable[float] = UNSET,
148
- user: Optional[str] = None,
149
181
  debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
150
182
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
151
183
  server_url: Optional[str] = None,
@@ -157,6 +189,11 @@ class Chat(BaseSDK):
157
189
  Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
158
190
 
159
191
  :param messages:
192
+ :param provider: When multiple model providers are available, optionally indicate your routing preference.
193
+ :param plugins: Plugins you want to enable for this request, including their settings.
194
+ :param route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
195
+ :param user:
196
+ :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
160
197
  :param model:
161
198
  :param models:
162
199
  :param frequency_penalty:
@@ -177,7 +214,6 @@ class Chat(BaseSDK):
177
214
  :param tool_choice:
178
215
  :param tools:
179
216
  :param top_p:
180
- :param user:
181
217
  :param debug:
182
218
  :param retries: Override the default retry configuration for this method
183
219
  :param server_url: Override the default server URL for this method
@@ -190,6 +226,21 @@ class Chat(BaseSDK):
190
226
  self,
191
227
  *,
192
228
  messages: Union[List[components.Message], List[components.MessageTypedDict]],
229
+ provider: OptionalNullable[
230
+ Union[
231
+ components.ChatGenerationParamsProvider,
232
+ components.ChatGenerationParamsProviderTypedDict,
233
+ ]
234
+ ] = UNSET,
235
+ plugins: Optional[
236
+ Union[
237
+ List[components.ChatGenerationParamsPluginUnion],
238
+ List[components.ChatGenerationParamsPluginUnionTypedDict],
239
+ ]
240
+ ] = None,
241
+ route: OptionalNullable[components.ChatGenerationParamsRoute] = UNSET,
242
+ user: Optional[str] = None,
243
+ session_id: Optional[str] = None,
193
244
  model: Optional[str] = None,
194
245
  models: Optional[List[str]] = None,
195
246
  frequency_penalty: OptionalNullable[float] = UNSET,
@@ -229,7 +280,6 @@ class Chat(BaseSDK):
229
280
  ]
230
281
  ] = None,
231
282
  top_p: OptionalNullable[float] = UNSET,
232
- user: Optional[str] = None,
233
283
  debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
234
284
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
235
285
  server_url: Optional[str] = None,
@@ -241,6 +291,11 @@ class Chat(BaseSDK):
241
291
  Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
242
292
 
243
293
  :param messages:
294
+ :param provider: When multiple model providers are available, optionally indicate your routing preference.
295
+ :param plugins: Plugins you want to enable for this request, including their settings.
296
+ :param route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
297
+ :param user:
298
+ :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
244
299
  :param model:
245
300
  :param models:
246
301
  :param frequency_penalty:
@@ -261,7 +316,6 @@ class Chat(BaseSDK):
261
316
  :param tool_choice:
262
317
  :param tools:
263
318
  :param top_p:
264
- :param user:
265
319
  :param debug:
266
320
  :param retries: Override the default retry configuration for this method
267
321
  :param server_url: Override the default server URL for this method
@@ -280,6 +334,15 @@ class Chat(BaseSDK):
280
334
  base_url = self._get_url(base_url, url_variables)
281
335
 
282
336
  request = components.ChatGenerationParams(
337
+ provider=utils.get_pydantic_model(
338
+ provider, OptionalNullable[components.ChatGenerationParamsProvider]
339
+ ),
340
+ plugins=utils.get_pydantic_model(
341
+ plugins, Optional[List[components.ChatGenerationParamsPluginUnion]]
342
+ ),
343
+ route=route,
344
+ user=user,
345
+ session_id=session_id,
283
346
  messages=utils.get_pydantic_model(messages, List[components.Message]),
284
347
  model=model,
285
348
  models=models,
@@ -310,7 +373,6 @@ class Chat(BaseSDK):
310
373
  tools, Optional[List[components.ToolDefinitionJSON]]
311
374
  ),
312
375
  top_p=top_p,
313
- user=user,
314
376
  debug=utils.get_pydantic_model(debug, Optional[components.Debug]),
315
377
  )
316
378
 
@@ -406,6 +468,21 @@ class Chat(BaseSDK):
406
468
  self,
407
469
  *,
408
470
  messages: Union[List[components.Message], List[components.MessageTypedDict]],
471
+ provider: OptionalNullable[
472
+ Union[
473
+ components.ChatGenerationParamsProvider,
474
+ components.ChatGenerationParamsProviderTypedDict,
475
+ ]
476
+ ] = UNSET,
477
+ plugins: Optional[
478
+ Union[
479
+ List[components.ChatGenerationParamsPluginUnion],
480
+ List[components.ChatGenerationParamsPluginUnionTypedDict],
481
+ ]
482
+ ] = None,
483
+ route: OptionalNullable[components.ChatGenerationParamsRoute] = UNSET,
484
+ user: Optional[str] = None,
485
+ session_id: Optional[str] = None,
409
486
  model: Optional[str] = None,
410
487
  models: Optional[List[str]] = None,
411
488
  frequency_penalty: OptionalNullable[float] = UNSET,
@@ -445,7 +522,6 @@ class Chat(BaseSDK):
445
522
  ]
446
523
  ] = None,
447
524
  top_p: OptionalNullable[float] = UNSET,
448
- user: Optional[str] = None,
449
525
  debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
450
526
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
451
527
  server_url: Optional[str] = None,
@@ -457,6 +533,11 @@ class Chat(BaseSDK):
457
533
  Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
458
534
 
459
535
  :param messages:
536
+ :param provider: When multiple model providers are available, optionally indicate your routing preference.
537
+ :param plugins: Plugins you want to enable for this request, including their settings.
538
+ :param route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
539
+ :param user:
540
+ :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
460
541
  :param model:
461
542
  :param models:
462
543
  :param frequency_penalty:
@@ -477,7 +558,6 @@ class Chat(BaseSDK):
477
558
  :param tool_choice:
478
559
  :param tools:
479
560
  :param top_p:
480
- :param user:
481
561
  :param debug:
482
562
  :param retries: Override the default retry configuration for this method
483
563
  :param server_url: Override the default server URL for this method
@@ -491,6 +571,21 @@ class Chat(BaseSDK):
491
571
  self,
492
572
  *,
493
573
  messages: Union[List[components.Message], List[components.MessageTypedDict]],
574
+ provider: OptionalNullable[
575
+ Union[
576
+ components.ChatGenerationParamsProvider,
577
+ components.ChatGenerationParamsProviderTypedDict,
578
+ ]
579
+ ] = UNSET,
580
+ plugins: Optional[
581
+ Union[
582
+ List[components.ChatGenerationParamsPluginUnion],
583
+ List[components.ChatGenerationParamsPluginUnionTypedDict],
584
+ ]
585
+ ] = None,
586
+ route: OptionalNullable[components.ChatGenerationParamsRoute] = UNSET,
587
+ user: Optional[str] = None,
588
+ session_id: Optional[str] = None,
494
589
  model: Optional[str] = None,
495
590
  models: Optional[List[str]] = None,
496
591
  frequency_penalty: OptionalNullable[float] = UNSET,
@@ -530,7 +625,6 @@ class Chat(BaseSDK):
530
625
  ]
531
626
  ] = None,
532
627
  top_p: OptionalNullable[float] = UNSET,
533
- user: Optional[str] = None,
534
628
  debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
535
629
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
536
630
  server_url: Optional[str] = None,
@@ -542,6 +636,11 @@ class Chat(BaseSDK):
542
636
  Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
543
637
 
544
638
  :param messages:
639
+ :param provider: When multiple model providers are available, optionally indicate your routing preference.
640
+ :param plugins: Plugins you want to enable for this request, including their settings.
641
+ :param route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
642
+ :param user:
643
+ :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
545
644
  :param model:
546
645
  :param models:
547
646
  :param frequency_penalty:
@@ -562,7 +661,6 @@ class Chat(BaseSDK):
562
661
  :param tool_choice:
563
662
  :param tools:
564
663
  :param top_p:
565
- :param user:
566
664
  :param debug:
567
665
  :param retries: Override the default retry configuration for this method
568
666
  :param server_url: Override the default server URL for this method
@@ -575,6 +673,21 @@ class Chat(BaseSDK):
575
673
  self,
576
674
  *,
577
675
  messages: Union[List[components.Message], List[components.MessageTypedDict]],
676
+ provider: OptionalNullable[
677
+ Union[
678
+ components.ChatGenerationParamsProvider,
679
+ components.ChatGenerationParamsProviderTypedDict,
680
+ ]
681
+ ] = UNSET,
682
+ plugins: Optional[
683
+ Union[
684
+ List[components.ChatGenerationParamsPluginUnion],
685
+ List[components.ChatGenerationParamsPluginUnionTypedDict],
686
+ ]
687
+ ] = None,
688
+ route: OptionalNullable[components.ChatGenerationParamsRoute] = UNSET,
689
+ user: Optional[str] = None,
690
+ session_id: Optional[str] = None,
578
691
  model: Optional[str] = None,
579
692
  models: Optional[List[str]] = None,
580
693
  frequency_penalty: OptionalNullable[float] = UNSET,
@@ -614,7 +727,6 @@ class Chat(BaseSDK):
614
727
  ]
615
728
  ] = None,
616
729
  top_p: OptionalNullable[float] = UNSET,
617
- user: Optional[str] = None,
618
730
  debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None,
619
731
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
620
732
  server_url: Optional[str] = None,
@@ -626,6 +738,11 @@ class Chat(BaseSDK):
626
738
  Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
627
739
 
628
740
  :param messages:
741
+ :param provider: When multiple model providers are available, optionally indicate your routing preference.
742
+ :param plugins: Plugins you want to enable for this request, including their settings.
743
+ :param route: Routing strategy for multiple models: \"fallback\" (default) uses secondary models as backups, \"sort\" sorts all endpoints together by routing criteria.
744
+ :param user:
745
+ :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
629
746
  :param model:
630
747
  :param models:
631
748
  :param frequency_penalty:
@@ -646,7 +763,6 @@ class Chat(BaseSDK):
646
763
  :param tool_choice:
647
764
  :param tools:
648
765
  :param top_p:
649
- :param user:
650
766
  :param debug:
651
767
  :param retries: Override the default retry configuration for this method
652
768
  :param server_url: Override the default server URL for this method
@@ -665,6 +781,15 @@ class Chat(BaseSDK):
665
781
  base_url = self._get_url(base_url, url_variables)
666
782
 
667
783
  request = components.ChatGenerationParams(
784
+ provider=utils.get_pydantic_model(
785
+ provider, OptionalNullable[components.ChatGenerationParamsProvider]
786
+ ),
787
+ plugins=utils.get_pydantic_model(
788
+ plugins, Optional[List[components.ChatGenerationParamsPluginUnion]]
789
+ ),
790
+ route=route,
791
+ user=user,
792
+ session_id=session_id,
668
793
  messages=utils.get_pydantic_model(messages, List[components.Message]),
669
794
  model=model,
670
795
  models=models,
@@ -695,7 +820,6 @@ class Chat(BaseSDK):
695
820
  tools, Optional[List[components.ToolDefinitionJSON]]
696
821
  ),
697
822
  top_p=top_p,
698
- user=user,
699
823
  debug=utils.get_pydantic_model(debug, Optional[components.Debug]),
700
824
  )
701
825