openrouter 0.0.18__py3-none-any.whl → 0.0.19__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 (87) hide show
  1. openrouter/_version.py +3 -3
  2. openrouter/analytics.py +0 -2
  3. openrouter/api_keys.py +4 -24
  4. openrouter/basesdk.py +0 -6
  5. openrouter/chat.py +14 -212
  6. openrouter/completions.py +0 -2
  7. openrouter/components/__init__.py +105 -447
  8. openrouter/components/chatgenerationparams.py +17 -559
  9. openrouter/components/chatgenerationtokenusage.py +0 -3
  10. openrouter/components/chatmessagecontentitem.py +1 -1
  11. openrouter/components/chatmessagecontentitemaudio.py +25 -6
  12. openrouter/components/chatmessagecontentitemtext.py +2 -9
  13. openrouter/components/chatmessagecontentitemvideo.py +5 -9
  14. openrouter/components/chatmessagetokenlogprob.py +4 -4
  15. openrouter/components/chatresponsechoice.py +67 -6
  16. openrouter/components/chatstreamingmessagechunk.py +1 -12
  17. openrouter/components/chatstreamingresponsechunk.py +1 -1
  18. openrouter/components/completionchoice.py +5 -18
  19. openrouter/components/completioncreateparams.py +10 -10
  20. openrouter/components/completionresponse.py +0 -3
  21. openrouter/components/message.py +9 -10
  22. openrouter/components/openairesponsesannotation.py +4 -11
  23. openrouter/components/openairesponsesreasoningeffort.py +0 -1
  24. openrouter/components/openresponseseasyinputmessage.py +20 -93
  25. openrouter/components/openresponsesinput.py +2 -2
  26. openrouter/components/openresponsesinputmessageitem.py +14 -87
  27. openrouter/components/openresponsesnonstreamingresponse.py +19 -33
  28. openrouter/components/openresponsesreasoning.py +0 -1
  29. openrouter/components/openresponsesrequest.py +119 -246
  30. openrouter/components/openresponsesstreamevent.py +39 -110
  31. openrouter/components/outputmessage.py +4 -10
  32. openrouter/components/parameter.py +0 -1
  33. openrouter/components/providername.py +2 -10
  34. openrouter/components/providersort.py +1 -0
  35. openrouter/components/publicendpoint.py +49 -60
  36. openrouter/components/publicpricing.py +49 -49
  37. openrouter/components/responseformattextconfig.py +7 -9
  38. openrouter/components/responseoutputtext.py +1 -36
  39. openrouter/components/responsesoutputitem.py +11 -13
  40. openrouter/components/responsesoutputitemreasoning.py +3 -43
  41. openrouter/components/responsesoutputmessage.py +5 -10
  42. openrouter/credits.py +0 -4
  43. openrouter/embeddings.py +8 -10
  44. openrouter/endpoints.py +0 -4
  45. openrouter/generations.py +0 -2
  46. openrouter/models_.py +0 -6
  47. openrouter/oauth.py +0 -4
  48. openrouter/operations/__init__.py +34 -10
  49. openrouter/operations/createembeddings.py +247 -16
  50. openrouter/operations/getcredits.py +0 -19
  51. openrouter/operations/getgeneration.py +0 -6
  52. openrouter/operations/getparameters.py +71 -5
  53. openrouter/operations/updatekeys.py +2 -2
  54. openrouter/parameters.py +2 -4
  55. openrouter/providers.py +0 -2
  56. openrouter/responses.py +36 -188
  57. openrouter/sdk.py +0 -13
  58. openrouter/sdkconfiguration.py +0 -2
  59. openrouter/utils/forms.py +10 -21
  60. openrouter/utils/queryparams.py +2 -14
  61. openrouter/utils/retries.py +5 -69
  62. {openrouter-0.0.18.dist-info → openrouter-0.0.19.dist-info}/METADATA +1 -1
  63. {openrouter-0.0.18.dist-info → openrouter-0.0.19.dist-info}/RECORD +66 -87
  64. openrouter/components/_schema0.py +0 -94
  65. openrouter/components/_schema3.py +0 -229
  66. openrouter/components/chatcompletionfinishreason.py +0 -17
  67. openrouter/components/chatmessagecontentitemcachecontrol.py +0 -32
  68. openrouter/components/chatstreamingchoice.py +0 -72
  69. openrouter/components/pdfparserengine.py +0 -16
  70. openrouter/components/pdfparseroptions.py +0 -25
  71. openrouter/components/percentilelatencycutoffs.py +0 -71
  72. openrouter/components/percentilestats.py +0 -34
  73. openrouter/components/percentilethroughputcutoffs.py +0 -71
  74. openrouter/components/preferredmaxlatency.py +0 -21
  75. openrouter/components/preferredminthroughput.py +0 -22
  76. openrouter/components/providerpreferences.py +0 -355
  77. openrouter/components/providersortconfig.py +0 -71
  78. openrouter/components/providersortunion.py +0 -23
  79. openrouter/components/responseinputvideo.py +0 -26
  80. openrouter/components/responsesoutputmodality.py +0 -14
  81. openrouter/components/websearchengine.py +0 -15
  82. openrouter/models/__init__.py +0 -3
  83. openrouter/models/internal/__init__.py +0 -54
  84. openrouter/models/internal/globals.py +0 -41
  85. {openrouter-0.0.18.dist-info → openrouter-0.0.19.dist-info}/WHEEL +0 -0
  86. {openrouter-0.0.18.dist-info → openrouter-0.0.19.dist-info}/licenses/LICENSE +0 -0
  87. {openrouter-0.0.18.dist-info → openrouter-0.0.19.dist-info}/top_level.txt +0 -0
@@ -59,10 +59,8 @@ from .reasoningtextcontent import ReasoningTextContent, ReasoningTextContentType
59
59
  from .responseoutputtext import ResponseOutputText, ResponseOutputTextTypedDict
60
60
  from .responsesoutputitem import ResponsesOutputItem, ResponsesOutputItemTypedDict
61
61
  from openrouter.types import BaseModel
62
- from openrouter.utils import get_discriminator
63
- from pydantic import Discriminator, Tag
64
62
  from typing import List, Literal, Union
65
- from typing_extensions import Annotated, TypeAliasType, TypedDict
63
+ from typing_extensions import TypeAliasType, TypedDict
66
64
 
67
65
 
68
66
  TypeResponseReasoningSummaryPartDone = Literal["response.reasoning_summary_part.done",]
@@ -330,14 +328,10 @@ Part2TypedDict = TypeAliasType(
330
328
  )
331
329
 
332
330
 
333
- Part2 = Annotated[
334
- Union[
335
- Annotated[ResponseOutputText, Tag("output_text")],
336
- Annotated[ReasoningTextContent, Tag("reasoning_text")],
337
- Annotated[OpenAIResponsesRefusalContent, Tag("refusal")],
338
- ],
339
- Discriminator(lambda m: get_discriminator(m, "type", "type")),
340
- ]
331
+ Part2 = TypeAliasType(
332
+ "Part2",
333
+ Union[ReasoningTextContent, OpenAIResponsesRefusalContent, ResponseOutputText],
334
+ )
341
335
 
342
336
 
343
337
  class OpenResponsesStreamEventResponseContentPartDoneTypedDict(TypedDict):
@@ -380,14 +374,10 @@ Part1TypedDict = TypeAliasType(
380
374
  )
381
375
 
382
376
 
383
- Part1 = Annotated[
384
- Union[
385
- Annotated[ResponseOutputText, Tag("output_text")],
386
- Annotated[ReasoningTextContent, Tag("reasoning_text")],
387
- Annotated[OpenAIResponsesRefusalContent, Tag("refusal")],
388
- ],
389
- Discriminator(lambda m: get_discriminator(m, "type", "type")),
390
- ]
377
+ Part1 = TypeAliasType(
378
+ "Part1",
379
+ Union[ReasoningTextContent, OpenAIResponsesRefusalContent, ResponseOutputText],
380
+ )
391
381
 
392
382
 
393
383
  class OpenResponsesStreamEventResponseContentPartAddedTypedDict(TypedDict):
@@ -619,97 +609,36 @@ OpenResponsesStreamEventTypedDict = TypeAliasType(
619
609
  r"""Union of all possible event types emitted during response streaming"""
620
610
 
621
611
 
622
- OpenResponsesStreamEvent = Annotated[
612
+ OpenResponsesStreamEvent = TypeAliasType(
613
+ "OpenResponsesStreamEvent",
623
614
  Union[
624
- Annotated[OpenResponsesStreamEventResponseCreated, Tag("response.created")],
625
- Annotated[
626
- OpenResponsesStreamEventResponseInProgress, Tag("response.in_progress")
627
- ],
628
- Annotated[OpenResponsesStreamEventResponseCompleted, Tag("response.completed")],
629
- Annotated[
630
- OpenResponsesStreamEventResponseIncomplete, Tag("response.incomplete")
631
- ],
632
- Annotated[OpenResponsesStreamEventResponseFailed, Tag("response.failed")],
633
- Annotated[OpenResponsesErrorEvent, Tag("error")],
634
- Annotated[
635
- OpenResponsesStreamEventResponseOutputItemAdded,
636
- Tag("response.output_item.added"),
637
- ],
638
- Annotated[
639
- OpenResponsesStreamEventResponseOutputItemDone,
640
- Tag("response.output_item.done"),
641
- ],
642
- Annotated[
643
- OpenResponsesStreamEventResponseContentPartAdded,
644
- Tag("response.content_part.added"),
645
- ],
646
- Annotated[
647
- OpenResponsesStreamEventResponseContentPartDone,
648
- Tag("response.content_part.done"),
649
- ],
650
- Annotated[
651
- OpenResponsesStreamEventResponseOutputTextDelta,
652
- Tag("response.output_text.delta"),
653
- ],
654
- Annotated[
655
- OpenResponsesStreamEventResponseOutputTextDone,
656
- Tag("response.output_text.done"),
657
- ],
658
- Annotated[
659
- OpenResponsesStreamEventResponseRefusalDelta, Tag("response.refusal.delta")
660
- ],
661
- Annotated[
662
- OpenResponsesStreamEventResponseRefusalDone, Tag("response.refusal.done")
663
- ],
664
- Annotated[
665
- OpenResponsesStreamEventResponseOutputTextAnnotationAdded,
666
- Tag("response.output_text.annotation.added"),
667
- ],
668
- Annotated[
669
- OpenResponsesStreamEventResponseFunctionCallArgumentsDelta,
670
- Tag("response.function_call_arguments.delta"),
671
- ],
672
- Annotated[
673
- OpenResponsesStreamEventResponseFunctionCallArgumentsDone,
674
- Tag("response.function_call_arguments.done"),
675
- ],
676
- Annotated[
677
- OpenResponsesReasoningDeltaEvent, Tag("response.reasoning_text.delta")
678
- ],
679
- Annotated[OpenResponsesReasoningDoneEvent, Tag("response.reasoning_text.done")],
680
- Annotated[
681
- OpenResponsesReasoningSummaryPartAddedEvent,
682
- Tag("response.reasoning_summary_part.added"),
683
- ],
684
- Annotated[
685
- OpenResponsesStreamEventResponseReasoningSummaryPartDone,
686
- Tag("response.reasoning_summary_part.done"),
687
- ],
688
- Annotated[
689
- OpenResponsesReasoningSummaryTextDeltaEvent,
690
- Tag("response.reasoning_summary_text.delta"),
691
- ],
692
- Annotated[
693
- OpenResponsesReasoningSummaryTextDoneEvent,
694
- Tag("response.reasoning_summary_text.done"),
695
- ],
696
- Annotated[
697
- OpenResponsesImageGenCallInProgress,
698
- Tag("response.image_generation_call.in_progress"),
699
- ],
700
- Annotated[
701
- OpenResponsesImageGenCallGenerating,
702
- Tag("response.image_generation_call.generating"),
703
- ],
704
- Annotated[
705
- OpenResponsesImageGenCallPartialImage,
706
- Tag("response.image_generation_call.partial_image"),
707
- ],
708
- Annotated[
709
- OpenResponsesImageGenCallCompleted,
710
- Tag("response.image_generation_call.completed"),
711
- ],
615
+ OpenResponsesStreamEventResponseCreated,
616
+ OpenResponsesStreamEventResponseInProgress,
617
+ OpenResponsesStreamEventResponseCompleted,
618
+ OpenResponsesStreamEventResponseIncomplete,
619
+ OpenResponsesStreamEventResponseFailed,
620
+ OpenResponsesStreamEventResponseOutputItemAdded,
621
+ OpenResponsesStreamEventResponseOutputItemDone,
622
+ OpenResponsesImageGenCallCompleted,
623
+ OpenResponsesImageGenCallGenerating,
624
+ OpenResponsesImageGenCallInProgress,
625
+ OpenResponsesErrorEvent,
626
+ OpenResponsesStreamEventResponseFunctionCallArgumentsDelta,
627
+ OpenResponsesStreamEventResponseRefusalDelta,
628
+ OpenResponsesReasoningSummaryPartAddedEvent,
629
+ OpenResponsesStreamEventResponseContentPartAdded,
630
+ OpenResponsesImageGenCallPartialImage,
631
+ OpenResponsesStreamEventResponseFunctionCallArgumentsDone,
632
+ OpenResponsesReasoningDeltaEvent,
633
+ OpenResponsesReasoningDoneEvent,
634
+ OpenResponsesStreamEventResponseRefusalDone,
635
+ OpenResponsesStreamEventResponseReasoningSummaryPartDone,
636
+ OpenResponsesReasoningSummaryTextDeltaEvent,
637
+ OpenResponsesReasoningSummaryTextDoneEvent,
638
+ OpenResponsesStreamEventResponseContentPartDone,
639
+ OpenResponsesStreamEventResponseOutputTextDelta,
640
+ OpenResponsesStreamEventResponseOutputTextDone,
641
+ OpenResponsesStreamEventResponseOutputTextAnnotationAdded,
712
642
  ],
713
- Discriminator(lambda m: get_discriminator(m, "type", "type")),
714
- ]
643
+ )
715
644
  r"""Union of all possible event types emitted during response streaming"""
@@ -7,10 +7,8 @@ from .openairesponsesrefusalcontent import (
7
7
  )
8
8
  from .responseoutputtext import ResponseOutputText, ResponseOutputTextTypedDict
9
9
  from openrouter.types import BaseModel
10
- from openrouter.utils import get_discriminator
11
- from pydantic import Discriminator, Tag
12
10
  from typing import List, Literal, Optional, Union
13
- from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
11
+ from typing_extensions import NotRequired, TypeAliasType, TypedDict
14
12
 
15
13
 
16
14
  OutputMessageRole = Literal["assistant",]
@@ -54,13 +52,9 @@ OutputMessageContentTypedDict = TypeAliasType(
54
52
  )
55
53
 
56
54
 
57
- OutputMessageContent = Annotated[
58
- Union[
59
- Annotated[ResponseOutputText, Tag("output_text")],
60
- Annotated[OpenAIResponsesRefusalContent, Tag("refusal")],
61
- ],
62
- Discriminator(lambda m: get_discriminator(m, "type", "type")),
63
- ]
55
+ OutputMessageContent = TypeAliasType(
56
+ "OutputMessageContent", Union[OpenAIResponsesRefusalContent, ResponseOutputText]
57
+ )
64
58
 
65
59
 
66
60
  class OutputMessageTypedDict(TypedDict):
@@ -28,7 +28,6 @@ Parameter = Union[
28
28
  "parallel_tool_calls",
29
29
  "include_reasoning",
30
30
  "reasoning",
31
- "reasoning_effort",
32
31
  "web_search_options",
33
32
  "verbosity",
34
33
  ],
@@ -11,14 +11,12 @@ ProviderName = Union[
11
11
  "AionLabs",
12
12
  "Alibaba",
13
13
  "Amazon Bedrock",
14
- "Amazon Nova",
15
14
  "Anthropic",
16
- "Arcee AI",
15
+ "Arcee",
17
16
  "AtlasCloud",
18
17
  "Avian",
19
18
  "Azure",
20
19
  "BaseTen",
21
- "BytePlus",
22
20
  "Black Forest Labs",
23
21
  "Cerebras",
24
22
  "Chutes",
@@ -38,12 +36,10 @@ ProviderName = Union[
38
36
  "Groq",
39
37
  "Hyperbolic",
40
38
  "Inception",
41
- "Inceptron",
42
39
  "InferenceNet",
43
40
  "Infermatic",
44
41
  "Inflection",
45
42
  "Liquid",
46
- "Mara",
47
43
  "Mancer 2",
48
44
  "Minimax",
49
45
  "ModelRun",
@@ -63,17 +59,13 @@ ProviderName = Union[
63
59
  "Phala",
64
60
  "Relace",
65
61
  "SambaNova",
66
- "Seed",
67
62
  "SiliconFlow",
68
- "Sourceful",
69
63
  "Stealth",
70
- "StreamLake",
71
64
  "Switchpoint",
65
+ "Targon",
72
66
  "Together",
73
- "Upstage",
74
67
  "Venice",
75
68
  "WandB",
76
- "Xiaomi",
77
69
  "xAI",
78
70
  "Z.AI",
79
71
  "FakeProvider",
@@ -13,3 +13,4 @@ ProviderSort = Union[
13
13
  ],
14
14
  UnrecognizedStr,
15
15
  ]
16
+ r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed."""
@@ -3,80 +3,79 @@
3
3
  from __future__ import annotations
4
4
  from .endpointstatus import EndpointStatus
5
5
  from .parameter import Parameter
6
- from .percentilestats import PercentileStats, PercentileStatsTypedDict
7
6
  from .providername import ProviderName
8
7
  from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr
9
8
  from openrouter.utils import validate_open_enum
10
9
  from pydantic import model_serializer
11
10
  from pydantic.functional_validators import PlainValidator
12
- from typing import List, Literal, Optional, Union
11
+ from typing import Any, List, Literal, Optional, Union
13
12
  from typing_extensions import Annotated, NotRequired, TypedDict
14
13
 
15
14
 
16
15
  class PricingTypedDict(TypedDict):
17
- prompt: str
18
- r"""A value in string format that is a large number"""
19
- completion: str
20
- r"""A value in string format that is a large number"""
21
- request: NotRequired[str]
22
- r"""A value in string format that is a large number"""
23
- image: NotRequired[str]
24
- r"""A value in string format that is a large number"""
25
- image_token: NotRequired[str]
26
- r"""A value in string format that is a large number"""
27
- image_output: NotRequired[str]
28
- r"""A value in string format that is a large number"""
29
- audio: NotRequired[str]
30
- r"""A value in string format that is a large number"""
31
- input_audio_cache: NotRequired[str]
32
- r"""A value in string format that is a large number"""
33
- web_search: NotRequired[str]
34
- r"""A value in string format that is a large number"""
35
- internal_reasoning: NotRequired[str]
36
- r"""A value in string format that is a large number"""
37
- input_cache_read: NotRequired[str]
38
- r"""A value in string format that is a large number"""
39
- input_cache_write: NotRequired[str]
40
- r"""A value in string format that is a large number"""
16
+ prompt: Any
17
+ r"""A value in string or number format that is a large number"""
18
+ completion: Any
19
+ r"""A value in string or number format that is a large number"""
20
+ request: NotRequired[Any]
21
+ r"""A value in string or number format that is a large number"""
22
+ image: NotRequired[Any]
23
+ r"""A value in string or number format that is a large number"""
24
+ image_token: NotRequired[Any]
25
+ r"""A value in string or number format that is a large number"""
26
+ image_output: NotRequired[Any]
27
+ r"""A value in string or number format that is a large number"""
28
+ audio: NotRequired[Any]
29
+ r"""A value in string or number format that is a large number"""
30
+ input_audio_cache: NotRequired[Any]
31
+ r"""A value in string or number format that is a large number"""
32
+ web_search: NotRequired[Any]
33
+ r"""A value in string or number format that is a large number"""
34
+ internal_reasoning: NotRequired[Any]
35
+ r"""A value in string or number format that is a large number"""
36
+ input_cache_read: NotRequired[Any]
37
+ r"""A value in string or number format that is a large number"""
38
+ input_cache_write: NotRequired[Any]
39
+ r"""A value in string or number format that is a large number"""
41
40
  discount: NotRequired[float]
42
41
 
43
42
 
44
43
  class Pricing(BaseModel):
45
- prompt: str
46
- r"""A value in string format that is a large number"""
44
+ prompt: Any
45
+ r"""A value in string or number format that is a large number"""
47
46
 
48
- completion: str
49
- r"""A value in string format that is a large number"""
47
+ completion: Any
48
+ r"""A value in string or number format that is a large number"""
50
49
 
51
- request: Optional[str] = None
52
- r"""A value in string format that is a large number"""
50
+ request: Optional[Any] = None
51
+ r"""A value in string or number format that is a large number"""
53
52
 
54
- image: Optional[str] = None
55
- r"""A value in string format that is a large number"""
53
+ image: Optional[Any] = None
54
+ r"""A value in string or number format that is a large number"""
56
55
 
57
- image_token: Optional[str] = None
58
- r"""A value in string format that is a large number"""
56
+ image_token: Optional[Any] = None
57
+ r"""A value in string or number format that is a large number"""
59
58
 
60
- image_output: Optional[str] = None
61
- r"""A value in string format that is a large number"""
59
+ image_output: Optional[Any] = None
60
+ r"""A value in string or number format that is a large number"""
62
61
 
63
- audio: Optional[str] = None
64
- r"""A value in string format that is a large number"""
62
+ audio: Optional[Any] = None
63
+ r"""A value in string or number format that is a large number"""
65
64
 
66
- input_audio_cache: Optional[str] = None
67
- r"""A value in string format that is a large number"""
65
+ input_audio_cache: Optional[Any] = None
66
+ r"""A value in string or number format that is a large number"""
68
67
 
69
- web_search: Optional[str] = None
70
- r"""A value in string format that is a large number"""
68
+ web_search: Optional[Any] = None
69
+ r"""A value in string or number format that is a large number"""
71
70
 
72
- internal_reasoning: Optional[str] = None
73
- r"""A value in string format that is a large number"""
71
+ internal_reasoning: Optional[Any] = None
72
+ r"""A value in string or number format that is a large number"""
74
73
 
75
- input_cache_read: Optional[str] = None
76
- r"""A value in string format that is a large number"""
74
+ input_cache_read: Optional[Any] = None
75
+ r"""A value in string or number format that is a large number"""
77
76
 
78
- input_cache_write: Optional[str] = None
79
- r"""A value in string format that is a large number"""
77
+ input_cache_write: Optional[Any] = None
78
+ r"""A value in string or number format that is a large number"""
80
79
 
81
80
  discount: Optional[float] = None
82
81
 
@@ -112,9 +111,6 @@ class PublicEndpointTypedDict(TypedDict):
112
111
  supported_parameters: List[Parameter]
113
112
  uptime_last_30m: Nullable[float]
114
113
  supports_implicit_caching: bool
115
- latency_last_30m: Nullable[PercentileStatsTypedDict]
116
- r"""Latency percentiles in milliseconds over the last 30 minutes. Latency measures time to first token. Only visible when authenticated with an API key or cookie; returns null for unauthenticated requests."""
117
- throughput_last_30m: Nullable[PercentileStatsTypedDict]
118
114
  status: NotRequired[EndpointStatus]
119
115
 
120
116
 
@@ -149,11 +145,6 @@ class PublicEndpoint(BaseModel):
149
145
 
150
146
  supports_implicit_caching: bool
151
147
 
152
- latency_last_30m: Nullable[PercentileStats]
153
- r"""Latency percentiles in milliseconds over the last 30 minutes. Latency measures time to first token. Only visible when authenticated with an API key or cookie; returns null for unauthenticated requests."""
154
-
155
- throughput_last_30m: Nullable[PercentileStats]
156
-
157
148
  status: Annotated[
158
149
  Optional[EndpointStatus], PlainValidator(validate_open_enum(True))
159
150
  ] = None
@@ -166,8 +157,6 @@ class PublicEndpoint(BaseModel):
166
157
  "max_completion_tokens",
167
158
  "max_prompt_tokens",
168
159
  "uptime_last_30m",
169
- "latency_last_30m",
170
- "throughput_last_30m",
171
160
  ]
172
161
  null_default_fields = []
173
162
 
@@ -2,77 +2,77 @@
2
2
 
3
3
  from __future__ import annotations
4
4
  from openrouter.types import BaseModel
5
- from typing import Optional
5
+ from typing import Any, Optional
6
6
  from typing_extensions import NotRequired, TypedDict
7
7
 
8
8
 
9
9
  class PublicPricingTypedDict(TypedDict):
10
10
  r"""Pricing information for the model"""
11
11
 
12
- prompt: str
13
- r"""A value in string format that is a large number"""
14
- completion: str
15
- r"""A value in string format that is a large number"""
16
- request: NotRequired[str]
17
- r"""A value in string format that is a large number"""
18
- image: NotRequired[str]
19
- r"""A value in string format that is a large number"""
20
- image_token: NotRequired[str]
21
- r"""A value in string format that is a large number"""
22
- image_output: NotRequired[str]
23
- r"""A value in string format that is a large number"""
24
- audio: NotRequired[str]
25
- r"""A value in string format that is a large number"""
26
- input_audio_cache: NotRequired[str]
27
- r"""A value in string format that is a large number"""
28
- web_search: NotRequired[str]
29
- r"""A value in string format that is a large number"""
30
- internal_reasoning: NotRequired[str]
31
- r"""A value in string format that is a large number"""
32
- input_cache_read: NotRequired[str]
33
- r"""A value in string format that is a large number"""
34
- input_cache_write: NotRequired[str]
35
- r"""A value in string format that is a large number"""
12
+ prompt: Any
13
+ r"""A value in string or number format that is a large number"""
14
+ completion: Any
15
+ r"""A value in string or number format that is a large number"""
16
+ request: NotRequired[Any]
17
+ r"""A value in string or number format that is a large number"""
18
+ image: NotRequired[Any]
19
+ r"""A value in string or number format that is a large number"""
20
+ image_token: NotRequired[Any]
21
+ r"""A value in string or number format that is a large number"""
22
+ image_output: NotRequired[Any]
23
+ r"""A value in string or number format that is a large number"""
24
+ audio: NotRequired[Any]
25
+ r"""A value in string or number format that is a large number"""
26
+ input_audio_cache: NotRequired[Any]
27
+ r"""A value in string or number format that is a large number"""
28
+ web_search: NotRequired[Any]
29
+ r"""A value in string or number format that is a large number"""
30
+ internal_reasoning: NotRequired[Any]
31
+ r"""A value in string or number format that is a large number"""
32
+ input_cache_read: NotRequired[Any]
33
+ r"""A value in string or number format that is a large number"""
34
+ input_cache_write: NotRequired[Any]
35
+ r"""A value in string or number format that is a large number"""
36
36
  discount: NotRequired[float]
37
37
 
38
38
 
39
39
  class PublicPricing(BaseModel):
40
40
  r"""Pricing information for the model"""
41
41
 
42
- prompt: str
43
- r"""A value in string format that is a large number"""
42
+ prompt: Any
43
+ r"""A value in string or number format that is a large number"""
44
44
 
45
- completion: str
46
- r"""A value in string format that is a large number"""
45
+ completion: Any
46
+ r"""A value in string or number format that is a large number"""
47
47
 
48
- request: Optional[str] = None
49
- r"""A value in string format that is a large number"""
48
+ request: Optional[Any] = None
49
+ r"""A value in string or number format that is a large number"""
50
50
 
51
- image: Optional[str] = None
52
- r"""A value in string format that is a large number"""
51
+ image: Optional[Any] = None
52
+ r"""A value in string or number format that is a large number"""
53
53
 
54
- image_token: Optional[str] = None
55
- r"""A value in string format that is a large number"""
54
+ image_token: Optional[Any] = None
55
+ r"""A value in string or number format that is a large number"""
56
56
 
57
- image_output: Optional[str] = None
58
- r"""A value in string format that is a large number"""
57
+ image_output: Optional[Any] = None
58
+ r"""A value in string or number format that is a large number"""
59
59
 
60
- audio: Optional[str] = None
61
- r"""A value in string format that is a large number"""
60
+ audio: Optional[Any] = None
61
+ r"""A value in string or number format that is a large number"""
62
62
 
63
- input_audio_cache: Optional[str] = None
64
- r"""A value in string format that is a large number"""
63
+ input_audio_cache: Optional[Any] = None
64
+ r"""A value in string or number format that is a large number"""
65
65
 
66
- web_search: Optional[str] = None
67
- r"""A value in string format that is a large number"""
66
+ web_search: Optional[Any] = None
67
+ r"""A value in string or number format that is a large number"""
68
68
 
69
- internal_reasoning: Optional[str] = None
70
- r"""A value in string format that is a large number"""
69
+ internal_reasoning: Optional[Any] = None
70
+ r"""A value in string or number format that is a large number"""
71
71
 
72
- input_cache_read: Optional[str] = None
73
- r"""A value in string format that is a large number"""
72
+ input_cache_read: Optional[Any] = None
73
+ r"""A value in string or number format that is a large number"""
74
74
 
75
- input_cache_write: Optional[str] = None
76
- r"""A value in string format that is a large number"""
75
+ input_cache_write: Optional[Any] = None
76
+ r"""A value in string or number format that is a large number"""
77
77
 
78
78
  discount: Optional[float] = None
@@ -10,10 +10,8 @@ from .responsesformattextjsonschemaconfig import (
10
10
  ResponsesFormatTextJSONSchemaConfig,
11
11
  ResponsesFormatTextJSONSchemaConfigTypedDict,
12
12
  )
13
- from openrouter.utils import get_discriminator
14
- from pydantic import Discriminator, Tag
15
13
  from typing import Union
16
- from typing_extensions import Annotated, TypeAliasType
14
+ from typing_extensions import TypeAliasType
17
15
 
18
16
 
19
17
  ResponseFormatTextConfigTypedDict = TypeAliasType(
@@ -27,12 +25,12 @@ ResponseFormatTextConfigTypedDict = TypeAliasType(
27
25
  r"""Text response format configuration"""
28
26
 
29
27
 
30
- ResponseFormatTextConfig = Annotated[
28
+ ResponseFormatTextConfig = TypeAliasType(
29
+ "ResponseFormatTextConfig",
31
30
  Union[
32
- Annotated[ResponsesFormatText, Tag("text")],
33
- Annotated[ResponsesFormatJSONObject, Tag("json_object")],
34
- Annotated[ResponsesFormatTextJSONSchemaConfig, Tag("json_schema")],
31
+ ResponsesFormatText,
32
+ ResponsesFormatJSONObject,
33
+ ResponsesFormatTextJSONSchemaConfig,
35
34
  ],
36
- Discriminator(lambda m: get_discriminator(m, "type", "type")),
37
- ]
35
+ )
38
36
  r"""Text response format configuration"""
@@ -6,50 +6,17 @@ from .openairesponsesannotation import (
6
6
  OpenAIResponsesAnnotationTypedDict,
7
7
  )
8
8
  from openrouter.types import BaseModel
9
- import pydantic
10
9
  from typing import List, Literal, Optional
11
- from typing_extensions import Annotated, NotRequired, TypedDict
10
+ from typing_extensions import NotRequired, TypedDict
12
11
 
13
12
 
14
13
  ResponseOutputTextType = Literal["output_text",]
15
14
 
16
15
 
17
- class ResponseOutputTextTopLogprobTypedDict(TypedDict):
18
- token: str
19
- bytes_: List[float]
20
- logprob: float
21
-
22
-
23
- class ResponseOutputTextTopLogprob(BaseModel):
24
- token: str
25
-
26
- bytes_: Annotated[List[float], pydantic.Field(alias="bytes")]
27
-
28
- logprob: float
29
-
30
-
31
- class LogprobTypedDict(TypedDict):
32
- token: str
33
- bytes_: List[float]
34
- logprob: float
35
- top_logprobs: List[ResponseOutputTextTopLogprobTypedDict]
36
-
37
-
38
- class Logprob(BaseModel):
39
- token: str
40
-
41
- bytes_: Annotated[List[float], pydantic.Field(alias="bytes")]
42
-
43
- logprob: float
44
-
45
- top_logprobs: List[ResponseOutputTextTopLogprob]
46
-
47
-
48
16
  class ResponseOutputTextTypedDict(TypedDict):
49
17
  type: ResponseOutputTextType
50
18
  text: str
51
19
  annotations: NotRequired[List[OpenAIResponsesAnnotationTypedDict]]
52
- logprobs: NotRequired[List[LogprobTypedDict]]
53
20
 
54
21
 
55
22
  class ResponseOutputText(BaseModel):
@@ -58,5 +25,3 @@ class ResponseOutputText(BaseModel):
58
25
  text: str
59
26
 
60
27
  annotations: Optional[List[OpenAIResponsesAnnotation]] = None
61
-
62
- logprobs: Optional[List[Logprob]] = None