openrouter 0.1.2__py3-none-any.whl → 0.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openrouter/_version.py +2 -2
- openrouter/analytics.py +28 -2
- openrouter/api_keys.py +210 -14
- openrouter/chat.py +192 -200
- openrouter/components/__init__.py +229 -285
- openrouter/components/_schema10.py +39 -0
- openrouter/components/_schema14.py +11 -0
- openrouter/components/_schema17.py +154 -0
- openrouter/components/{_schema3.py → _schema19.py} +28 -22
- openrouter/components/{_schema0.py → _schema5.py} +7 -5
- openrouter/components/assistantmessage.py +32 -1
- openrouter/components/chatgenerationparams.py +57 -343
- openrouter/components/chatmessagecontentitemimage.py +4 -4
- openrouter/components/chatresponsechoice.py +1 -6
- openrouter/components/chatstreamingmessagechunk.py +3 -3
- openrouter/components/developermessage.py +41 -0
- openrouter/components/message.py +6 -39
- openrouter/components/model.py +7 -1
- openrouter/components/openresponsesrequest.py +31 -39
- openrouter/components/outputmodality.py +1 -0
- openrouter/components/providername.py +2 -0
- openrouter/components/providerpreferences.py +2 -10
- openrouter/components/publicendpoint.py +8 -24
- openrouter/components/publicpricing.py +3 -24
- openrouter/credits.py +86 -14
- openrouter/embeddings.py +92 -20
- openrouter/endpoints.py +62 -2
- openrouter/generations.py +26 -0
- openrouter/guardrails.py +3367 -0
- openrouter/models_.py +120 -12
- openrouter/oauth.py +90 -22
- openrouter/operations/__init__.py +601 -30
- openrouter/operations/bulkassignkeystoguardrail.py +116 -0
- openrouter/operations/bulkassignmemberstoguardrail.py +116 -0
- openrouter/operations/bulkunassignkeysfromguardrail.py +116 -0
- openrouter/operations/bulkunassignmembersfromguardrail.py +116 -0
- openrouter/operations/createauthkeyscode.py +81 -3
- openrouter/operations/createcoinbasecharge.py +82 -2
- openrouter/operations/createembeddings.py +82 -3
- openrouter/operations/createguardrail.py +325 -0
- openrouter/operations/createkeys.py +81 -3
- openrouter/operations/createresponses.py +84 -3
- openrouter/operations/deleteguardrail.py +104 -0
- openrouter/operations/deletekeys.py +69 -3
- openrouter/operations/exchangeauthcodeforapikey.py +81 -3
- openrouter/operations/getcredits.py +70 -1
- openrouter/operations/getcurrentkey.py +81 -3
- openrouter/operations/getgeneration.py +248 -3
- openrouter/operations/getguardrail.py +228 -0
- openrouter/operations/getkey.py +64 -1
- openrouter/operations/getmodels.py +95 -5
- openrouter/operations/getuseractivity.py +62 -1
- openrouter/operations/list.py +63 -1
- openrouter/operations/listembeddingsmodels.py +74 -0
- openrouter/operations/listendpoints.py +65 -2
- openrouter/operations/listendpointszdr.py +70 -2
- openrouter/operations/listguardrailkeyassignments.py +192 -0
- openrouter/operations/listguardrailmemberassignments.py +187 -0
- openrouter/operations/listguardrails.py +238 -0
- openrouter/operations/listkeyassignments.py +180 -0
- openrouter/operations/listmemberassignments.py +175 -0
- openrouter/operations/listmodelscount.py +74 -0
- openrouter/operations/listmodelsuser.py +70 -2
- openrouter/operations/listproviders.py +70 -2
- openrouter/operations/sendchatcompletionrequest.py +87 -3
- openrouter/operations/updateguardrail.py +334 -0
- openrouter/operations/updatekeys.py +63 -0
- openrouter/providers.py +36 -2
- openrouter/responses.py +178 -148
- openrouter/sdk.py +5 -8
- openrouter/types/models.py +378 -0
- {openrouter-0.1.2.dist-info → openrouter-0.6.0.dist-info}/METADATA +5 -1
- {openrouter-0.1.2.dist-info → openrouter-0.6.0.dist-info}/RECORD +76 -63
- {openrouter-0.1.2.dist-info → openrouter-0.6.0.dist-info}/WHEEL +1 -1
- openrouter/completions.py +0 -361
- openrouter/components/completionchoice.py +0 -82
- openrouter/components/completioncreateparams.py +0 -277
- openrouter/components/completionlogprobs.py +0 -54
- openrouter/components/completionresponse.py +0 -46
- openrouter/components/completionusage.py +0 -19
- openrouter/operations/getparameters.py +0 -123
- openrouter/parameters.py +0 -237
- {openrouter-0.1.2.dist-info → openrouter-0.6.0.dist-info}/licenses/LICENSE +0 -0
- {openrouter-0.1.2.dist-info → openrouter-0.6.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from openrouter.types import BaseModel
|
|
5
|
+
from openrouter.utils import (
|
|
6
|
+
FieldMetadata,
|
|
7
|
+
HeaderMetadata,
|
|
8
|
+
PathParamMetadata,
|
|
9
|
+
validate_const,
|
|
10
|
+
)
|
|
11
|
+
import pydantic
|
|
12
|
+
from pydantic.functional_validators import AfterValidator
|
|
13
|
+
from typing import Literal, Optional
|
|
14
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class DeleteGuardrailGlobalsTypedDict(TypedDict):
|
|
18
|
+
http_referer: NotRequired[str]
|
|
19
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
20
|
+
This is used to track API usage per application.
|
|
21
|
+
|
|
22
|
+
"""
|
|
23
|
+
x_title: NotRequired[str]
|
|
24
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class DeleteGuardrailGlobals(BaseModel):
|
|
30
|
+
http_referer: Annotated[
|
|
31
|
+
Optional[str],
|
|
32
|
+
pydantic.Field(alias="HTTP-Referer"),
|
|
33
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
34
|
+
] = None
|
|
35
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
36
|
+
This is used to track API usage per application.
|
|
37
|
+
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
x_title: Annotated[
|
|
41
|
+
Optional[str],
|
|
42
|
+
pydantic.Field(alias="X-Title"),
|
|
43
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
44
|
+
] = None
|
|
45
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
46
|
+
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class DeleteGuardrailRequestTypedDict(TypedDict):
|
|
51
|
+
id: str
|
|
52
|
+
r"""The unique identifier of the guardrail to delete"""
|
|
53
|
+
http_referer: NotRequired[str]
|
|
54
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
55
|
+
This is used to track API usage per application.
|
|
56
|
+
|
|
57
|
+
"""
|
|
58
|
+
x_title: NotRequired[str]
|
|
59
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
60
|
+
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class DeleteGuardrailRequest(BaseModel):
|
|
65
|
+
id: Annotated[
|
|
66
|
+
str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
|
|
67
|
+
]
|
|
68
|
+
r"""The unique identifier of the guardrail to delete"""
|
|
69
|
+
|
|
70
|
+
http_referer: Annotated[
|
|
71
|
+
Optional[str],
|
|
72
|
+
pydantic.Field(alias="HTTP-Referer"),
|
|
73
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
74
|
+
] = None
|
|
75
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
76
|
+
This is used to track API usage per application.
|
|
77
|
+
|
|
78
|
+
"""
|
|
79
|
+
|
|
80
|
+
x_title: Annotated[
|
|
81
|
+
Optional[str],
|
|
82
|
+
pydantic.Field(alias="X-Title"),
|
|
83
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
84
|
+
] = None
|
|
85
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
86
|
+
|
|
87
|
+
"""
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class DeleteGuardrailResponseTypedDict(TypedDict):
|
|
91
|
+
r"""Guardrail deleted successfully"""
|
|
92
|
+
|
|
93
|
+
deleted: Literal[True]
|
|
94
|
+
r"""Confirmation that the guardrail was deleted"""
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class DeleteGuardrailResponse(BaseModel):
|
|
98
|
+
r"""Guardrail deleted successfully"""
|
|
99
|
+
|
|
100
|
+
DELETED: Annotated[
|
|
101
|
+
Annotated[Literal[True], AfterValidator(validate_const(True))],
|
|
102
|
+
pydantic.Field(alias="deleted"),
|
|
103
|
+
] = True
|
|
104
|
+
r"""Confirmation that the guardrail was deleted"""
|
|
@@ -2,16 +2,63 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from openrouter.types import BaseModel
|
|
5
|
-
from openrouter.utils import
|
|
5
|
+
from openrouter.utils import (
|
|
6
|
+
FieldMetadata,
|
|
7
|
+
HeaderMetadata,
|
|
8
|
+
PathParamMetadata,
|
|
9
|
+
validate_const,
|
|
10
|
+
)
|
|
6
11
|
import pydantic
|
|
7
12
|
from pydantic.functional_validators import AfterValidator
|
|
8
|
-
from typing import Literal
|
|
9
|
-
from typing_extensions import Annotated, TypedDict
|
|
13
|
+
from typing import Literal, Optional
|
|
14
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class DeleteKeysGlobalsTypedDict(TypedDict):
|
|
18
|
+
http_referer: NotRequired[str]
|
|
19
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
20
|
+
This is used to track API usage per application.
|
|
21
|
+
|
|
22
|
+
"""
|
|
23
|
+
x_title: NotRequired[str]
|
|
24
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class DeleteKeysGlobals(BaseModel):
|
|
30
|
+
http_referer: Annotated[
|
|
31
|
+
Optional[str],
|
|
32
|
+
pydantic.Field(alias="HTTP-Referer"),
|
|
33
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
34
|
+
] = None
|
|
35
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
36
|
+
This is used to track API usage per application.
|
|
37
|
+
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
x_title: Annotated[
|
|
41
|
+
Optional[str],
|
|
42
|
+
pydantic.Field(alias="X-Title"),
|
|
43
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
44
|
+
] = None
|
|
45
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
46
|
+
|
|
47
|
+
"""
|
|
10
48
|
|
|
11
49
|
|
|
12
50
|
class DeleteKeysRequestTypedDict(TypedDict):
|
|
13
51
|
hash: str
|
|
14
52
|
r"""The hash identifier of the API key to delete"""
|
|
53
|
+
http_referer: NotRequired[str]
|
|
54
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
55
|
+
This is used to track API usage per application.
|
|
56
|
+
|
|
57
|
+
"""
|
|
58
|
+
x_title: NotRequired[str]
|
|
59
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
60
|
+
|
|
61
|
+
"""
|
|
15
62
|
|
|
16
63
|
|
|
17
64
|
class DeleteKeysRequest(BaseModel):
|
|
@@ -20,6 +67,25 @@ class DeleteKeysRequest(BaseModel):
|
|
|
20
67
|
]
|
|
21
68
|
r"""The hash identifier of the API key to delete"""
|
|
22
69
|
|
|
70
|
+
http_referer: Annotated[
|
|
71
|
+
Optional[str],
|
|
72
|
+
pydantic.Field(alias="HTTP-Referer"),
|
|
73
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
74
|
+
] = None
|
|
75
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
76
|
+
This is used to track API usage per application.
|
|
77
|
+
|
|
78
|
+
"""
|
|
79
|
+
|
|
80
|
+
x_title: Annotated[
|
|
81
|
+
Optional[str],
|
|
82
|
+
pydantic.Field(alias="X-Title"),
|
|
83
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
84
|
+
] = None
|
|
85
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
86
|
+
|
|
87
|
+
"""
|
|
88
|
+
|
|
23
89
|
|
|
24
90
|
class DeleteKeysResponseTypedDict(TypedDict):
|
|
25
91
|
r"""API key deleted successfully"""
|
|
@@ -9,13 +9,52 @@ from openrouter.types import (
|
|
|
9
9
|
UNSET_SENTINEL,
|
|
10
10
|
UnrecognizedStr,
|
|
11
11
|
)
|
|
12
|
-
from openrouter.utils import
|
|
12
|
+
from openrouter.utils import (
|
|
13
|
+
FieldMetadata,
|
|
14
|
+
HeaderMetadata,
|
|
15
|
+
RequestMetadata,
|
|
16
|
+
validate_open_enum,
|
|
17
|
+
)
|
|
18
|
+
import pydantic
|
|
13
19
|
from pydantic import model_serializer
|
|
14
20
|
from pydantic.functional_validators import PlainValidator
|
|
15
21
|
from typing import Literal, Optional, Union
|
|
16
22
|
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
17
23
|
|
|
18
24
|
|
|
25
|
+
class ExchangeAuthCodeForAPIKeyGlobalsTypedDict(TypedDict):
|
|
26
|
+
http_referer: NotRequired[str]
|
|
27
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
28
|
+
This is used to track API usage per application.
|
|
29
|
+
|
|
30
|
+
"""
|
|
31
|
+
x_title: NotRequired[str]
|
|
32
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
33
|
+
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class ExchangeAuthCodeForAPIKeyGlobals(BaseModel):
|
|
38
|
+
http_referer: Annotated[
|
|
39
|
+
Optional[str],
|
|
40
|
+
pydantic.Field(alias="HTTP-Referer"),
|
|
41
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
42
|
+
] = None
|
|
43
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
44
|
+
This is used to track API usage per application.
|
|
45
|
+
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
x_title: Annotated[
|
|
49
|
+
Optional[str],
|
|
50
|
+
pydantic.Field(alias="X-Title"),
|
|
51
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
52
|
+
] = None
|
|
53
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
54
|
+
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
|
|
19
58
|
ExchangeAuthCodeForAPIKeyCodeChallengeMethod = Union[
|
|
20
59
|
Literal[
|
|
21
60
|
"S256",
|
|
@@ -26,7 +65,7 @@ ExchangeAuthCodeForAPIKeyCodeChallengeMethod = Union[
|
|
|
26
65
|
r"""The method used to generate the code challenge"""
|
|
27
66
|
|
|
28
67
|
|
|
29
|
-
class
|
|
68
|
+
class ExchangeAuthCodeForAPIKeyRequestBodyTypedDict(TypedDict):
|
|
30
69
|
code: str
|
|
31
70
|
r"""The authorization code received from the OAuth redirect"""
|
|
32
71
|
code_verifier: NotRequired[str]
|
|
@@ -37,7 +76,7 @@ class ExchangeAuthCodeForAPIKeyRequestTypedDict(TypedDict):
|
|
|
37
76
|
r"""The method used to generate the code challenge"""
|
|
38
77
|
|
|
39
78
|
|
|
40
|
-
class
|
|
79
|
+
class ExchangeAuthCodeForAPIKeyRequestBody(BaseModel):
|
|
41
80
|
code: str
|
|
42
81
|
r"""The authorization code received from the OAuth redirect"""
|
|
43
82
|
|
|
@@ -81,6 +120,45 @@ class ExchangeAuthCodeForAPIKeyRequest(BaseModel):
|
|
|
81
120
|
return m
|
|
82
121
|
|
|
83
122
|
|
|
123
|
+
class ExchangeAuthCodeForAPIKeyRequestTypedDict(TypedDict):
|
|
124
|
+
request_body: ExchangeAuthCodeForAPIKeyRequestBodyTypedDict
|
|
125
|
+
http_referer: NotRequired[str]
|
|
126
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
127
|
+
This is used to track API usage per application.
|
|
128
|
+
|
|
129
|
+
"""
|
|
130
|
+
x_title: NotRequired[str]
|
|
131
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
132
|
+
|
|
133
|
+
"""
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class ExchangeAuthCodeForAPIKeyRequest(BaseModel):
|
|
137
|
+
request_body: Annotated[
|
|
138
|
+
ExchangeAuthCodeForAPIKeyRequestBody,
|
|
139
|
+
FieldMetadata(request=RequestMetadata(media_type="application/json")),
|
|
140
|
+
]
|
|
141
|
+
|
|
142
|
+
http_referer: Annotated[
|
|
143
|
+
Optional[str],
|
|
144
|
+
pydantic.Field(alias="HTTP-Referer"),
|
|
145
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
146
|
+
] = None
|
|
147
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
148
|
+
This is used to track API usage per application.
|
|
149
|
+
|
|
150
|
+
"""
|
|
151
|
+
|
|
152
|
+
x_title: Annotated[
|
|
153
|
+
Optional[str],
|
|
154
|
+
pydantic.Field(alias="X-Title"),
|
|
155
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
156
|
+
] = None
|
|
157
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
158
|
+
|
|
159
|
+
"""
|
|
160
|
+
|
|
161
|
+
|
|
84
162
|
class ExchangeAuthCodeForAPIKeyResponseTypedDict(TypedDict):
|
|
85
163
|
r"""Successfully exchanged code for an API key"""
|
|
86
164
|
|
|
@@ -2,7 +2,76 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from openrouter.types import BaseModel
|
|
5
|
-
from
|
|
5
|
+
from openrouter.utils import FieldMetadata, HeaderMetadata
|
|
6
|
+
import pydantic
|
|
7
|
+
from typing import Optional
|
|
8
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class GetCreditsGlobalsTypedDict(TypedDict):
|
|
12
|
+
http_referer: NotRequired[str]
|
|
13
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
14
|
+
This is used to track API usage per application.
|
|
15
|
+
|
|
16
|
+
"""
|
|
17
|
+
x_title: NotRequired[str]
|
|
18
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
19
|
+
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class GetCreditsGlobals(BaseModel):
|
|
24
|
+
http_referer: Annotated[
|
|
25
|
+
Optional[str],
|
|
26
|
+
pydantic.Field(alias="HTTP-Referer"),
|
|
27
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
28
|
+
] = None
|
|
29
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
30
|
+
This is used to track API usage per application.
|
|
31
|
+
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
x_title: Annotated[
|
|
35
|
+
Optional[str],
|
|
36
|
+
pydantic.Field(alias="X-Title"),
|
|
37
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
38
|
+
] = None
|
|
39
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
40
|
+
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class GetCreditsRequestTypedDict(TypedDict):
|
|
45
|
+
http_referer: NotRequired[str]
|
|
46
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
47
|
+
This is used to track API usage per application.
|
|
48
|
+
|
|
49
|
+
"""
|
|
50
|
+
x_title: NotRequired[str]
|
|
51
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
52
|
+
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class GetCreditsRequest(BaseModel):
|
|
57
|
+
http_referer: Annotated[
|
|
58
|
+
Optional[str],
|
|
59
|
+
pydantic.Field(alias="HTTP-Referer"),
|
|
60
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
61
|
+
] = None
|
|
62
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
63
|
+
This is used to track API usage per application.
|
|
64
|
+
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
x_title: Annotated[
|
|
68
|
+
Optional[str],
|
|
69
|
+
pydantic.Field(alias="X-Title"),
|
|
70
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
71
|
+
] = None
|
|
72
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
73
|
+
|
|
74
|
+
"""
|
|
6
75
|
|
|
7
76
|
|
|
8
77
|
class GetCreditsDataTypedDict(TypedDict):
|
|
@@ -9,11 +9,79 @@ from openrouter.types import (
|
|
|
9
9
|
UNSET,
|
|
10
10
|
UNSET_SENTINEL,
|
|
11
11
|
)
|
|
12
|
+
from openrouter.utils import FieldMetadata, HeaderMetadata
|
|
12
13
|
import pydantic
|
|
13
14
|
from pydantic import model_serializer
|
|
15
|
+
from typing import Optional
|
|
14
16
|
from typing_extensions import Annotated, NotRequired, TypedDict, deprecated
|
|
15
17
|
|
|
16
18
|
|
|
19
|
+
class GetCurrentKeyGlobalsTypedDict(TypedDict):
|
|
20
|
+
http_referer: NotRequired[str]
|
|
21
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
22
|
+
This is used to track API usage per application.
|
|
23
|
+
|
|
24
|
+
"""
|
|
25
|
+
x_title: NotRequired[str]
|
|
26
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
27
|
+
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class GetCurrentKeyGlobals(BaseModel):
|
|
32
|
+
http_referer: Annotated[
|
|
33
|
+
Optional[str],
|
|
34
|
+
pydantic.Field(alias="HTTP-Referer"),
|
|
35
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
36
|
+
] = None
|
|
37
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
38
|
+
This is used to track API usage per application.
|
|
39
|
+
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
x_title: Annotated[
|
|
43
|
+
Optional[str],
|
|
44
|
+
pydantic.Field(alias="X-Title"),
|
|
45
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
46
|
+
] = None
|
|
47
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
48
|
+
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class GetCurrentKeyRequestTypedDict(TypedDict):
|
|
53
|
+
http_referer: NotRequired[str]
|
|
54
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
55
|
+
This is used to track API usage per application.
|
|
56
|
+
|
|
57
|
+
"""
|
|
58
|
+
x_title: NotRequired[str]
|
|
59
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
60
|
+
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class GetCurrentKeyRequest(BaseModel):
|
|
65
|
+
http_referer: Annotated[
|
|
66
|
+
Optional[str],
|
|
67
|
+
pydantic.Field(alias="HTTP-Referer"),
|
|
68
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
69
|
+
] = None
|
|
70
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
71
|
+
This is used to track API usage per application.
|
|
72
|
+
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
x_title: Annotated[
|
|
76
|
+
Optional[str],
|
|
77
|
+
pydantic.Field(alias="X-Title"),
|
|
78
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
79
|
+
] = None
|
|
80
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
81
|
+
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
|
|
17
85
|
@deprecated(
|
|
18
86
|
"warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
|
|
19
87
|
)
|
|
@@ -69,8 +137,10 @@ class GetCurrentKeyDataTypedDict(TypedDict):
|
|
|
69
137
|
r"""External BYOK usage (in USD) for current UTC month"""
|
|
70
138
|
is_free_tier: bool
|
|
71
139
|
r"""Whether this is a free tier API key"""
|
|
140
|
+
is_management_key: bool
|
|
141
|
+
r"""Whether this is a management key"""
|
|
72
142
|
is_provisioning_key: bool
|
|
73
|
-
r"""Whether this is a
|
|
143
|
+
r"""Whether this is a management key"""
|
|
74
144
|
limit_remaining: Nullable[float]
|
|
75
145
|
r"""Remaining spending limit in USD"""
|
|
76
146
|
limit_reset: Nullable[str]
|
|
@@ -119,8 +189,16 @@ class GetCurrentKeyData(BaseModel):
|
|
|
119
189
|
is_free_tier: bool
|
|
120
190
|
r"""Whether this is a free tier API key"""
|
|
121
191
|
|
|
122
|
-
|
|
123
|
-
r"""Whether this is a
|
|
192
|
+
is_management_key: bool
|
|
193
|
+
r"""Whether this is a management key"""
|
|
194
|
+
|
|
195
|
+
is_provisioning_key: Annotated[
|
|
196
|
+
bool,
|
|
197
|
+
pydantic.Field(
|
|
198
|
+
deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
|
|
199
|
+
),
|
|
200
|
+
]
|
|
201
|
+
r"""Whether this is a management key"""
|
|
124
202
|
|
|
125
203
|
limit_remaining: Nullable[float]
|
|
126
204
|
r"""Remaining spending limit in USD"""
|