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,180 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
|
|
5
|
+
from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata
|
|
6
|
+
import pydantic
|
|
7
|
+
from pydantic import model_serializer
|
|
8
|
+
from typing import List, Optional
|
|
9
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ListKeyAssignmentsGlobalsTypedDict(TypedDict):
|
|
13
|
+
http_referer: NotRequired[str]
|
|
14
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
15
|
+
This is used to track API usage per application.
|
|
16
|
+
|
|
17
|
+
"""
|
|
18
|
+
x_title: NotRequired[str]
|
|
19
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
20
|
+
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ListKeyAssignmentsGlobals(BaseModel):
|
|
25
|
+
http_referer: Annotated[
|
|
26
|
+
Optional[str],
|
|
27
|
+
pydantic.Field(alias="HTTP-Referer"),
|
|
28
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
29
|
+
] = None
|
|
30
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
31
|
+
This is used to track API usage per application.
|
|
32
|
+
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
x_title: Annotated[
|
|
36
|
+
Optional[str],
|
|
37
|
+
pydantic.Field(alias="X-Title"),
|
|
38
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
39
|
+
] = None
|
|
40
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
41
|
+
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class ListKeyAssignmentsRequestTypedDict(TypedDict):
|
|
46
|
+
http_referer: NotRequired[str]
|
|
47
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
48
|
+
This is used to track API usage per application.
|
|
49
|
+
|
|
50
|
+
"""
|
|
51
|
+
x_title: NotRequired[str]
|
|
52
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
53
|
+
|
|
54
|
+
"""
|
|
55
|
+
offset: NotRequired[str]
|
|
56
|
+
r"""Number of records to skip for pagination"""
|
|
57
|
+
limit: NotRequired[str]
|
|
58
|
+
r"""Maximum number of records to return (max 100)"""
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class ListKeyAssignmentsRequest(BaseModel):
|
|
62
|
+
http_referer: Annotated[
|
|
63
|
+
Optional[str],
|
|
64
|
+
pydantic.Field(alias="HTTP-Referer"),
|
|
65
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
66
|
+
] = None
|
|
67
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
68
|
+
This is used to track API usage per application.
|
|
69
|
+
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
x_title: Annotated[
|
|
73
|
+
Optional[str],
|
|
74
|
+
pydantic.Field(alias="X-Title"),
|
|
75
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
76
|
+
] = None
|
|
77
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
78
|
+
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
offset: Annotated[
|
|
82
|
+
Optional[str],
|
|
83
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
84
|
+
] = None
|
|
85
|
+
r"""Number of records to skip for pagination"""
|
|
86
|
+
|
|
87
|
+
limit: Annotated[
|
|
88
|
+
Optional[str],
|
|
89
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
90
|
+
] = None
|
|
91
|
+
r"""Maximum number of records to return (max 100)"""
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class ListKeyAssignmentsDataTypedDict(TypedDict):
|
|
95
|
+
id: str
|
|
96
|
+
r"""Unique identifier for the assignment"""
|
|
97
|
+
key_hash: str
|
|
98
|
+
r"""Hash of the assigned API key"""
|
|
99
|
+
guardrail_id: str
|
|
100
|
+
r"""ID of the guardrail"""
|
|
101
|
+
key_name: str
|
|
102
|
+
r"""Name of the API key"""
|
|
103
|
+
key_label: str
|
|
104
|
+
r"""Label of the API key"""
|
|
105
|
+
assigned_by: Nullable[str]
|
|
106
|
+
r"""User ID of who made the assignment"""
|
|
107
|
+
created_at: str
|
|
108
|
+
r"""ISO 8601 timestamp of when the assignment was created"""
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
class ListKeyAssignmentsData(BaseModel):
|
|
112
|
+
id: str
|
|
113
|
+
r"""Unique identifier for the assignment"""
|
|
114
|
+
|
|
115
|
+
key_hash: str
|
|
116
|
+
r"""Hash of the assigned API key"""
|
|
117
|
+
|
|
118
|
+
guardrail_id: str
|
|
119
|
+
r"""ID of the guardrail"""
|
|
120
|
+
|
|
121
|
+
key_name: str
|
|
122
|
+
r"""Name of the API key"""
|
|
123
|
+
|
|
124
|
+
key_label: str
|
|
125
|
+
r"""Label of the API key"""
|
|
126
|
+
|
|
127
|
+
assigned_by: Nullable[str]
|
|
128
|
+
r"""User ID of who made the assignment"""
|
|
129
|
+
|
|
130
|
+
created_at: str
|
|
131
|
+
r"""ISO 8601 timestamp of when the assignment was created"""
|
|
132
|
+
|
|
133
|
+
@model_serializer(mode="wrap")
|
|
134
|
+
def serialize_model(self, handler):
|
|
135
|
+
optional_fields = []
|
|
136
|
+
nullable_fields = ["assigned_by"]
|
|
137
|
+
null_default_fields = []
|
|
138
|
+
|
|
139
|
+
serialized = handler(self)
|
|
140
|
+
|
|
141
|
+
m = {}
|
|
142
|
+
|
|
143
|
+
for n, f in type(self).model_fields.items():
|
|
144
|
+
k = f.alias or n
|
|
145
|
+
val = serialized.get(k)
|
|
146
|
+
serialized.pop(k, None)
|
|
147
|
+
|
|
148
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
149
|
+
is_set = (
|
|
150
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
151
|
+
or k in null_default_fields
|
|
152
|
+
) # pylint: disable=no-member
|
|
153
|
+
|
|
154
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
155
|
+
m[k] = val
|
|
156
|
+
elif val != UNSET_SENTINEL and (
|
|
157
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
158
|
+
):
|
|
159
|
+
m[k] = val
|
|
160
|
+
|
|
161
|
+
return m
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class ListKeyAssignmentsResponseTypedDict(TypedDict):
|
|
165
|
+
r"""List of key assignments"""
|
|
166
|
+
|
|
167
|
+
data: List[ListKeyAssignmentsDataTypedDict]
|
|
168
|
+
r"""List of key assignments"""
|
|
169
|
+
total_count: float
|
|
170
|
+
r"""Total number of key assignments for this guardrail"""
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
class ListKeyAssignmentsResponse(BaseModel):
|
|
174
|
+
r"""List of key assignments"""
|
|
175
|
+
|
|
176
|
+
data: List[ListKeyAssignmentsData]
|
|
177
|
+
r"""List of key assignments"""
|
|
178
|
+
|
|
179
|
+
total_count: float
|
|
180
|
+
r"""Total number of key assignments for this guardrail"""
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
|
|
5
|
+
from openrouter.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata
|
|
6
|
+
import pydantic
|
|
7
|
+
from pydantic import model_serializer
|
|
8
|
+
from typing import List, Optional
|
|
9
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ListMemberAssignmentsGlobalsTypedDict(TypedDict):
|
|
13
|
+
http_referer: NotRequired[str]
|
|
14
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
15
|
+
This is used to track API usage per application.
|
|
16
|
+
|
|
17
|
+
"""
|
|
18
|
+
x_title: NotRequired[str]
|
|
19
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
20
|
+
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ListMemberAssignmentsGlobals(BaseModel):
|
|
25
|
+
http_referer: Annotated[
|
|
26
|
+
Optional[str],
|
|
27
|
+
pydantic.Field(alias="HTTP-Referer"),
|
|
28
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
29
|
+
] = None
|
|
30
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
31
|
+
This is used to track API usage per application.
|
|
32
|
+
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
x_title: Annotated[
|
|
36
|
+
Optional[str],
|
|
37
|
+
pydantic.Field(alias="X-Title"),
|
|
38
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
39
|
+
] = None
|
|
40
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
41
|
+
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class ListMemberAssignmentsRequestTypedDict(TypedDict):
|
|
46
|
+
http_referer: NotRequired[str]
|
|
47
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
48
|
+
This is used to track API usage per application.
|
|
49
|
+
|
|
50
|
+
"""
|
|
51
|
+
x_title: NotRequired[str]
|
|
52
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
53
|
+
|
|
54
|
+
"""
|
|
55
|
+
offset: NotRequired[str]
|
|
56
|
+
r"""Number of records to skip for pagination"""
|
|
57
|
+
limit: NotRequired[str]
|
|
58
|
+
r"""Maximum number of records to return (max 100)"""
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class ListMemberAssignmentsRequest(BaseModel):
|
|
62
|
+
http_referer: Annotated[
|
|
63
|
+
Optional[str],
|
|
64
|
+
pydantic.Field(alias="HTTP-Referer"),
|
|
65
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
66
|
+
] = None
|
|
67
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
68
|
+
This is used to track API usage per application.
|
|
69
|
+
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
x_title: Annotated[
|
|
73
|
+
Optional[str],
|
|
74
|
+
pydantic.Field(alias="X-Title"),
|
|
75
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
76
|
+
] = None
|
|
77
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
78
|
+
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
offset: Annotated[
|
|
82
|
+
Optional[str],
|
|
83
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
84
|
+
] = None
|
|
85
|
+
r"""Number of records to skip for pagination"""
|
|
86
|
+
|
|
87
|
+
limit: Annotated[
|
|
88
|
+
Optional[str],
|
|
89
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
90
|
+
] = None
|
|
91
|
+
r"""Maximum number of records to return (max 100)"""
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class ListMemberAssignmentsDataTypedDict(TypedDict):
|
|
95
|
+
id: str
|
|
96
|
+
r"""Unique identifier for the assignment"""
|
|
97
|
+
user_id: str
|
|
98
|
+
r"""Clerk user ID of the assigned member"""
|
|
99
|
+
organization_id: str
|
|
100
|
+
r"""Organization ID"""
|
|
101
|
+
guardrail_id: str
|
|
102
|
+
r"""ID of the guardrail"""
|
|
103
|
+
assigned_by: Nullable[str]
|
|
104
|
+
r"""User ID of who made the assignment"""
|
|
105
|
+
created_at: str
|
|
106
|
+
r"""ISO 8601 timestamp of when the assignment was created"""
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class ListMemberAssignmentsData(BaseModel):
|
|
110
|
+
id: str
|
|
111
|
+
r"""Unique identifier for the assignment"""
|
|
112
|
+
|
|
113
|
+
user_id: str
|
|
114
|
+
r"""Clerk user ID of the assigned member"""
|
|
115
|
+
|
|
116
|
+
organization_id: str
|
|
117
|
+
r"""Organization ID"""
|
|
118
|
+
|
|
119
|
+
guardrail_id: str
|
|
120
|
+
r"""ID of the guardrail"""
|
|
121
|
+
|
|
122
|
+
assigned_by: Nullable[str]
|
|
123
|
+
r"""User ID of who made the assignment"""
|
|
124
|
+
|
|
125
|
+
created_at: str
|
|
126
|
+
r"""ISO 8601 timestamp of when the assignment was created"""
|
|
127
|
+
|
|
128
|
+
@model_serializer(mode="wrap")
|
|
129
|
+
def serialize_model(self, handler):
|
|
130
|
+
optional_fields = []
|
|
131
|
+
nullable_fields = ["assigned_by"]
|
|
132
|
+
null_default_fields = []
|
|
133
|
+
|
|
134
|
+
serialized = handler(self)
|
|
135
|
+
|
|
136
|
+
m = {}
|
|
137
|
+
|
|
138
|
+
for n, f in type(self).model_fields.items():
|
|
139
|
+
k = f.alias or n
|
|
140
|
+
val = serialized.get(k)
|
|
141
|
+
serialized.pop(k, None)
|
|
142
|
+
|
|
143
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
144
|
+
is_set = (
|
|
145
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
146
|
+
or k in null_default_fields
|
|
147
|
+
) # pylint: disable=no-member
|
|
148
|
+
|
|
149
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
150
|
+
m[k] = val
|
|
151
|
+
elif val != UNSET_SENTINEL and (
|
|
152
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
153
|
+
):
|
|
154
|
+
m[k] = val
|
|
155
|
+
|
|
156
|
+
return m
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
class ListMemberAssignmentsResponseTypedDict(TypedDict):
|
|
160
|
+
r"""List of member assignments"""
|
|
161
|
+
|
|
162
|
+
data: List[ListMemberAssignmentsDataTypedDict]
|
|
163
|
+
r"""List of member assignments"""
|
|
164
|
+
total_count: float
|
|
165
|
+
r"""Total number of member assignments"""
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
class ListMemberAssignmentsResponse(BaseModel):
|
|
169
|
+
r"""List of member assignments"""
|
|
170
|
+
|
|
171
|
+
data: List[ListMemberAssignmentsData]
|
|
172
|
+
r"""List of member assignments"""
|
|
173
|
+
|
|
174
|
+
total_count: float
|
|
175
|
+
r"""Total number of member assignments"""
|
|
@@ -0,0 +1,74 @@
|
|
|
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 FieldMetadata, HeaderMetadata
|
|
6
|
+
import pydantic
|
|
7
|
+
from typing import Optional
|
|
8
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ListModelsCountGlobalsTypedDict(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 ListModelsCountGlobals(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 ListModelsCountRequestTypedDict(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 ListModelsCountRequest(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
|
+
"""
|
|
@@ -2,8 +2,43 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from openrouter.types import BaseModel
|
|
5
|
-
from openrouter.utils import FieldMetadata, SecurityMetadata
|
|
6
|
-
|
|
5
|
+
from openrouter.utils import FieldMetadata, HeaderMetadata, SecurityMetadata
|
|
6
|
+
import pydantic
|
|
7
|
+
from typing import Optional
|
|
8
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ListModelsUserGlobalsTypedDict(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 ListModelsUserGlobals(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
|
+
"""
|
|
7
42
|
|
|
8
43
|
|
|
9
44
|
class ListModelsUserSecurityTypedDict(TypedDict):
|
|
@@ -22,3 +57,36 @@ class ListModelsUserSecurity(BaseModel):
|
|
|
22
57
|
)
|
|
23
58
|
),
|
|
24
59
|
]
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class ListModelsUserRequestTypedDict(TypedDict):
|
|
63
|
+
http_referer: NotRequired[str]
|
|
64
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
65
|
+
This is used to track API usage per application.
|
|
66
|
+
|
|
67
|
+
"""
|
|
68
|
+
x_title: NotRequired[str]
|
|
69
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
70
|
+
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class ListModelsUserRequest(BaseModel):
|
|
75
|
+
http_referer: Annotated[
|
|
76
|
+
Optional[str],
|
|
77
|
+
pydantic.Field(alias="HTTP-Referer"),
|
|
78
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
79
|
+
] = None
|
|
80
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
81
|
+
This is used to track API usage per application.
|
|
82
|
+
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
x_title: Annotated[
|
|
86
|
+
Optional[str],
|
|
87
|
+
pydantic.Field(alias="X-Title"),
|
|
88
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
89
|
+
] = None
|
|
90
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
91
|
+
|
|
92
|
+
"""
|
|
@@ -8,9 +8,77 @@ from openrouter.types import (
|
|
|
8
8
|
UNSET,
|
|
9
9
|
UNSET_SENTINEL,
|
|
10
10
|
)
|
|
11
|
+
from openrouter.utils import FieldMetadata, HeaderMetadata
|
|
12
|
+
import pydantic
|
|
11
13
|
from pydantic import model_serializer
|
|
12
|
-
from typing import List
|
|
13
|
-
from typing_extensions import NotRequired, TypedDict
|
|
14
|
+
from typing import List, Optional
|
|
15
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ListProvidersGlobalsTypedDict(TypedDict):
|
|
19
|
+
http_referer: NotRequired[str]
|
|
20
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
21
|
+
This is used to track API usage per application.
|
|
22
|
+
|
|
23
|
+
"""
|
|
24
|
+
x_title: NotRequired[str]
|
|
25
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
26
|
+
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class ListProvidersGlobals(BaseModel):
|
|
31
|
+
http_referer: Annotated[
|
|
32
|
+
Optional[str],
|
|
33
|
+
pydantic.Field(alias="HTTP-Referer"),
|
|
34
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
35
|
+
] = None
|
|
36
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
37
|
+
This is used to track API usage per application.
|
|
38
|
+
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
x_title: Annotated[
|
|
42
|
+
Optional[str],
|
|
43
|
+
pydantic.Field(alias="X-Title"),
|
|
44
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
45
|
+
] = None
|
|
46
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
47
|
+
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class ListProvidersRequestTypedDict(TypedDict):
|
|
52
|
+
http_referer: NotRequired[str]
|
|
53
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
54
|
+
This is used to track API usage per application.
|
|
55
|
+
|
|
56
|
+
"""
|
|
57
|
+
x_title: NotRequired[str]
|
|
58
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
59
|
+
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class ListProvidersRequest(BaseModel):
|
|
64
|
+
http_referer: Annotated[
|
|
65
|
+
Optional[str],
|
|
66
|
+
pydantic.Field(alias="HTTP-Referer"),
|
|
67
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
68
|
+
] = None
|
|
69
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
70
|
+
This is used to track API usage per application.
|
|
71
|
+
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
x_title: Annotated[
|
|
75
|
+
Optional[str],
|
|
76
|
+
pydantic.Field(alias="X-Title"),
|
|
77
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
78
|
+
] = None
|
|
79
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
80
|
+
|
|
81
|
+
"""
|
|
14
82
|
|
|
15
83
|
|
|
16
84
|
class ListProvidersDataTypedDict(TypedDict):
|
|
@@ -2,12 +2,96 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from openrouter.components import (
|
|
5
|
+
chatgenerationparams as components_chatgenerationparams,
|
|
5
6
|
chatresponse as components_chatresponse,
|
|
6
7
|
chatstreamingresponsechunk as components_chatstreamingresponsechunk,
|
|
7
8
|
)
|
|
8
|
-
from openrouter.
|
|
9
|
-
from
|
|
10
|
-
|
|
9
|
+
from openrouter.types import BaseModel
|
|
10
|
+
from openrouter.utils import (
|
|
11
|
+
FieldMetadata,
|
|
12
|
+
HeaderMetadata,
|
|
13
|
+
RequestMetadata,
|
|
14
|
+
eventstreaming,
|
|
15
|
+
)
|
|
16
|
+
import pydantic
|
|
17
|
+
from typing import Optional, Union
|
|
18
|
+
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class SendChatCompletionRequestGlobalsTypedDict(TypedDict):
|
|
22
|
+
http_referer: NotRequired[str]
|
|
23
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
24
|
+
This is used to track API usage per application.
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
x_title: NotRequired[str]
|
|
28
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
29
|
+
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class SendChatCompletionRequestGlobals(BaseModel):
|
|
34
|
+
http_referer: Annotated[
|
|
35
|
+
Optional[str],
|
|
36
|
+
pydantic.Field(alias="HTTP-Referer"),
|
|
37
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
38
|
+
] = None
|
|
39
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
40
|
+
This is used to track API usage per application.
|
|
41
|
+
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
x_title: Annotated[
|
|
45
|
+
Optional[str],
|
|
46
|
+
pydantic.Field(alias="X-Title"),
|
|
47
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
48
|
+
] = None
|
|
49
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
50
|
+
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class SendChatCompletionRequestRequestTypedDict(TypedDict):
|
|
55
|
+
chat_generation_params: (
|
|
56
|
+
components_chatgenerationparams.ChatGenerationParamsTypedDict
|
|
57
|
+
)
|
|
58
|
+
r"""Chat completion request parameters"""
|
|
59
|
+
http_referer: NotRequired[str]
|
|
60
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
61
|
+
This is used to track API usage per application.
|
|
62
|
+
|
|
63
|
+
"""
|
|
64
|
+
x_title: NotRequired[str]
|
|
65
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
66
|
+
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class SendChatCompletionRequestRequest(BaseModel):
|
|
71
|
+
chat_generation_params: Annotated[
|
|
72
|
+
components_chatgenerationparams.ChatGenerationParams,
|
|
73
|
+
FieldMetadata(request=RequestMetadata(media_type="application/json")),
|
|
74
|
+
]
|
|
75
|
+
r"""Chat completion request parameters"""
|
|
76
|
+
|
|
77
|
+
http_referer: Annotated[
|
|
78
|
+
Optional[str],
|
|
79
|
+
pydantic.Field(alias="HTTP-Referer"),
|
|
80
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
81
|
+
] = None
|
|
82
|
+
r"""The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
83
|
+
This is used to track API usage per application.
|
|
84
|
+
|
|
85
|
+
"""
|
|
86
|
+
|
|
87
|
+
x_title: Annotated[
|
|
88
|
+
Optional[str],
|
|
89
|
+
pydantic.Field(alias="X-Title"),
|
|
90
|
+
FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
|
|
91
|
+
] = None
|
|
92
|
+
r"""The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
93
|
+
|
|
94
|
+
"""
|
|
11
95
|
|
|
12
96
|
|
|
13
97
|
SendChatCompletionRequestResponseTypedDict = TypeAliasType(
|