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.
- openrouter/_version.py +3 -3
- openrouter/analytics.py +0 -2
- openrouter/api_keys.py +4 -24
- openrouter/basesdk.py +0 -6
- openrouter/chat.py +14 -212
- openrouter/completions.py +0 -2
- openrouter/components/__init__.py +105 -447
- openrouter/components/chatgenerationparams.py +17 -559
- openrouter/components/chatgenerationtokenusage.py +0 -3
- openrouter/components/chatmessagecontentitem.py +1 -1
- openrouter/components/chatmessagecontentitemaudio.py +25 -6
- openrouter/components/chatmessagecontentitemtext.py +2 -9
- openrouter/components/chatmessagecontentitemvideo.py +5 -9
- openrouter/components/chatmessagetokenlogprob.py +4 -4
- openrouter/components/chatresponsechoice.py +67 -6
- openrouter/components/chatstreamingmessagechunk.py +1 -12
- openrouter/components/chatstreamingresponsechunk.py +1 -1
- openrouter/components/completionchoice.py +5 -18
- openrouter/components/completioncreateparams.py +10 -10
- openrouter/components/completionresponse.py +0 -3
- openrouter/components/message.py +9 -10
- openrouter/components/openairesponsesannotation.py +4 -11
- openrouter/components/openairesponsesreasoningeffort.py +0 -1
- openrouter/components/openresponseseasyinputmessage.py +20 -93
- openrouter/components/openresponsesinput.py +2 -2
- openrouter/components/openresponsesinputmessageitem.py +14 -87
- openrouter/components/openresponsesnonstreamingresponse.py +19 -33
- openrouter/components/openresponsesreasoning.py +0 -1
- openrouter/components/openresponsesrequest.py +119 -246
- openrouter/components/openresponsesstreamevent.py +39 -110
- openrouter/components/outputmessage.py +4 -10
- openrouter/components/parameter.py +0 -1
- openrouter/components/providername.py +2 -10
- openrouter/components/providersort.py +1 -0
- openrouter/components/publicendpoint.py +49 -60
- openrouter/components/publicpricing.py +49 -49
- openrouter/components/responseformattextconfig.py +7 -9
- openrouter/components/responseoutputtext.py +1 -36
- openrouter/components/responsesoutputitem.py +11 -13
- openrouter/components/responsesoutputitemreasoning.py +3 -43
- openrouter/components/responsesoutputmessage.py +5 -10
- openrouter/credits.py +0 -4
- openrouter/embeddings.py +8 -10
- openrouter/endpoints.py +0 -4
- openrouter/generations.py +0 -2
- openrouter/models_.py +0 -6
- openrouter/oauth.py +0 -4
- openrouter/operations/__init__.py +34 -10
- openrouter/operations/createembeddings.py +247 -16
- openrouter/operations/getcredits.py +0 -19
- openrouter/operations/getgeneration.py +0 -6
- openrouter/operations/getparameters.py +71 -5
- openrouter/operations/updatekeys.py +2 -2
- openrouter/parameters.py +2 -4
- openrouter/providers.py +0 -2
- openrouter/responses.py +36 -188
- openrouter/sdk.py +0 -13
- openrouter/sdkconfiguration.py +0 -2
- openrouter/utils/forms.py +10 -21
- openrouter/utils/queryparams.py +2 -14
- openrouter/utils/retries.py +5 -69
- {openrouter-0.0.18.dist-info → openrouter-0.0.19.dist-info}/METADATA +1 -1
- {openrouter-0.0.18.dist-info → openrouter-0.0.19.dist-info}/RECORD +66 -87
- openrouter/components/_schema0.py +0 -94
- openrouter/components/_schema3.py +0 -229
- openrouter/components/chatcompletionfinishreason.py +0 -17
- openrouter/components/chatmessagecontentitemcachecontrol.py +0 -32
- openrouter/components/chatstreamingchoice.py +0 -72
- openrouter/components/pdfparserengine.py +0 -16
- openrouter/components/pdfparseroptions.py +0 -25
- openrouter/components/percentilelatencycutoffs.py +0 -71
- openrouter/components/percentilestats.py +0 -34
- openrouter/components/percentilethroughputcutoffs.py +0 -71
- openrouter/components/preferredmaxlatency.py +0 -21
- openrouter/components/preferredminthroughput.py +0 -22
- openrouter/components/providerpreferences.py +0 -355
- openrouter/components/providersortconfig.py +0 -71
- openrouter/components/providersortunion.py +0 -23
- openrouter/components/responseinputvideo.py +0 -26
- openrouter/components/responsesoutputmodality.py +0 -14
- openrouter/components/websearchengine.py +0 -15
- openrouter/models/__init__.py +0 -3
- openrouter/models/internal/__init__.py +0 -54
- openrouter/models/internal/globals.py +0 -41
- {openrouter-0.0.18.dist-info → openrouter-0.0.19.dist-info}/WHEEL +0 -0
- {openrouter-0.0.18.dist-info → openrouter-0.0.19.dist-info}/licenses/LICENSE +0 -0
- {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
|
|
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 =
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
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 =
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
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 =
|
|
612
|
+
OpenResponsesStreamEvent = TypeAliasType(
|
|
613
|
+
"OpenResponsesStreamEvent",
|
|
623
614
|
Union[
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
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
|
-
|
|
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
|
|
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 =
|
|
58
|
-
Union[
|
|
59
|
-
|
|
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):
|
|
@@ -11,14 +11,12 @@ ProviderName = Union[
|
|
|
11
11
|
"AionLabs",
|
|
12
12
|
"Alibaba",
|
|
13
13
|
"Amazon Bedrock",
|
|
14
|
-
"Amazon Nova",
|
|
15
14
|
"Anthropic",
|
|
16
|
-
"Arcee
|
|
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",
|
|
@@ -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:
|
|
18
|
-
r"""A value in string format that is a large number"""
|
|
19
|
-
completion:
|
|
20
|
-
r"""A value in string format that is a large number"""
|
|
21
|
-
request: NotRequired[
|
|
22
|
-
r"""A value in string format that is a large number"""
|
|
23
|
-
image: NotRequired[
|
|
24
|
-
r"""A value in string format that is a large number"""
|
|
25
|
-
image_token: NotRequired[
|
|
26
|
-
r"""A value in string format that is a large number"""
|
|
27
|
-
image_output: NotRequired[
|
|
28
|
-
r"""A value in string format that is a large number"""
|
|
29
|
-
audio: NotRequired[
|
|
30
|
-
r"""A value in string format that is a large number"""
|
|
31
|
-
input_audio_cache: NotRequired[
|
|
32
|
-
r"""A value in string format that is a large number"""
|
|
33
|
-
web_search: NotRequired[
|
|
34
|
-
r"""A value in string format that is a large number"""
|
|
35
|
-
internal_reasoning: NotRequired[
|
|
36
|
-
r"""A value in string format that is a large number"""
|
|
37
|
-
input_cache_read: NotRequired[
|
|
38
|
-
r"""A value in string format that is a large number"""
|
|
39
|
-
input_cache_write: NotRequired[
|
|
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:
|
|
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:
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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:
|
|
13
|
-
r"""A value in string format that is a large number"""
|
|
14
|
-
completion:
|
|
15
|
-
r"""A value in string format that is a large number"""
|
|
16
|
-
request: NotRequired[
|
|
17
|
-
r"""A value in string format that is a large number"""
|
|
18
|
-
image: NotRequired[
|
|
19
|
-
r"""A value in string format that is a large number"""
|
|
20
|
-
image_token: NotRequired[
|
|
21
|
-
r"""A value in string format that is a large number"""
|
|
22
|
-
image_output: NotRequired[
|
|
23
|
-
r"""A value in string format that is a large number"""
|
|
24
|
-
audio: NotRequired[
|
|
25
|
-
r"""A value in string format that is a large number"""
|
|
26
|
-
input_audio_cache: NotRequired[
|
|
27
|
-
r"""A value in string format that is a large number"""
|
|
28
|
-
web_search: NotRequired[
|
|
29
|
-
r"""A value in string format that is a large number"""
|
|
30
|
-
internal_reasoning: NotRequired[
|
|
31
|
-
r"""A value in string format that is a large number"""
|
|
32
|
-
input_cache_read: NotRequired[
|
|
33
|
-
r"""A value in string format that is a large number"""
|
|
34
|
-
input_cache_write: NotRequired[
|
|
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:
|
|
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:
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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
|
|
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 =
|
|
28
|
+
ResponseFormatTextConfig = TypeAliasType(
|
|
29
|
+
"ResponseFormatTextConfig",
|
|
31
30
|
Union[
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
ResponsesFormatText,
|
|
32
|
+
ResponsesFormatJSONObject,
|
|
33
|
+
ResponsesFormatTextJSONSchemaConfig,
|
|
35
34
|
],
|
|
36
|
-
|
|
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
|
|
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
|