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
openrouter/parameters.py
DELETED
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
-
|
|
3
|
-
from .basesdk import BaseSDK
|
|
4
|
-
from openrouter import components, errors, operations, utils
|
|
5
|
-
from openrouter._hooks import HookContext
|
|
6
|
-
from openrouter.types import OptionalNullable, UNSET
|
|
7
|
-
from openrouter.utils import get_security_from_env
|
|
8
|
-
from openrouter.utils.unmarshal_json_response import unmarshal_json_response
|
|
9
|
-
from typing import Any, Mapping, Optional, Union
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class Parameters(BaseSDK):
|
|
13
|
-
r"""Parameters endpoints"""
|
|
14
|
-
|
|
15
|
-
def get_parameters(
|
|
16
|
-
self,
|
|
17
|
-
*,
|
|
18
|
-
security: Union[
|
|
19
|
-
operations.GetParametersSecurity, operations.GetParametersSecurityTypedDict
|
|
20
|
-
],
|
|
21
|
-
author: str,
|
|
22
|
-
slug: str,
|
|
23
|
-
provider: Optional[components.ProviderName] = None,
|
|
24
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
25
|
-
server_url: Optional[str] = None,
|
|
26
|
-
timeout_ms: Optional[int] = None,
|
|
27
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
28
|
-
) -> operations.GetParametersResponse:
|
|
29
|
-
r"""Get a model's supported parameters and data about which are most popular
|
|
30
|
-
|
|
31
|
-
:param security:
|
|
32
|
-
:param author:
|
|
33
|
-
:param slug:
|
|
34
|
-
:param provider:
|
|
35
|
-
:param retries: Override the default retry configuration for this method
|
|
36
|
-
:param server_url: Override the default server URL for this method
|
|
37
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
38
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
39
|
-
"""
|
|
40
|
-
base_url = None
|
|
41
|
-
url_variables = None
|
|
42
|
-
if timeout_ms is None:
|
|
43
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
44
|
-
|
|
45
|
-
if server_url is not None:
|
|
46
|
-
base_url = server_url
|
|
47
|
-
else:
|
|
48
|
-
base_url = self._get_url(base_url, url_variables)
|
|
49
|
-
|
|
50
|
-
request = operations.GetParametersRequest(
|
|
51
|
-
author=author,
|
|
52
|
-
slug=slug,
|
|
53
|
-
provider=provider,
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
req = self._build_request(
|
|
57
|
-
method="GET",
|
|
58
|
-
path="/parameters/{author}/{slug}",
|
|
59
|
-
base_url=base_url,
|
|
60
|
-
url_variables=url_variables,
|
|
61
|
-
request=request,
|
|
62
|
-
request_body_required=False,
|
|
63
|
-
request_has_path_params=True,
|
|
64
|
-
request_has_query_params=True,
|
|
65
|
-
user_agent_header="user-agent",
|
|
66
|
-
accept_header_value="application/json",
|
|
67
|
-
http_headers=http_headers,
|
|
68
|
-
security=utils.get_pydantic_model(
|
|
69
|
-
security, operations.GetParametersSecurity
|
|
70
|
-
),
|
|
71
|
-
allow_empty_value=None,
|
|
72
|
-
timeout_ms=timeout_ms,
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
if retries == UNSET:
|
|
76
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
77
|
-
retries = self.sdk_configuration.retry_config
|
|
78
|
-
|
|
79
|
-
retry_config = None
|
|
80
|
-
if isinstance(retries, utils.RetryConfig):
|
|
81
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
82
|
-
|
|
83
|
-
http_res = self.do_request(
|
|
84
|
-
hook_ctx=HookContext(
|
|
85
|
-
config=self.sdk_configuration,
|
|
86
|
-
base_url=base_url or "",
|
|
87
|
-
operation_id="getParameters",
|
|
88
|
-
oauth2_scopes=None,
|
|
89
|
-
security_source=get_security_from_env(security, components.Security),
|
|
90
|
-
),
|
|
91
|
-
request=req,
|
|
92
|
-
error_status_codes=["401", "404", "4XX", "500", "5XX"],
|
|
93
|
-
retry_config=retry_config,
|
|
94
|
-
)
|
|
95
|
-
|
|
96
|
-
response_data: Any = None
|
|
97
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
98
|
-
return unmarshal_json_response(operations.GetParametersResponse, http_res)
|
|
99
|
-
if utils.match_response(http_res, "401", "application/json"):
|
|
100
|
-
response_data = unmarshal_json_response(
|
|
101
|
-
errors.UnauthorizedResponseErrorData, http_res
|
|
102
|
-
)
|
|
103
|
-
raise errors.UnauthorizedResponseError(response_data, http_res)
|
|
104
|
-
if utils.match_response(http_res, "404", "application/json"):
|
|
105
|
-
response_data = unmarshal_json_response(
|
|
106
|
-
errors.NotFoundResponseErrorData, http_res
|
|
107
|
-
)
|
|
108
|
-
raise errors.NotFoundResponseError(response_data, http_res)
|
|
109
|
-
if utils.match_response(http_res, "500", "application/json"):
|
|
110
|
-
response_data = unmarshal_json_response(
|
|
111
|
-
errors.InternalServerResponseErrorData, http_res
|
|
112
|
-
)
|
|
113
|
-
raise errors.InternalServerResponseError(response_data, http_res)
|
|
114
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
115
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
116
|
-
raise errors.OpenRouterDefaultError(
|
|
117
|
-
"API error occurred", http_res, http_res_text
|
|
118
|
-
)
|
|
119
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
120
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
121
|
-
raise errors.OpenRouterDefaultError(
|
|
122
|
-
"API error occurred", http_res, http_res_text
|
|
123
|
-
)
|
|
124
|
-
|
|
125
|
-
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
|
|
126
|
-
|
|
127
|
-
async def get_parameters_async(
|
|
128
|
-
self,
|
|
129
|
-
*,
|
|
130
|
-
security: Union[
|
|
131
|
-
operations.GetParametersSecurity, operations.GetParametersSecurityTypedDict
|
|
132
|
-
],
|
|
133
|
-
author: str,
|
|
134
|
-
slug: str,
|
|
135
|
-
provider: Optional[components.ProviderName] = None,
|
|
136
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
137
|
-
server_url: Optional[str] = None,
|
|
138
|
-
timeout_ms: Optional[int] = None,
|
|
139
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
140
|
-
) -> operations.GetParametersResponse:
|
|
141
|
-
r"""Get a model's supported parameters and data about which are most popular
|
|
142
|
-
|
|
143
|
-
:param security:
|
|
144
|
-
:param author:
|
|
145
|
-
:param slug:
|
|
146
|
-
:param provider:
|
|
147
|
-
:param retries: Override the default retry configuration for this method
|
|
148
|
-
:param server_url: Override the default server URL for this method
|
|
149
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
150
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
151
|
-
"""
|
|
152
|
-
base_url = None
|
|
153
|
-
url_variables = None
|
|
154
|
-
if timeout_ms is None:
|
|
155
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
156
|
-
|
|
157
|
-
if server_url is not None:
|
|
158
|
-
base_url = server_url
|
|
159
|
-
else:
|
|
160
|
-
base_url = self._get_url(base_url, url_variables)
|
|
161
|
-
|
|
162
|
-
request = operations.GetParametersRequest(
|
|
163
|
-
author=author,
|
|
164
|
-
slug=slug,
|
|
165
|
-
provider=provider,
|
|
166
|
-
)
|
|
167
|
-
|
|
168
|
-
req = self._build_request_async(
|
|
169
|
-
method="GET",
|
|
170
|
-
path="/parameters/{author}/{slug}",
|
|
171
|
-
base_url=base_url,
|
|
172
|
-
url_variables=url_variables,
|
|
173
|
-
request=request,
|
|
174
|
-
request_body_required=False,
|
|
175
|
-
request_has_path_params=True,
|
|
176
|
-
request_has_query_params=True,
|
|
177
|
-
user_agent_header="user-agent",
|
|
178
|
-
accept_header_value="application/json",
|
|
179
|
-
http_headers=http_headers,
|
|
180
|
-
security=utils.get_pydantic_model(
|
|
181
|
-
security, operations.GetParametersSecurity
|
|
182
|
-
),
|
|
183
|
-
allow_empty_value=None,
|
|
184
|
-
timeout_ms=timeout_ms,
|
|
185
|
-
)
|
|
186
|
-
|
|
187
|
-
if retries == UNSET:
|
|
188
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
189
|
-
retries = self.sdk_configuration.retry_config
|
|
190
|
-
|
|
191
|
-
retry_config = None
|
|
192
|
-
if isinstance(retries, utils.RetryConfig):
|
|
193
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
194
|
-
|
|
195
|
-
http_res = await self.do_request_async(
|
|
196
|
-
hook_ctx=HookContext(
|
|
197
|
-
config=self.sdk_configuration,
|
|
198
|
-
base_url=base_url or "",
|
|
199
|
-
operation_id="getParameters",
|
|
200
|
-
oauth2_scopes=None,
|
|
201
|
-
security_source=get_security_from_env(security, components.Security),
|
|
202
|
-
),
|
|
203
|
-
request=req,
|
|
204
|
-
error_status_codes=["401", "404", "4XX", "500", "5XX"],
|
|
205
|
-
retry_config=retry_config,
|
|
206
|
-
)
|
|
207
|
-
|
|
208
|
-
response_data: Any = None
|
|
209
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
210
|
-
return unmarshal_json_response(operations.GetParametersResponse, http_res)
|
|
211
|
-
if utils.match_response(http_res, "401", "application/json"):
|
|
212
|
-
response_data = unmarshal_json_response(
|
|
213
|
-
errors.UnauthorizedResponseErrorData, http_res
|
|
214
|
-
)
|
|
215
|
-
raise errors.UnauthorizedResponseError(response_data, http_res)
|
|
216
|
-
if utils.match_response(http_res, "404", "application/json"):
|
|
217
|
-
response_data = unmarshal_json_response(
|
|
218
|
-
errors.NotFoundResponseErrorData, http_res
|
|
219
|
-
)
|
|
220
|
-
raise errors.NotFoundResponseError(response_data, http_res)
|
|
221
|
-
if utils.match_response(http_res, "500", "application/json"):
|
|
222
|
-
response_data = unmarshal_json_response(
|
|
223
|
-
errors.InternalServerResponseErrorData, http_res
|
|
224
|
-
)
|
|
225
|
-
raise errors.InternalServerResponseError(response_data, http_res)
|
|
226
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
227
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
228
|
-
raise errors.OpenRouterDefaultError(
|
|
229
|
-
"API error occurred", http_res, http_res_text
|
|
230
|
-
)
|
|
231
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
232
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
233
|
-
raise errors.OpenRouterDefaultError(
|
|
234
|
-
"API error occurred", http_res, http_res_text
|
|
235
|
-
)
|
|
236
|
-
|
|
237
|
-
raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
|
|
File without changes
|
|
File without changes
|