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
@@ -1,7 +1,9 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from ._schema0 import Schema0, Schema0TypedDict
4
+ from ._schema10 import Schema10, Schema10TypedDict
5
+ from ._schema17 import Schema17, Schema17TypedDict
6
+ from ._schema5 import Schema5, Schema5TypedDict
5
7
  from .chatstreamoptions import ChatStreamOptions, ChatStreamOptionsTypedDict
6
8
  from .message import Message, MessageTypedDict
7
9
  from .providersortunion import ProviderSortUnion, ProviderSortUnionTypedDict
@@ -31,7 +33,7 @@ from typing import Any, Dict, List, Literal, Optional, Union
31
33
  from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
32
34
 
33
35
 
34
- ChatGenerationParamsDataCollection = Union[
36
+ Schema3 = Union[
35
37
  Literal[
36
38
  "deny",
37
39
  "allow",
@@ -40,7 +42,7 @@ ChatGenerationParamsDataCollection = Union[
40
42
  ]
41
43
 
42
44
 
43
- Quantizations = Union[
45
+ Schema8 = Union[
44
46
  Literal[
45
47
  "int4",
46
48
  "int8",
@@ -56,97 +58,14 @@ Quantizations = Union[
56
58
  ]
57
59
 
58
60
 
59
- class ChatGenerationParamsMaxPriceTypedDict(TypedDict):
60
- r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
61
-
62
- prompt: NotRequired[Any]
63
- completion: NotRequired[Any]
64
- image: NotRequired[Any]
65
- audio: NotRequired[Any]
66
- request: NotRequired[Any]
67
-
68
-
69
- class ChatGenerationParamsMaxPrice(BaseModel):
70
- r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
71
-
72
- prompt: Optional[Any] = None
73
-
74
- completion: Optional[Any] = None
75
-
76
- image: Optional[Any] = None
77
-
78
- audio: Optional[Any] = None
79
-
80
- request: Optional[Any] = None
81
-
82
-
83
- class ChatGenerationParamsPreferredMinThroughputTypedDict(TypedDict):
84
- p50: NotRequired[Nullable[float]]
85
- p75: NotRequired[Nullable[float]]
86
- p90: NotRequired[Nullable[float]]
87
- p99: NotRequired[Nullable[float]]
88
-
89
-
90
- class ChatGenerationParamsPreferredMinThroughput(BaseModel):
91
- p50: OptionalNullable[float] = UNSET
92
-
93
- p75: OptionalNullable[float] = UNSET
94
-
95
- p90: OptionalNullable[float] = UNSET
96
-
97
- p99: OptionalNullable[float] = UNSET
98
-
99
- @model_serializer(mode="wrap")
100
- def serialize_model(self, handler):
101
- optional_fields = ["p50", "p75", "p90", "p99"]
102
- nullable_fields = ["p50", "p75", "p90", "p99"]
103
- null_default_fields = []
104
-
105
- serialized = handler(self)
106
-
107
- m = {}
108
-
109
- for n, f in type(self).model_fields.items():
110
- k = f.alias or n
111
- val = serialized.get(k)
112
- serialized.pop(k, None)
113
-
114
- optional_nullable = k in optional_fields and k in nullable_fields
115
- is_set = (
116
- self.__pydantic_fields_set__.intersection({n})
117
- or k in null_default_fields
118
- ) # pylint: disable=no-member
119
-
120
- if val is not None and val != UNSET_SENTINEL:
121
- m[k] = val
122
- elif val != UNSET_SENTINEL and (
123
- not k in optional_fields or (optional_nullable and is_set)
124
- ):
125
- m[k] = val
126
-
127
- return m
128
-
129
-
130
- ChatGenerationParamsPreferredMinThroughputUnionTypedDict = TypeAliasType(
131
- "ChatGenerationParamsPreferredMinThroughputUnionTypedDict",
132
- Union[ChatGenerationParamsPreferredMinThroughputTypedDict, float],
133
- )
134
-
135
-
136
- ChatGenerationParamsPreferredMinThroughputUnion = TypeAliasType(
137
- "ChatGenerationParamsPreferredMinThroughputUnion",
138
- Union[ChatGenerationParamsPreferredMinThroughput, float],
139
- )
140
-
141
-
142
- class ChatGenerationParamsPreferredMaxLatencyTypedDict(TypedDict):
61
+ class Schema15TypedDict(TypedDict):
143
62
  p50: NotRequired[Nullable[float]]
144
63
  p75: NotRequired[Nullable[float]]
145
64
  p90: NotRequired[Nullable[float]]
146
65
  p99: NotRequired[Nullable[float]]
147
66
 
148
67
 
149
- class ChatGenerationParamsPreferredMaxLatency(BaseModel):
68
+ class Schema15(BaseModel):
150
69
  p50: OptionalNullable[float] = UNSET
151
70
 
152
71
  p75: OptionalNullable[float] = UNSET
@@ -186,111 +105,60 @@ class ChatGenerationParamsPreferredMaxLatency(BaseModel):
186
105
  return m
187
106
 
188
107
 
189
- ChatGenerationParamsPreferredMaxLatencyUnionTypedDict = TypeAliasType(
190
- "ChatGenerationParamsPreferredMaxLatencyUnionTypedDict",
191
- Union[ChatGenerationParamsPreferredMaxLatencyTypedDict, float],
108
+ Schema15UnionTypedDict = TypeAliasType(
109
+ "Schema15UnionTypedDict", Union[Schema15TypedDict, float]
192
110
  )
193
111
 
194
112
 
195
- ChatGenerationParamsPreferredMaxLatencyUnion = TypeAliasType(
196
- "ChatGenerationParamsPreferredMaxLatencyUnion",
197
- Union[ChatGenerationParamsPreferredMaxLatency, float],
198
- )
113
+ Schema15Union = TypeAliasType("Schema15Union", Union[Schema15, float])
199
114
 
200
115
 
201
- class ChatGenerationParamsProviderTypedDict(TypedDict):
116
+ class Schema0TypedDict(TypedDict):
202
117
  allow_fallbacks: NotRequired[Nullable[bool]]
203
- r"""Whether to allow backup providers to serve requests
204
- - true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.
205
- - false: use only the primary/custom provider, and return the upstream error if it's unavailable.
206
-
207
- """
208
118
  require_parameters: NotRequired[Nullable[bool]]
209
- r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest."""
210
- data_collection: NotRequired[Nullable[ChatGenerationParamsDataCollection]]
211
- r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
212
- - allow: (default) allow providers which store user data non-transiently and may train on it
213
-
214
- - deny: use only providers which do not collect user data.
215
- """
119
+ data_collection: NotRequired[Nullable[Schema3]]
216
120
  zdr: NotRequired[Nullable[bool]]
217
121
  enforce_distillable_text: NotRequired[Nullable[bool]]
218
- order: NotRequired[Nullable[List[Schema0TypedDict]]]
219
- r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message."""
220
- only: NotRequired[Nullable[List[Schema0TypedDict]]]
221
- r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request."""
222
- ignore: NotRequired[Nullable[List[Schema0TypedDict]]]
223
- r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
224
- quantizations: NotRequired[Nullable[List[Quantizations]]]
225
- r"""A list of quantization levels to filter the provider by."""
122
+ order: NotRequired[Nullable[List[Schema5TypedDict]]]
123
+ only: NotRequired[Nullable[List[Schema5TypedDict]]]
124
+ ignore: NotRequired[Nullable[List[Schema5TypedDict]]]
125
+ quantizations: NotRequired[Nullable[List[Schema8]]]
226
126
  sort: NotRequired[Nullable[ProviderSortUnionTypedDict]]
227
- r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
228
- max_price: NotRequired[ChatGenerationParamsMaxPriceTypedDict]
229
- r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
230
- preferred_min_throughput: NotRequired[
231
- Nullable[ChatGenerationParamsPreferredMinThroughputUnionTypedDict]
232
- ]
233
- r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
234
- preferred_max_latency: NotRequired[
235
- Nullable[ChatGenerationParamsPreferredMaxLatencyUnionTypedDict]
236
- ]
237
- r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
238
-
239
-
240
- class ChatGenerationParamsProvider(BaseModel):
241
- allow_fallbacks: OptionalNullable[bool] = UNSET
242
- r"""Whether to allow backup providers to serve requests
243
- - true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.
244
- - false: use only the primary/custom provider, and return the upstream error if it's unavailable.
127
+ max_price: NotRequired[Schema10TypedDict]
128
+ preferred_min_throughput: NotRequired[Nullable[Schema15UnionTypedDict]]
129
+ preferred_max_latency: NotRequired[Nullable[Schema15UnionTypedDict]]
130
+
245
131
 
246
- """
132
+ class Schema0(BaseModel):
133
+ allow_fallbacks: OptionalNullable[bool] = UNSET
247
134
 
248
135
  require_parameters: OptionalNullable[bool] = UNSET
249
- r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest."""
250
136
 
251
137
  data_collection: Annotated[
252
- OptionalNullable[ChatGenerationParamsDataCollection],
253
- PlainValidator(validate_open_enum(False)),
138
+ OptionalNullable[Schema3], PlainValidator(validate_open_enum(False))
254
139
  ] = UNSET
255
- r"""Data collection setting. If no available model provider meets the requirement, your request will return an error.
256
- - allow: (default) allow providers which store user data non-transiently and may train on it
257
-
258
- - deny: use only providers which do not collect user data.
259
- """
260
140
 
261
141
  zdr: OptionalNullable[bool] = UNSET
262
142
 
263
143
  enforce_distillable_text: OptionalNullable[bool] = UNSET
264
144
 
265
- order: OptionalNullable[List[Schema0]] = UNSET
266
- r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message."""
145
+ order: OptionalNullable[List[Schema5]] = UNSET
267
146
 
268
- only: OptionalNullable[List[Schema0]] = UNSET
269
- r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request."""
147
+ only: OptionalNullable[List[Schema5]] = UNSET
270
148
 
271
- ignore: OptionalNullable[List[Schema0]] = UNSET
272
- r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request."""
149
+ ignore: OptionalNullable[List[Schema5]] = UNSET
273
150
 
274
151
  quantizations: OptionalNullable[
275
- List[Annotated[Quantizations, PlainValidator(validate_open_enum(False))]]
152
+ List[Annotated[Schema8, PlainValidator(validate_open_enum(False))]]
276
153
  ] = UNSET
277
- r"""A list of quantization levels to filter the provider by."""
278
154
 
279
155
  sort: OptionalNullable[ProviderSortUnion] = UNSET
280
- r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
281
156
 
282
- max_price: Optional[ChatGenerationParamsMaxPrice] = None
283
- r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion."""
157
+ max_price: Optional[Schema10] = None
284
158
 
285
- preferred_min_throughput: OptionalNullable[
286
- ChatGenerationParamsPreferredMinThroughputUnion
287
- ] = UNSET
288
- r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
159
+ preferred_min_throughput: OptionalNullable[Schema15Union] = UNSET
289
160
 
290
- preferred_max_latency: OptionalNullable[
291
- ChatGenerationParamsPreferredMaxLatencyUnion
292
- ] = UNSET
293
- r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold."""
161
+ preferred_max_latency: OptionalNullable[Schema15Union] = UNSET
294
162
 
295
163
  @model_serializer(mode="wrap")
296
164
  def serialize_model(self, handler):
@@ -350,150 +218,6 @@ class ChatGenerationParamsProvider(BaseModel):
350
218
  return m
351
219
 
352
220
 
353
- class ChatGenerationParamsPluginResponseHealingTypedDict(TypedDict):
354
- id: Literal["response-healing"]
355
- enabled: NotRequired[bool]
356
-
357
-
358
- class ChatGenerationParamsPluginResponseHealing(BaseModel):
359
- ID: Annotated[
360
- Annotated[
361
- Literal["response-healing"],
362
- AfterValidator(validate_const("response-healing")),
363
- ],
364
- pydantic.Field(alias="id"),
365
- ] = "response-healing"
366
-
367
- enabled: Optional[bool] = None
368
-
369
-
370
- PdfEngine = Union[
371
- Literal[
372
- "mistral-ocr",
373
- "pdf-text",
374
- "native",
375
- ],
376
- UnrecognizedStr,
377
- ]
378
-
379
-
380
- class PdfTypedDict(TypedDict):
381
- engine: NotRequired[PdfEngine]
382
-
383
-
384
- class Pdf(BaseModel):
385
- engine: Annotated[
386
- Optional[PdfEngine], PlainValidator(validate_open_enum(False))
387
- ] = None
388
-
389
-
390
- class ChatGenerationParamsPluginFileParserTypedDict(TypedDict):
391
- id: Literal["file-parser"]
392
- enabled: NotRequired[bool]
393
- pdf: NotRequired[PdfTypedDict]
394
-
395
-
396
- class ChatGenerationParamsPluginFileParser(BaseModel):
397
- ID: Annotated[
398
- Annotated[
399
- Literal["file-parser"], AfterValidator(validate_const("file-parser"))
400
- ],
401
- pydantic.Field(alias="id"),
402
- ] = "file-parser"
403
-
404
- enabled: Optional[bool] = None
405
-
406
- pdf: Optional[Pdf] = None
407
-
408
-
409
- Engine = Union[
410
- Literal[
411
- "native",
412
- "exa",
413
- ],
414
- UnrecognizedStr,
415
- ]
416
-
417
-
418
- class ChatGenerationParamsPluginWebTypedDict(TypedDict):
419
- id: Literal["web"]
420
- enabled: NotRequired[bool]
421
- max_results: NotRequired[float]
422
- search_prompt: NotRequired[str]
423
- engine: NotRequired[Engine]
424
-
425
-
426
- class ChatGenerationParamsPluginWeb(BaseModel):
427
- ID: Annotated[
428
- Annotated[Literal["web"], AfterValidator(validate_const("web"))],
429
- pydantic.Field(alias="id"),
430
- ] = "web"
431
-
432
- enabled: Optional[bool] = None
433
-
434
- max_results: Optional[float] = None
435
-
436
- search_prompt: Optional[str] = None
437
-
438
- engine: Annotated[Optional[Engine], PlainValidator(validate_open_enum(False))] = (
439
- None
440
- )
441
-
442
-
443
- class ChatGenerationParamsPluginModerationTypedDict(TypedDict):
444
- id: Literal["moderation"]
445
-
446
-
447
- class ChatGenerationParamsPluginModeration(BaseModel):
448
- ID: Annotated[
449
- Annotated[Literal["moderation"], AfterValidator(validate_const("moderation"))],
450
- pydantic.Field(alias="id"),
451
- ] = "moderation"
452
-
453
-
454
- class ChatGenerationParamsPluginAutoRouterTypedDict(TypedDict):
455
- id: Literal["auto-router"]
456
- enabled: NotRequired[bool]
457
- allowed_models: NotRequired[List[str]]
458
-
459
-
460
- class ChatGenerationParamsPluginAutoRouter(BaseModel):
461
- ID: Annotated[
462
- Annotated[
463
- Literal["auto-router"], AfterValidator(validate_const("auto-router"))
464
- ],
465
- pydantic.Field(alias="id"),
466
- ] = "auto-router"
467
-
468
- enabled: Optional[bool] = None
469
-
470
- allowed_models: Optional[List[str]] = None
471
-
472
-
473
- ChatGenerationParamsPluginUnionTypedDict = TypeAliasType(
474
- "ChatGenerationParamsPluginUnionTypedDict",
475
- Union[
476
- ChatGenerationParamsPluginModerationTypedDict,
477
- ChatGenerationParamsPluginResponseHealingTypedDict,
478
- ChatGenerationParamsPluginAutoRouterTypedDict,
479
- ChatGenerationParamsPluginFileParserTypedDict,
480
- ChatGenerationParamsPluginWebTypedDict,
481
- ],
482
- )
483
-
484
-
485
- ChatGenerationParamsPluginUnion = Annotated[
486
- Union[
487
- Annotated[ChatGenerationParamsPluginAutoRouter, Tag("auto-router")],
488
- Annotated[ChatGenerationParamsPluginModeration, Tag("moderation")],
489
- Annotated[ChatGenerationParamsPluginWeb, Tag("web")],
490
- Annotated[ChatGenerationParamsPluginFileParser, Tag("file-parser")],
491
- Annotated[ChatGenerationParamsPluginResponseHealing, Tag("response-healing")],
492
- ],
493
- Discriminator(lambda m: get_discriminator(m, "id", "id")),
494
- ]
495
-
496
-
497
221
  Route = Union[
498
222
  Literal[
499
223
  "fallback",
@@ -562,22 +286,22 @@ class Reasoning(BaseModel):
562
286
  return m
563
287
 
564
288
 
565
- class ChatGenerationParamsResponseFormatPythonTypedDict(TypedDict):
289
+ class ResponseFormatPythonTypedDict(TypedDict):
566
290
  type: Literal["python"]
567
291
 
568
292
 
569
- class ChatGenerationParamsResponseFormatPython(BaseModel):
293
+ class ResponseFormatPython(BaseModel):
570
294
  TYPE: Annotated[
571
295
  Annotated[Literal["python"], AfterValidator(validate_const("python"))],
572
296
  pydantic.Field(alias="type"),
573
297
  ] = "python"
574
298
 
575
299
 
576
- class ChatGenerationParamsResponseFormatJSONObjectTypedDict(TypedDict):
300
+ class ResponseFormatJSONObjectTypedDict(TypedDict):
577
301
  type: Literal["json_object"]
578
302
 
579
303
 
580
- class ChatGenerationParamsResponseFormatJSONObject(BaseModel):
304
+ class ResponseFormatJSONObject(BaseModel):
581
305
  TYPE: Annotated[
582
306
  Annotated[
583
307
  Literal["json_object"], AfterValidator(validate_const("json_object"))
@@ -586,49 +310,45 @@ class ChatGenerationParamsResponseFormatJSONObject(BaseModel):
586
310
  ] = "json_object"
587
311
 
588
312
 
589
- class ChatGenerationParamsResponseFormatTextTypedDict(TypedDict):
313
+ class ResponseFormatTextTypedDict(TypedDict):
590
314
  type: Literal["text"]
591
315
 
592
316
 
593
- class ChatGenerationParamsResponseFormatText(BaseModel):
317
+ class ResponseFormatText(BaseModel):
594
318
  TYPE: Annotated[
595
319
  Annotated[Literal["text"], AfterValidator(validate_const("text"))],
596
320
  pydantic.Field(alias="type"),
597
321
  ] = "text"
598
322
 
599
323
 
600
- ChatGenerationParamsResponseFormatUnionTypedDict = TypeAliasType(
601
- "ChatGenerationParamsResponseFormatUnionTypedDict",
324
+ ResponseFormatTypedDict = TypeAliasType(
325
+ "ResponseFormatTypedDict",
602
326
  Union[
603
- ChatGenerationParamsResponseFormatTextTypedDict,
604
- ChatGenerationParamsResponseFormatJSONObjectTypedDict,
605
- ChatGenerationParamsResponseFormatPythonTypedDict,
327
+ ResponseFormatTextTypedDict,
328
+ ResponseFormatJSONObjectTypedDict,
329
+ ResponseFormatPythonTypedDict,
606
330
  ResponseFormatJSONSchemaTypedDict,
607
331
  ResponseFormatTextGrammarTypedDict,
608
332
  ],
609
333
  )
610
334
 
611
335
 
612
- ChatGenerationParamsResponseFormatUnion = Annotated[
336
+ ResponseFormat = Annotated[
613
337
  Union[
614
- Annotated[ChatGenerationParamsResponseFormatText, Tag("text")],
615
- Annotated[ChatGenerationParamsResponseFormatJSONObject, Tag("json_object")],
338
+ Annotated[ResponseFormatText, Tag("text")],
339
+ Annotated[ResponseFormatJSONObject, Tag("json_object")],
616
340
  Annotated[ResponseFormatJSONSchema, Tag("json_schema")],
617
341
  Annotated[ResponseFormatTextGrammar, Tag("grammar")],
618
- Annotated[ChatGenerationParamsResponseFormatPython, Tag("python")],
342
+ Annotated[ResponseFormatPython, Tag("python")],
619
343
  ],
620
344
  Discriminator(lambda m: get_discriminator(m, "type", "type")),
621
345
  ]
622
346
 
623
347
 
624
- ChatGenerationParamsStopTypedDict = TypeAliasType(
625
- "ChatGenerationParamsStopTypedDict", Union[str, List[str]]
626
- )
348
+ StopTypedDict = TypeAliasType("StopTypedDict", Union[str, List[str]])
627
349
 
628
350
 
629
- ChatGenerationParamsStop = TypeAliasType(
630
- "ChatGenerationParamsStop", Union[str, List[str]]
631
- )
351
+ Stop = TypeAliasType("Stop", Union[str, List[str]])
632
352
 
633
353
 
634
354
  class DebugTypedDict(TypedDict):
@@ -640,12 +360,12 @@ class Debug(BaseModel):
640
360
 
641
361
 
642
362
  ChatGenerationParamsImageConfigTypedDict = TypeAliasType(
643
- "ChatGenerationParamsImageConfigTypedDict", Union[str, float]
363
+ "ChatGenerationParamsImageConfigTypedDict", Union[str, float, List[Any]]
644
364
  )
645
365
 
646
366
 
647
367
  ChatGenerationParamsImageConfig = TypeAliasType(
648
- "ChatGenerationParamsImageConfig", Union[str, float]
368
+ "ChatGenerationParamsImageConfig", Union[str, float, List[Any]]
649
369
  )
650
370
 
651
371
 
@@ -660,14 +380,11 @@ Modality = Union[
660
380
 
661
381
  class ChatGenerationParamsTypedDict(TypedDict):
662
382
  messages: List[MessageTypedDict]
663
- provider: NotRequired[Nullable[ChatGenerationParamsProviderTypedDict]]
664
- r"""When multiple model providers are available, optionally indicate your routing preference."""
665
- plugins: NotRequired[List[ChatGenerationParamsPluginUnionTypedDict]]
666
- r"""Plugins you want to enable for this request, including their settings."""
383
+ provider: NotRequired[Nullable[Schema0TypedDict]]
384
+ plugins: NotRequired[List[Schema17TypedDict]]
667
385
  route: NotRequired[Nullable[Route]]
668
386
  user: NotRequired[str]
669
387
  session_id: NotRequired[str]
670
- r"""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."""
671
388
  model: NotRequired[str]
672
389
  models: NotRequired[List[str]]
673
390
  frequency_penalty: NotRequired[Nullable[float]]
@@ -679,9 +396,9 @@ class ChatGenerationParamsTypedDict(TypedDict):
679
396
  metadata: NotRequired[Dict[str, str]]
680
397
  presence_penalty: NotRequired[Nullable[float]]
681
398
  reasoning: NotRequired[ReasoningTypedDict]
682
- response_format: NotRequired[ChatGenerationParamsResponseFormatUnionTypedDict]
399
+ response_format: NotRequired[ResponseFormatTypedDict]
683
400
  seed: NotRequired[Nullable[int]]
684
- stop: NotRequired[Nullable[ChatGenerationParamsStopTypedDict]]
401
+ stop: NotRequired[Nullable[StopTypedDict]]
685
402
  stream: NotRequired[bool]
686
403
  stream_options: NotRequired[Nullable[ChatStreamOptionsTypedDict]]
687
404
  temperature: NotRequired[Nullable[float]]
@@ -696,11 +413,9 @@ class ChatGenerationParamsTypedDict(TypedDict):
696
413
  class ChatGenerationParams(BaseModel):
697
414
  messages: List[Message]
698
415
 
699
- provider: OptionalNullable[ChatGenerationParamsProvider] = UNSET
700
- r"""When multiple model providers are available, optionally indicate your routing preference."""
416
+ provider: OptionalNullable[Schema0] = UNSET
701
417
 
702
- plugins: Optional[List[ChatGenerationParamsPluginUnion]] = None
703
- r"""Plugins you want to enable for this request, including their settings."""
418
+ plugins: Optional[List[Schema17]] = None
704
419
 
705
420
  route: Annotated[
706
421
  OptionalNullable[Route], PlainValidator(validate_open_enum(False))
@@ -709,7 +424,6 @@ class ChatGenerationParams(BaseModel):
709
424
  user: Optional[str] = None
710
425
 
711
426
  session_id: Optional[str] = None
712
- r"""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."""
713
427
 
714
428
  model: Optional[str] = None
715
429
 
@@ -733,11 +447,11 @@ class ChatGenerationParams(BaseModel):
733
447
 
734
448
  reasoning: Optional[Reasoning] = None
735
449
 
736
- response_format: Optional[ChatGenerationParamsResponseFormatUnion] = None
450
+ response_format: Optional[ResponseFormat] = None
737
451
 
738
452
  seed: OptionalNullable[int] = UNSET
739
453
 
740
- stop: OptionalNullable[ChatGenerationParamsStop] = UNSET
454
+ stop: OptionalNullable[Stop] = UNSET
741
455
 
742
456
  stream: Optional[bool] = False
743
457
 
@@ -19,12 +19,12 @@ ChatMessageContentItemImageDetail = Union[
19
19
  ]
20
20
 
21
21
 
22
- class ImageURLTypedDict(TypedDict):
22
+ class ChatMessageContentItemImageImageURLTypedDict(TypedDict):
23
23
  url: str
24
24
  detail: NotRequired[ChatMessageContentItemImageDetail]
25
25
 
26
26
 
27
- class ImageURL(BaseModel):
27
+ class ChatMessageContentItemImageImageURL(BaseModel):
28
28
  url: str
29
29
 
30
30
  detail: Annotated[
@@ -34,12 +34,12 @@ class ImageURL(BaseModel):
34
34
 
35
35
 
36
36
  class ChatMessageContentItemImageTypedDict(TypedDict):
37
- image_url: ImageURLTypedDict
37
+ image_url: ChatMessageContentItemImageImageURLTypedDict
38
38
  type: Literal["image_url"]
39
39
 
40
40
 
41
41
  class ChatMessageContentItemImage(BaseModel):
42
- image_url: ImageURL
42
+ image_url: ChatMessageContentItemImageImageURL
43
43
 
44
44
  TYPE: Annotated[
45
45
  Annotated[Literal["image_url"], AfterValidator(validate_const("image_url"))],
@@ -1,7 +1,6 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from ._schema3 import Schema3, Schema3TypedDict
5
4
  from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
6
5
  from .chatcompletionfinishreason import ChatCompletionFinishReason
7
6
  from .chatmessagetokenlogprobs import (
@@ -18,7 +17,6 @@ from openrouter.types import (
18
17
  from openrouter.utils import validate_open_enum
19
18
  from pydantic import model_serializer
20
19
  from pydantic.functional_validators import PlainValidator
21
- from typing import List, Optional
22
20
  from typing_extensions import Annotated, NotRequired, TypedDict
23
21
 
24
22
 
@@ -26,7 +24,6 @@ class ChatResponseChoiceTypedDict(TypedDict):
26
24
  finish_reason: Nullable[ChatCompletionFinishReason]
27
25
  index: float
28
26
  message: AssistantMessageTypedDict
29
- reasoning_details: NotRequired[List[Schema3TypedDict]]
30
27
  logprobs: NotRequired[Nullable[ChatMessageTokenLogprobsTypedDict]]
31
28
 
32
29
 
@@ -39,13 +36,11 @@ class ChatResponseChoice(BaseModel):
39
36
 
40
37
  message: AssistantMessage
41
38
 
42
- reasoning_details: Optional[List[Schema3]] = None
43
-
44
39
  logprobs: OptionalNullable[ChatMessageTokenLogprobs] = UNSET
45
40
 
46
41
  @model_serializer(mode="wrap")
47
42
  def serialize_model(self, handler):
48
- optional_fields = ["reasoning_details", "logprobs"]
43
+ optional_fields = ["logprobs"]
49
44
  nullable_fields = ["finish_reason", "logprobs"]
50
45
  null_default_fields = []
51
46
 
@@ -1,7 +1,7 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from ._schema3 import Schema3, Schema3TypedDict
4
+ from ._schema19 import Schema19, Schema19TypedDict
5
5
  from .chatstreamingmessagetoolcall import (
6
6
  ChatStreamingMessageToolCall,
7
7
  ChatStreamingMessageToolCallTypedDict,
@@ -27,7 +27,7 @@ class ChatStreamingMessageChunkTypedDict(TypedDict):
27
27
  reasoning: NotRequired[Nullable[str]]
28
28
  refusal: NotRequired[Nullable[str]]
29
29
  tool_calls: NotRequired[List[ChatStreamingMessageToolCallTypedDict]]
30
- reasoning_details: NotRequired[List[Schema3TypedDict]]
30
+ reasoning_details: NotRequired[List[Schema19TypedDict]]
31
31
 
32
32
 
33
33
  class ChatStreamingMessageChunk(BaseModel):
@@ -41,7 +41,7 @@ class ChatStreamingMessageChunk(BaseModel):
41
41
 
42
42
  tool_calls: Optional[List[ChatStreamingMessageToolCall]] = None
43
43
 
44
- reasoning_details: Optional[List[Schema3]] = None
44
+ reasoning_details: Optional[List[Schema19]] = None
45
45
 
46
46
  @model_serializer(mode="wrap")
47
47
  def serialize_model(self, handler):