openrouter 0.1.2__py3-none-any.whl → 0.1.3__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 +2 -2
- openrouter/analytics.py +2 -2
- openrouter/api_keys.py +20 -0
- openrouter/components/__init__.py +46 -34
- openrouter/components/{_schema3.py → _schema2.py} +22 -22
- openrouter/components/assistantmessage.py +32 -1
- openrouter/components/chatmessagecontentitemimage.py +4 -4
- openrouter/components/chatresponsechoice.py +1 -6
- openrouter/components/chatstreamingmessagechunk.py +3 -3
- openrouter/components/model.py +7 -1
- openrouter/components/outputmodality.py +1 -0
- openrouter/components/publicendpoint.py +10 -0
- openrouter/components/publicpricing.py +5 -0
- openrouter/credits.py +2 -2
- openrouter/guardrails.py +3017 -0
- openrouter/models_.py +4 -4
- openrouter/operations/__init__.py +281 -30
- openrouter/operations/bulkassignkeystoguardrail.py +49 -0
- openrouter/operations/bulkassignmemberstoguardrail.py +49 -0
- openrouter/operations/bulkunassignkeysfromguardrail.py +49 -0
- openrouter/operations/bulkunassignmembersfromguardrail.py +49 -0
- openrouter/operations/createguardrail.py +247 -0
- openrouter/operations/deleteguardrail.py +38 -0
- openrouter/operations/getguardrail.py +161 -0
- openrouter/operations/getmodels.py +28 -5
- openrouter/operations/listguardrailkeyassignments.py +125 -0
- openrouter/operations/listguardrailmemberassignments.py +120 -0
- openrouter/operations/listguardrails.py +171 -0
- openrouter/operations/listkeyassignments.py +118 -0
- openrouter/operations/listmemberassignments.py +113 -0
- openrouter/operations/updateguardrail.py +271 -0
- openrouter/sdk.py +4 -4
- openrouter/types/models.py +378 -0
- {openrouter-0.1.2.dist-info → openrouter-0.1.3.dist-info}/METADATA +1 -1
- {openrouter-0.1.2.dist-info → openrouter-0.1.3.dist-info}/RECORD +38 -25
- openrouter/operations/getparameters.py +0 -123
- openrouter/parameters.py +0 -237
- {openrouter-0.1.2.dist-info → openrouter-0.1.3.dist-info}/WHEEL +0 -0
- {openrouter-0.1.2.dist-info → openrouter-0.1.3.dist-info}/licenses/LICENSE +0 -0
- {openrouter-0.1.2.dist-info → openrouter-0.1.3.dist-info}/top_level.txt +0 -0
openrouter/_version.py
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import importlib.metadata
|
|
4
4
|
|
|
5
5
|
__title__: str = "openrouter"
|
|
6
|
-
__version__: str = "0.1.
|
|
6
|
+
__version__: str = "0.1.3"
|
|
7
7
|
__openapi_doc_version__: str = "1.0.0"
|
|
8
8
|
__gen_version__: str = "2.768.0"
|
|
9
|
-
__user_agent__: str = "speakeasy-sdk/python 0.1.
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 0.1.3 2.768.0 1.0.0 openrouter"
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
if __package__ is not None:
|
openrouter/analytics.py
CHANGED
|
@@ -23,7 +23,7 @@ class Analytics(BaseSDK):
|
|
|
23
23
|
) -> operations.GetUserActivityResponse:
|
|
24
24
|
r"""Get user activity grouped by endpoint
|
|
25
25
|
|
|
26
|
-
Returns user activity data grouped by endpoint for the last 30 (completed) UTC days
|
|
26
|
+
Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
27
27
|
|
|
28
28
|
:param date_: Filter by a single UTC date in the last 30 days (YYYY-MM-DD format).
|
|
29
29
|
:param retries: Override the default retry configuration for this method
|
|
@@ -132,7 +132,7 @@ class Analytics(BaseSDK):
|
|
|
132
132
|
) -> operations.GetUserActivityResponse:
|
|
133
133
|
r"""Get user activity grouped by endpoint
|
|
134
134
|
|
|
135
|
-
Returns user activity data grouped by endpoint for the last 30 (completed) UTC days
|
|
135
|
+
Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
136
136
|
|
|
137
137
|
:param date_: Filter by a single UTC date in the last 30 days (YYYY-MM-DD format).
|
|
138
138
|
:param retries: Override the default retry configuration for this method
|
openrouter/api_keys.py
CHANGED
|
@@ -25,6 +25,8 @@ class APIKeys(BaseSDK):
|
|
|
25
25
|
) -> operations.ListResponse:
|
|
26
26
|
r"""List API keys
|
|
27
27
|
|
|
28
|
+
List all API keys for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
29
|
+
|
|
28
30
|
:param include_disabled: Whether to include disabled API keys in the response
|
|
29
31
|
:param offset: Number of API keys to skip for pagination
|
|
30
32
|
:param retries: Override the default retry configuration for this method
|
|
@@ -130,6 +132,8 @@ class APIKeys(BaseSDK):
|
|
|
130
132
|
) -> operations.ListResponse:
|
|
131
133
|
r"""List API keys
|
|
132
134
|
|
|
135
|
+
List all API keys for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
136
|
+
|
|
133
137
|
:param include_disabled: Whether to include disabled API keys in the response
|
|
134
138
|
:param offset: Number of API keys to skip for pagination
|
|
135
139
|
:param retries: Override the default retry configuration for this method
|
|
@@ -238,6 +242,8 @@ class APIKeys(BaseSDK):
|
|
|
238
242
|
) -> operations.CreateKeysResponse:
|
|
239
243
|
r"""Create a new API key
|
|
240
244
|
|
|
245
|
+
Create a new API key for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
246
|
+
|
|
241
247
|
:param name: Name for the new API key
|
|
242
248
|
:param limit: Optional spending limit for the API key in USD
|
|
243
249
|
:param limit_reset: Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday.
|
|
@@ -360,6 +366,8 @@ class APIKeys(BaseSDK):
|
|
|
360
366
|
) -> operations.CreateKeysResponse:
|
|
361
367
|
r"""Create a new API key
|
|
362
368
|
|
|
369
|
+
Create a new API key for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
370
|
+
|
|
363
371
|
:param name: Name for the new API key
|
|
364
372
|
:param limit: Optional spending limit for the API key in USD
|
|
365
373
|
:param limit_reset: Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday.
|
|
@@ -483,6 +491,8 @@ class APIKeys(BaseSDK):
|
|
|
483
491
|
) -> operations.UpdateKeysResponse:
|
|
484
492
|
r"""Update an API key
|
|
485
493
|
|
|
494
|
+
Update an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
495
|
+
|
|
486
496
|
:param hash: The hash identifier of the API key to update
|
|
487
497
|
:param name: New name for the API key
|
|
488
498
|
:param disabled: Whether to disable the API key
|
|
@@ -619,6 +629,8 @@ class APIKeys(BaseSDK):
|
|
|
619
629
|
) -> operations.UpdateKeysResponse:
|
|
620
630
|
r"""Update an API key
|
|
621
631
|
|
|
632
|
+
Update an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
633
|
+
|
|
622
634
|
:param hash: The hash identifier of the API key to update
|
|
623
635
|
:param name: New name for the API key
|
|
624
636
|
:param disabled: Whether to disable the API key
|
|
@@ -750,6 +762,8 @@ class APIKeys(BaseSDK):
|
|
|
750
762
|
) -> operations.DeleteKeysResponse:
|
|
751
763
|
r"""Delete an API key
|
|
752
764
|
|
|
765
|
+
Delete an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
766
|
+
|
|
753
767
|
:param hash: The hash identifier of the API key to delete
|
|
754
768
|
:param retries: Override the default retry configuration for this method
|
|
755
769
|
:param server_url: Override the default server URL for this method
|
|
@@ -857,6 +871,8 @@ class APIKeys(BaseSDK):
|
|
|
857
871
|
) -> operations.DeleteKeysResponse:
|
|
858
872
|
r"""Delete an API key
|
|
859
873
|
|
|
874
|
+
Delete an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
875
|
+
|
|
860
876
|
:param hash: The hash identifier of the API key to delete
|
|
861
877
|
:param retries: Override the default retry configuration for this method
|
|
862
878
|
:param server_url: Override the default server URL for this method
|
|
@@ -964,6 +980,8 @@ class APIKeys(BaseSDK):
|
|
|
964
980
|
) -> operations.GetKeyResponse:
|
|
965
981
|
r"""Get a single API key
|
|
966
982
|
|
|
983
|
+
Get a single API key by hash. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
984
|
+
|
|
967
985
|
:param hash: The hash identifier of the API key to retrieve
|
|
968
986
|
:param retries: Override the default retry configuration for this method
|
|
969
987
|
:param server_url: Override the default server URL for this method
|
|
@@ -1071,6 +1089,8 @@ class APIKeys(BaseSDK):
|
|
|
1071
1089
|
) -> operations.GetKeyResponse:
|
|
1072
1090
|
r"""Get a single API key
|
|
1073
1091
|
|
|
1092
|
+
Get a single API key by hash. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
1093
|
+
|
|
1074
1094
|
:param hash: The hash identifier of the API key to retrieve
|
|
1075
1095
|
:param retries: Override the default retry configuration for this method
|
|
1076
1096
|
:param server_url: Override the default server URL for this method
|
|
@@ -7,23 +7,27 @@ import sys
|
|
|
7
7
|
|
|
8
8
|
if TYPE_CHECKING:
|
|
9
9
|
from ._schema0 import Schema0, Schema0Enum, Schema0TypedDict
|
|
10
|
-
from .
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
from ._schema2 import (
|
|
11
|
+
Schema2,
|
|
12
|
+
Schema2ReasoningEncrypted,
|
|
13
|
+
Schema2ReasoningEncryptedTypedDict,
|
|
14
|
+
Schema2ReasoningSummary,
|
|
15
|
+
Schema2ReasoningSummaryTypedDict,
|
|
16
|
+
Schema2ReasoningText,
|
|
17
|
+
Schema2ReasoningTextTypedDict,
|
|
18
|
+
Schema2TypedDict,
|
|
19
|
+
Schema4,
|
|
20
20
|
)
|
|
21
21
|
from .activityitem import ActivityItem, ActivityItemTypedDict
|
|
22
22
|
from .assistantmessage import (
|
|
23
23
|
AssistantMessage,
|
|
24
24
|
AssistantMessageContent,
|
|
25
25
|
AssistantMessageContentTypedDict,
|
|
26
|
+
AssistantMessageImageURL,
|
|
27
|
+
AssistantMessageImageURLTypedDict,
|
|
26
28
|
AssistantMessageTypedDict,
|
|
29
|
+
Image,
|
|
30
|
+
ImageTypedDict,
|
|
27
31
|
)
|
|
28
32
|
from .badgatewayresponseerrordata import (
|
|
29
33
|
BadGatewayResponseErrorData,
|
|
@@ -114,9 +118,9 @@ if TYPE_CHECKING:
|
|
|
114
118
|
from .chatmessagecontentitemimage import (
|
|
115
119
|
ChatMessageContentItemImage,
|
|
116
120
|
ChatMessageContentItemImageDetail,
|
|
121
|
+
ChatMessageContentItemImageImageURL,
|
|
122
|
+
ChatMessageContentItemImageImageURLTypedDict,
|
|
117
123
|
ChatMessageContentItemImageTypedDict,
|
|
118
|
-
ImageURL,
|
|
119
|
-
ImageURLTypedDict,
|
|
120
124
|
)
|
|
121
125
|
from .chatmessagecontentitemtext import (
|
|
122
126
|
ChatMessageContentItemText,
|
|
@@ -913,6 +917,8 @@ __all__ = [
|
|
|
913
917
|
"AssistantMessage",
|
|
914
918
|
"AssistantMessageContent",
|
|
915
919
|
"AssistantMessageContentTypedDict",
|
|
920
|
+
"AssistantMessageImageURL",
|
|
921
|
+
"AssistantMessageImageURLTypedDict",
|
|
916
922
|
"AssistantMessageTypedDict",
|
|
917
923
|
"BadGatewayResponseErrorData",
|
|
918
924
|
"BadGatewayResponseErrorDataTypedDict",
|
|
@@ -972,6 +978,8 @@ __all__ = [
|
|
|
972
978
|
"ChatMessageContentItemCacheControlTypedDict",
|
|
973
979
|
"ChatMessageContentItemImage",
|
|
974
980
|
"ChatMessageContentItemImageDetail",
|
|
981
|
+
"ChatMessageContentItemImageImageURL",
|
|
982
|
+
"ChatMessageContentItemImageImageURLTypedDict",
|
|
975
983
|
"ChatMessageContentItemImageTypedDict",
|
|
976
984
|
"ChatMessageContentItemText",
|
|
977
985
|
"ChatMessageContentItemTextTypedDict",
|
|
@@ -1066,9 +1074,9 @@ __all__ = [
|
|
|
1066
1074
|
"IDModeration",
|
|
1067
1075
|
"IDResponseHealing",
|
|
1068
1076
|
"IDWeb",
|
|
1077
|
+
"Image",
|
|
1069
1078
|
"ImageGenerationStatus",
|
|
1070
|
-
"
|
|
1071
|
-
"ImageURLTypedDict",
|
|
1079
|
+
"ImageTypedDict",
|
|
1072
1080
|
"InputModality",
|
|
1073
1081
|
"InputTokensDetails",
|
|
1074
1082
|
"InputTokensDetailsTypedDict",
|
|
@@ -1540,15 +1548,15 @@ __all__ = [
|
|
|
1540
1548
|
"Schema0",
|
|
1541
1549
|
"Schema0Enum",
|
|
1542
1550
|
"Schema0TypedDict",
|
|
1543
|
-
"
|
|
1544
|
-
"
|
|
1545
|
-
"
|
|
1546
|
-
"
|
|
1547
|
-
"
|
|
1548
|
-
"
|
|
1549
|
-
"
|
|
1550
|
-
"
|
|
1551
|
-
"
|
|
1551
|
+
"Schema2",
|
|
1552
|
+
"Schema2ReasoningEncrypted",
|
|
1553
|
+
"Schema2ReasoningEncryptedTypedDict",
|
|
1554
|
+
"Schema2ReasoningSummary",
|
|
1555
|
+
"Schema2ReasoningSummaryTypedDict",
|
|
1556
|
+
"Schema2ReasoningText",
|
|
1557
|
+
"Schema2ReasoningTextTypedDict",
|
|
1558
|
+
"Schema2TypedDict",
|
|
1559
|
+
"Schema4",
|
|
1552
1560
|
"Security",
|
|
1553
1561
|
"SecurityTypedDict",
|
|
1554
1562
|
"ServiceTier",
|
|
@@ -1624,21 +1632,25 @@ _dynamic_imports: dict[str, str] = {
|
|
|
1624
1632
|
"Schema0": "._schema0",
|
|
1625
1633
|
"Schema0Enum": "._schema0",
|
|
1626
1634
|
"Schema0TypedDict": "._schema0",
|
|
1627
|
-
"
|
|
1628
|
-
"
|
|
1629
|
-
"
|
|
1630
|
-
"
|
|
1631
|
-
"
|
|
1632
|
-
"
|
|
1633
|
-
"
|
|
1634
|
-
"
|
|
1635
|
-
"
|
|
1635
|
+
"Schema2": "._schema2",
|
|
1636
|
+
"Schema2ReasoningEncrypted": "._schema2",
|
|
1637
|
+
"Schema2ReasoningEncryptedTypedDict": "._schema2",
|
|
1638
|
+
"Schema2ReasoningSummary": "._schema2",
|
|
1639
|
+
"Schema2ReasoningSummaryTypedDict": "._schema2",
|
|
1640
|
+
"Schema2ReasoningText": "._schema2",
|
|
1641
|
+
"Schema2ReasoningTextTypedDict": "._schema2",
|
|
1642
|
+
"Schema2TypedDict": "._schema2",
|
|
1643
|
+
"Schema4": "._schema2",
|
|
1636
1644
|
"ActivityItem": ".activityitem",
|
|
1637
1645
|
"ActivityItemTypedDict": ".activityitem",
|
|
1638
1646
|
"AssistantMessage": ".assistantmessage",
|
|
1639
1647
|
"AssistantMessageContent": ".assistantmessage",
|
|
1640
1648
|
"AssistantMessageContentTypedDict": ".assistantmessage",
|
|
1649
|
+
"AssistantMessageImageURL": ".assistantmessage",
|
|
1650
|
+
"AssistantMessageImageURLTypedDict": ".assistantmessage",
|
|
1641
1651
|
"AssistantMessageTypedDict": ".assistantmessage",
|
|
1652
|
+
"Image": ".assistantmessage",
|
|
1653
|
+
"ImageTypedDict": ".assistantmessage",
|
|
1642
1654
|
"BadGatewayResponseErrorData": ".badgatewayresponseerrordata",
|
|
1643
1655
|
"BadGatewayResponseErrorDataTypedDict": ".badgatewayresponseerrordata",
|
|
1644
1656
|
"BadRequestResponseErrorData": ".badrequestresponseerrordata",
|
|
@@ -1716,9 +1728,9 @@ _dynamic_imports: dict[str, str] = {
|
|
|
1716
1728
|
"TTL": ".chatmessagecontentitemcachecontrol",
|
|
1717
1729
|
"ChatMessageContentItemImage": ".chatmessagecontentitemimage",
|
|
1718
1730
|
"ChatMessageContentItemImageDetail": ".chatmessagecontentitemimage",
|
|
1731
|
+
"ChatMessageContentItemImageImageURL": ".chatmessagecontentitemimage",
|
|
1732
|
+
"ChatMessageContentItemImageImageURLTypedDict": ".chatmessagecontentitemimage",
|
|
1719
1733
|
"ChatMessageContentItemImageTypedDict": ".chatmessagecontentitemimage",
|
|
1720
|
-
"ImageURL": ".chatmessagecontentitemimage",
|
|
1721
|
-
"ImageURLTypedDict": ".chatmessagecontentitemimage",
|
|
1722
1734
|
"ChatMessageContentItemText": ".chatmessagecontentitemtext",
|
|
1723
1735
|
"ChatMessageContentItemTextTypedDict": ".chatmessagecontentitemtext",
|
|
1724
1736
|
"ChatMessageContentItemVideo": ".chatmessagecontentitemvideo",
|
|
@@ -17,7 +17,7 @@ from typing import Literal, Optional, Union
|
|
|
17
17
|
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Schema4 = Union[
|
|
21
21
|
Literal[
|
|
22
22
|
"unknown",
|
|
23
23
|
"openai-responses-v1",
|
|
@@ -30,16 +30,16 @@ Schema5 = Union[
|
|
|
30
30
|
]
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
class
|
|
33
|
+
class Schema2ReasoningTextTypedDict(TypedDict):
|
|
34
34
|
type: Literal["reasoning.text"]
|
|
35
35
|
text: NotRequired[Nullable[str]]
|
|
36
36
|
signature: NotRequired[Nullable[str]]
|
|
37
37
|
id: NotRequired[Nullable[str]]
|
|
38
|
-
format_: NotRequired[Nullable[
|
|
38
|
+
format_: NotRequired[Nullable[Schema4]]
|
|
39
39
|
index: NotRequired[float]
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
class
|
|
42
|
+
class Schema2ReasoningText(BaseModel):
|
|
43
43
|
TYPE: Annotated[
|
|
44
44
|
Annotated[
|
|
45
45
|
Literal["reasoning.text"], AfterValidator(validate_const("reasoning.text"))
|
|
@@ -54,7 +54,7 @@ class Schema3ReasoningText(BaseModel):
|
|
|
54
54
|
id: OptionalNullable[str] = UNSET
|
|
55
55
|
|
|
56
56
|
format_: Annotated[
|
|
57
|
-
Annotated[OptionalNullable[
|
|
57
|
+
Annotated[OptionalNullable[Schema4], PlainValidator(validate_open_enum(False))],
|
|
58
58
|
pydantic.Field(alias="format"),
|
|
59
59
|
] = UNSET
|
|
60
60
|
|
|
@@ -91,15 +91,15 @@ class Schema3ReasoningText(BaseModel):
|
|
|
91
91
|
return m
|
|
92
92
|
|
|
93
93
|
|
|
94
|
-
class
|
|
94
|
+
class Schema2ReasoningEncryptedTypedDict(TypedDict):
|
|
95
95
|
data: str
|
|
96
96
|
type: Literal["reasoning.encrypted"]
|
|
97
97
|
id: NotRequired[Nullable[str]]
|
|
98
|
-
format_: NotRequired[Nullable[
|
|
98
|
+
format_: NotRequired[Nullable[Schema4]]
|
|
99
99
|
index: NotRequired[float]
|
|
100
100
|
|
|
101
101
|
|
|
102
|
-
class
|
|
102
|
+
class Schema2ReasoningEncrypted(BaseModel):
|
|
103
103
|
data: str
|
|
104
104
|
|
|
105
105
|
TYPE: Annotated[
|
|
@@ -113,7 +113,7 @@ class Schema3ReasoningEncrypted(BaseModel):
|
|
|
113
113
|
id: OptionalNullable[str] = UNSET
|
|
114
114
|
|
|
115
115
|
format_: Annotated[
|
|
116
|
-
Annotated[OptionalNullable[
|
|
116
|
+
Annotated[OptionalNullable[Schema4], PlainValidator(validate_open_enum(False))],
|
|
117
117
|
pydantic.Field(alias="format"),
|
|
118
118
|
] = UNSET
|
|
119
119
|
|
|
@@ -150,15 +150,15 @@ class Schema3ReasoningEncrypted(BaseModel):
|
|
|
150
150
|
return m
|
|
151
151
|
|
|
152
152
|
|
|
153
|
-
class
|
|
153
|
+
class Schema2ReasoningSummaryTypedDict(TypedDict):
|
|
154
154
|
summary: str
|
|
155
155
|
type: Literal["reasoning.summary"]
|
|
156
156
|
id: NotRequired[Nullable[str]]
|
|
157
|
-
format_: NotRequired[Nullable[
|
|
157
|
+
format_: NotRequired[Nullable[Schema4]]
|
|
158
158
|
index: NotRequired[float]
|
|
159
159
|
|
|
160
160
|
|
|
161
|
-
class
|
|
161
|
+
class Schema2ReasoningSummary(BaseModel):
|
|
162
162
|
summary: str
|
|
163
163
|
|
|
164
164
|
TYPE: Annotated[
|
|
@@ -172,7 +172,7 @@ class Schema3ReasoningSummary(BaseModel):
|
|
|
172
172
|
id: OptionalNullable[str] = UNSET
|
|
173
173
|
|
|
174
174
|
format_: Annotated[
|
|
175
|
-
Annotated[OptionalNullable[
|
|
175
|
+
Annotated[OptionalNullable[Schema4], PlainValidator(validate_open_enum(False))],
|
|
176
176
|
pydantic.Field(alias="format"),
|
|
177
177
|
] = UNSET
|
|
178
178
|
|
|
@@ -209,21 +209,21 @@ class Schema3ReasoningSummary(BaseModel):
|
|
|
209
209
|
return m
|
|
210
210
|
|
|
211
211
|
|
|
212
|
-
|
|
213
|
-
"
|
|
212
|
+
Schema2TypedDict = TypeAliasType(
|
|
213
|
+
"Schema2TypedDict",
|
|
214
214
|
Union[
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
Schema2ReasoningSummaryTypedDict,
|
|
216
|
+
Schema2ReasoningEncryptedTypedDict,
|
|
217
|
+
Schema2ReasoningTextTypedDict,
|
|
218
218
|
],
|
|
219
219
|
)
|
|
220
220
|
|
|
221
221
|
|
|
222
|
-
|
|
222
|
+
Schema2 = Annotated[
|
|
223
223
|
Union[
|
|
224
|
-
Annotated[
|
|
225
|
-
Annotated[
|
|
226
|
-
Annotated[
|
|
224
|
+
Annotated[Schema2ReasoningSummary, Tag("reasoning.summary")],
|
|
225
|
+
Annotated[Schema2ReasoningEncrypted, Tag("reasoning.encrypted")],
|
|
226
|
+
Annotated[Schema2ReasoningText, Tag("reasoning.text")],
|
|
227
227
|
],
|
|
228
228
|
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
|
229
229
|
]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from ._schema2 import Schema2, Schema2TypedDict
|
|
4
5
|
from .chatmessagecontentitem import (
|
|
5
6
|
ChatMessageContentItem,
|
|
6
7
|
ChatMessageContentItemTypedDict,
|
|
@@ -32,6 +33,22 @@ AssistantMessageContent = TypeAliasType(
|
|
|
32
33
|
)
|
|
33
34
|
|
|
34
35
|
|
|
36
|
+
class AssistantMessageImageURLTypedDict(TypedDict):
|
|
37
|
+
url: str
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class AssistantMessageImageURL(BaseModel):
|
|
41
|
+
url: str
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class ImageTypedDict(TypedDict):
|
|
45
|
+
image_url: AssistantMessageImageURLTypedDict
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class Image(BaseModel):
|
|
49
|
+
image_url: AssistantMessageImageURL
|
|
50
|
+
|
|
51
|
+
|
|
35
52
|
class AssistantMessageTypedDict(TypedDict):
|
|
36
53
|
role: Literal["assistant"]
|
|
37
54
|
content: NotRequired[Nullable[AssistantMessageContentTypedDict]]
|
|
@@ -39,6 +56,8 @@ class AssistantMessageTypedDict(TypedDict):
|
|
|
39
56
|
tool_calls: NotRequired[List[ChatMessageToolCallTypedDict]]
|
|
40
57
|
refusal: NotRequired[Nullable[str]]
|
|
41
58
|
reasoning: NotRequired[Nullable[str]]
|
|
59
|
+
reasoning_details: NotRequired[List[Schema2TypedDict]]
|
|
60
|
+
images: NotRequired[List[ImageTypedDict]]
|
|
42
61
|
|
|
43
62
|
|
|
44
63
|
class AssistantMessage(BaseModel):
|
|
@@ -57,9 +76,21 @@ class AssistantMessage(BaseModel):
|
|
|
57
76
|
|
|
58
77
|
reasoning: OptionalNullable[str] = UNSET
|
|
59
78
|
|
|
79
|
+
reasoning_details: Optional[List[Schema2]] = None
|
|
80
|
+
|
|
81
|
+
images: Optional[List[Image]] = None
|
|
82
|
+
|
|
60
83
|
@model_serializer(mode="wrap")
|
|
61
84
|
def serialize_model(self, handler):
|
|
62
|
-
optional_fields = [
|
|
85
|
+
optional_fields = [
|
|
86
|
+
"content",
|
|
87
|
+
"name",
|
|
88
|
+
"tool_calls",
|
|
89
|
+
"refusal",
|
|
90
|
+
"reasoning",
|
|
91
|
+
"reasoning_details",
|
|
92
|
+
"images",
|
|
93
|
+
]
|
|
63
94
|
nullable_fields = ["content", "refusal", "reasoning"]
|
|
64
95
|
null_default_fields = []
|
|
65
96
|
|
|
@@ -19,12 +19,12 @@ ChatMessageContentItemImageDetail = Union[
|
|
|
19
19
|
]
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
class
|
|
22
|
+
class ChatMessageContentItemImageImageURLTypedDict(TypedDict):
|
|
23
23
|
url: str
|
|
24
24
|
detail: NotRequired[ChatMessageContentItemImageDetail]
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
class
|
|
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:
|
|
37
|
+
image_url: ChatMessageContentItemImageImageURLTypedDict
|
|
38
38
|
type: Literal["image_url"]
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
class ChatMessageContentItemImage(BaseModel):
|
|
42
|
-
image_url:
|
|
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 = ["
|
|
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 .
|
|
4
|
+
from ._schema2 import Schema2, Schema2TypedDict
|
|
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[
|
|
30
|
+
reasoning_details: NotRequired[List[Schema2TypedDict]]
|
|
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[
|
|
44
|
+
reasoning_details: Optional[List[Schema2]] = None
|
|
45
45
|
|
|
46
46
|
@model_serializer(mode="wrap")
|
|
47
47
|
def serialize_model(self, handler):
|
openrouter/components/model.py
CHANGED
|
@@ -50,6 +50,8 @@ class ModelTypedDict(TypedDict):
|
|
|
50
50
|
r"""Hugging Face model identifier, if applicable"""
|
|
51
51
|
description: NotRequired[str]
|
|
52
52
|
r"""Description of the model"""
|
|
53
|
+
expiration_date: NotRequired[Nullable[str]]
|
|
54
|
+
r"""The date after which the model may be removed. ISO 8601 date string (YYYY-MM-DD) or null if no expiration."""
|
|
53
55
|
|
|
54
56
|
|
|
55
57
|
class Model(BaseModel):
|
|
@@ -96,14 +98,18 @@ class Model(BaseModel):
|
|
|
96
98
|
description: Optional[str] = None
|
|
97
99
|
r"""Description of the model"""
|
|
98
100
|
|
|
101
|
+
expiration_date: OptionalNullable[str] = UNSET
|
|
102
|
+
r"""The date after which the model may be removed. ISO 8601 date string (YYYY-MM-DD) or null if no expiration."""
|
|
103
|
+
|
|
99
104
|
@model_serializer(mode="wrap")
|
|
100
105
|
def serialize_model(self, handler):
|
|
101
|
-
optional_fields = ["hugging_face_id", "description"]
|
|
106
|
+
optional_fields = ["hugging_face_id", "description", "expiration_date"]
|
|
102
107
|
nullable_fields = [
|
|
103
108
|
"hugging_face_id",
|
|
104
109
|
"context_length",
|
|
105
110
|
"per_request_limits",
|
|
106
111
|
"default_parameters",
|
|
112
|
+
"expiration_date",
|
|
107
113
|
]
|
|
108
114
|
null_default_fields = []
|
|
109
115
|
|
|
@@ -28,6 +28,8 @@ class PricingTypedDict(TypedDict):
|
|
|
28
28
|
r"""A value in string format that is a large number"""
|
|
29
29
|
audio: NotRequired[str]
|
|
30
30
|
r"""A value in string format that is a large number"""
|
|
31
|
+
audio_output: NotRequired[str]
|
|
32
|
+
r"""A value in string format that is a large number"""
|
|
31
33
|
input_audio_cache: NotRequired[str]
|
|
32
34
|
r"""A value in string format that is a large number"""
|
|
33
35
|
web_search: NotRequired[str]
|
|
@@ -63,6 +65,9 @@ class Pricing(BaseModel):
|
|
|
63
65
|
audio: Optional[str] = None
|
|
64
66
|
r"""A value in string format that is a large number"""
|
|
65
67
|
|
|
68
|
+
audio_output: Optional[str] = None
|
|
69
|
+
r"""A value in string format that is a large number"""
|
|
70
|
+
|
|
66
71
|
input_audio_cache: Optional[str] = None
|
|
67
72
|
r"""A value in string format that is a large number"""
|
|
68
73
|
|
|
@@ -101,6 +106,8 @@ class PublicEndpointTypedDict(TypedDict):
|
|
|
101
106
|
r"""Information about a specific model endpoint"""
|
|
102
107
|
|
|
103
108
|
name: str
|
|
109
|
+
model_id: str
|
|
110
|
+
r"""The unique identifier for the model (permaslug)"""
|
|
104
111
|
model_name: str
|
|
105
112
|
context_length: float
|
|
106
113
|
pricing: PricingTypedDict
|
|
@@ -123,6 +130,9 @@ class PublicEndpoint(BaseModel):
|
|
|
123
130
|
|
|
124
131
|
name: str
|
|
125
132
|
|
|
133
|
+
model_id: str
|
|
134
|
+
r"""The unique identifier for the model (permaslug)"""
|
|
135
|
+
|
|
126
136
|
model_name: str
|
|
127
137
|
|
|
128
138
|
context_length: float
|
|
@@ -23,6 +23,8 @@ class PublicPricingTypedDict(TypedDict):
|
|
|
23
23
|
r"""A value in string format that is a large number"""
|
|
24
24
|
audio: NotRequired[str]
|
|
25
25
|
r"""A value in string format that is a large number"""
|
|
26
|
+
audio_output: NotRequired[str]
|
|
27
|
+
r"""A value in string format that is a large number"""
|
|
26
28
|
input_audio_cache: NotRequired[str]
|
|
27
29
|
r"""A value in string format that is a large number"""
|
|
28
30
|
web_search: NotRequired[str]
|
|
@@ -60,6 +62,9 @@ class PublicPricing(BaseModel):
|
|
|
60
62
|
audio: Optional[str] = None
|
|
61
63
|
r"""A value in string format that is a large number"""
|
|
62
64
|
|
|
65
|
+
audio_output: Optional[str] = None
|
|
66
|
+
r"""A value in string format that is a large number"""
|
|
67
|
+
|
|
63
68
|
input_audio_cache: Optional[str] = None
|
|
64
69
|
r"""A value in string format that is a large number"""
|
|
65
70
|
|
openrouter/credits.py
CHANGED
|
@@ -22,7 +22,7 @@ class Credits(BaseSDK):
|
|
|
22
22
|
) -> operations.GetCreditsResponse:
|
|
23
23
|
r"""Get remaining credits
|
|
24
24
|
|
|
25
|
-
Get total credits purchased and used for the authenticated user
|
|
25
|
+
Get total credits purchased and used for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
26
26
|
|
|
27
27
|
:param retries: Override the default retry configuration for this method
|
|
28
28
|
:param server_url: Override the default server URL for this method
|
|
@@ -119,7 +119,7 @@ class Credits(BaseSDK):
|
|
|
119
119
|
) -> operations.GetCreditsResponse:
|
|
120
120
|
r"""Get remaining credits
|
|
121
121
|
|
|
122
|
-
Get total credits purchased and used for the authenticated user
|
|
122
|
+
Get total credits purchased and used for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
123
123
|
|
|
124
124
|
:param retries: Override the default retry configuration for this method
|
|
125
125
|
:param server_url: Override the default server URL for this method
|