@openrouter/sdk 0.0.1 → 0.1.1
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.
- package/FUNCTIONS.md +1 -109
- package/REACT_QUERY.md +4 -121
- package/esm/funcs/embeddingsGenerate.d.ts +18 -0
- package/esm/funcs/embeddingsGenerate.js +97 -0
- package/esm/lib/config.d.ts +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/models/chaterror.d.ts +4 -4
- package/esm/models/chaterror.js +4 -4
- package/esm/models/chatgenerationparams.d.ts +4 -2
- package/esm/models/chatgenerationparams.js +4 -2
- package/esm/models/chatmessagecontentitemaudio.d.ts +15 -15
- package/esm/models/chatmessagecontentitemaudio.js +15 -16
- package/esm/models/completioncreateparams.d.ts +4 -2
- package/esm/models/completioncreateparams.js +4 -2
- package/esm/models/index.d.ts +1 -0
- package/esm/models/index.js +1 -0
- package/esm/models/openairesponsesinputunion.d.ts +21 -0
- package/esm/models/openairesponsesinputunion.js +31 -0
- package/esm/models/openairesponsesprompt.d.ts +4 -28
- package/esm/models/openairesponsesprompt.js +16 -36
- package/esm/models/openresponseseasyinputmessage.d.ts +13 -0
- package/esm/models/openresponseseasyinputmessage.js +19 -0
- package/esm/models/openresponsesinputmessageitem.d.ts +9 -0
- package/esm/models/openresponsesinputmessageitem.js +13 -0
- package/esm/models/operations/createembeddings.d.ts +582 -0
- package/esm/models/operations/createembeddings.js +608 -0
- package/esm/models/operations/getgeneration.d.ts +5 -0
- package/esm/models/operations/getgeneration.js +4 -0
- package/esm/models/operations/getparameters.d.ts +10 -10
- package/esm/models/operations/getparameters.js +14 -14
- package/esm/models/operations/index.d.ts +1 -0
- package/esm/models/operations/index.js +1 -0
- package/esm/models/responseinputaudio.d.ts +103 -0
- package/esm/models/responseinputaudio.js +114 -0
- package/esm/react-query/embeddingsGenerate.d.ts +23 -0
- package/esm/react-query/embeddingsGenerate.js +42 -0
- package/esm/react-query/index.d.ts +1 -0
- package/esm/react-query/index.js +1 -0
- package/esm/react-query/parametersGetParameters.d.ts +3 -3
- package/esm/sdk/embeddings.d.ts +12 -0
- package/esm/sdk/embeddings.js +18 -0
- package/esm/sdk/sdk.d.ts +3 -0
- package/esm/sdk/sdk.js +4 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/.devcontainer/README.md +0 -35
- package/examples/README.md +0 -31
package/FUNCTIONS.md
CHANGED
|
@@ -29,115 +29,7 @@ const openRouter = new OpenRouterCore({
|
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
async function run() {
|
|
32
|
-
const res = await betaResponsesSend(openRouter, {
|
|
33
|
-
input: [
|
|
34
|
-
{
|
|
35
|
-
type: "message",
|
|
36
|
-
role: "user",
|
|
37
|
-
content: "Hello, how are you?",
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
instructions: "<value>",
|
|
41
|
-
metadata: {
|
|
42
|
-
"user_id": "123",
|
|
43
|
-
"session_id": "abc-def-ghi",
|
|
44
|
-
},
|
|
45
|
-
tools: [
|
|
46
|
-
{
|
|
47
|
-
type: "function",
|
|
48
|
-
name: "get_current_weather",
|
|
49
|
-
description: "Get the current weather in a given location",
|
|
50
|
-
strict: true,
|
|
51
|
-
parameters: {
|
|
52
|
-
"type": "object",
|
|
53
|
-
"properties": {
|
|
54
|
-
"location": {
|
|
55
|
-
"type": "string",
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
toolChoice: {
|
|
62
|
-
type: "function",
|
|
63
|
-
name: "<value>",
|
|
64
|
-
},
|
|
65
|
-
parallelToolCalls: true,
|
|
66
|
-
model: "anthropic/claude-4.5-sonnet-20250929",
|
|
67
|
-
models: [
|
|
68
|
-
"<value 1>",
|
|
69
|
-
],
|
|
70
|
-
text: {
|
|
71
|
-
format: {
|
|
72
|
-
type: "text",
|
|
73
|
-
},
|
|
74
|
-
verbosity: "medium",
|
|
75
|
-
},
|
|
76
|
-
reasoning: {
|
|
77
|
-
effort: "high",
|
|
78
|
-
summary: "auto",
|
|
79
|
-
maxTokens: 8661.16,
|
|
80
|
-
enabled: true,
|
|
81
|
-
},
|
|
82
|
-
maxOutputTokens: null,
|
|
83
|
-
temperature: 0.7,
|
|
84
|
-
topP: 0.9,
|
|
85
|
-
topK: 193.77,
|
|
86
|
-
promptCacheKey: "<value>",
|
|
87
|
-
previousResponseId: "<id>",
|
|
88
|
-
prompt: {
|
|
89
|
-
id: "<id>",
|
|
90
|
-
variables: {
|
|
91
|
-
"key": {
|
|
92
|
-
type: "input_text",
|
|
93
|
-
text: "Hello, how can I help you?",
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
include: [
|
|
98
|
-
"reasoning.encrypted_content",
|
|
99
|
-
],
|
|
100
|
-
background: true,
|
|
101
|
-
safetyIdentifier: "<value>",
|
|
102
|
-
store: true,
|
|
103
|
-
serviceTier: "auto",
|
|
104
|
-
truncation: "auto",
|
|
105
|
-
provider: {
|
|
106
|
-
allowFallbacks: null,
|
|
107
|
-
requireParameters: true,
|
|
108
|
-
dataCollection: "deny",
|
|
109
|
-
zdr: true,
|
|
110
|
-
order: [
|
|
111
|
-
"OpenAI",
|
|
112
|
-
],
|
|
113
|
-
only: [
|
|
114
|
-
"OpenAI",
|
|
115
|
-
],
|
|
116
|
-
ignore: null,
|
|
117
|
-
quantizations: [
|
|
118
|
-
"fp16",
|
|
119
|
-
],
|
|
120
|
-
sort: "price",
|
|
121
|
-
maxPrice: {
|
|
122
|
-
prompt: "1000",
|
|
123
|
-
completion: 1000,
|
|
124
|
-
image: 1000,
|
|
125
|
-
audio: "1000",
|
|
126
|
-
request: 1000,
|
|
127
|
-
},
|
|
128
|
-
experimental: {},
|
|
129
|
-
},
|
|
130
|
-
plugins: [
|
|
131
|
-
{
|
|
132
|
-
id: "file-parser",
|
|
133
|
-
maxFiles: 4870.55,
|
|
134
|
-
pdf: {
|
|
135
|
-
engine: "mistral-ocr",
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
],
|
|
139
|
-
user: "Elmer_Yundt72",
|
|
140
|
-
});
|
|
32
|
+
const res = await betaResponsesSend(openRouter, {});
|
|
141
33
|
if (res.ok) {
|
|
142
34
|
const { value: result } = res;
|
|
143
35
|
console.log(result);
|
package/REACT_QUERY.md
CHANGED
|
@@ -53,9 +53,7 @@ from TanStack Query.
|
|
|
53
53
|
import { useAnalyticsGetUserActivity } from "@openrouter/sdk/react-query/analyticsGetUserActivity.js";
|
|
54
54
|
|
|
55
55
|
export function Example() {
|
|
56
|
-
const { data, error, status } = useAnalyticsGetUserActivity(
|
|
57
|
-
date: "2025-08-24",
|
|
58
|
-
});
|
|
56
|
+
const { data, error, status } = useAnalyticsGetUserActivity();
|
|
59
57
|
|
|
60
58
|
// Render the UI here...
|
|
61
59
|
}
|
|
@@ -73,9 +71,6 @@ import { useAnalyticsGetUserActivity } from "@openrouter/sdk/react-query/analyti
|
|
|
73
71
|
export function ExampleWithOptions() {
|
|
74
72
|
const [enabled, setEnabled] = useState(true);
|
|
75
73
|
const { data, error, status } = useAnalyticsGetUserActivity(
|
|
76
|
-
{
|
|
77
|
-
date: "2025-08-24",
|
|
78
|
-
},
|
|
79
74
|
{
|
|
80
75
|
// TanStack Query options:
|
|
81
76
|
enabled,
|
|
@@ -124,115 +119,7 @@ export function Example() {
|
|
|
124
119
|
|
|
125
120
|
// Read form data here...
|
|
126
121
|
|
|
127
|
-
mutate({
|
|
128
|
-
input: [
|
|
129
|
-
{
|
|
130
|
-
type: "message",
|
|
131
|
-
role: "user",
|
|
132
|
-
content: "Hello, how are you?",
|
|
133
|
-
},
|
|
134
|
-
],
|
|
135
|
-
instructions: "<value>",
|
|
136
|
-
metadata: {
|
|
137
|
-
"user_id": "123",
|
|
138
|
-
"session_id": "abc-def-ghi",
|
|
139
|
-
},
|
|
140
|
-
tools: [
|
|
141
|
-
{
|
|
142
|
-
type: "function",
|
|
143
|
-
name: "get_current_weather",
|
|
144
|
-
description: "Get the current weather in a given location",
|
|
145
|
-
strict: true,
|
|
146
|
-
parameters: {
|
|
147
|
-
"type": "object",
|
|
148
|
-
"properties": {
|
|
149
|
-
"location": {
|
|
150
|
-
"type": "string",
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
],
|
|
156
|
-
toolChoice: {
|
|
157
|
-
type: "function",
|
|
158
|
-
name: "<value>",
|
|
159
|
-
},
|
|
160
|
-
parallelToolCalls: true,
|
|
161
|
-
model: "anthropic/claude-4.5-sonnet-20250929",
|
|
162
|
-
models: [
|
|
163
|
-
"<value 1>",
|
|
164
|
-
],
|
|
165
|
-
text: {
|
|
166
|
-
format: {
|
|
167
|
-
type: "text",
|
|
168
|
-
},
|
|
169
|
-
verbosity: "medium",
|
|
170
|
-
},
|
|
171
|
-
reasoning: {
|
|
172
|
-
effort: "high",
|
|
173
|
-
summary: "auto",
|
|
174
|
-
maxTokens: 8661.16,
|
|
175
|
-
enabled: true,
|
|
176
|
-
},
|
|
177
|
-
maxOutputTokens: null,
|
|
178
|
-
temperature: 0.7,
|
|
179
|
-
topP: 0.9,
|
|
180
|
-
topK: 193.77,
|
|
181
|
-
promptCacheKey: "<value>",
|
|
182
|
-
previousResponseId: "<id>",
|
|
183
|
-
prompt: {
|
|
184
|
-
id: "<id>",
|
|
185
|
-
variables: {
|
|
186
|
-
"key": {
|
|
187
|
-
type: "input_text",
|
|
188
|
-
text: "Hello, how can I help you?",
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
include: [
|
|
193
|
-
"reasoning.encrypted_content",
|
|
194
|
-
],
|
|
195
|
-
background: true,
|
|
196
|
-
safetyIdentifier: "<value>",
|
|
197
|
-
store: true,
|
|
198
|
-
serviceTier: "auto",
|
|
199
|
-
truncation: "auto",
|
|
200
|
-
provider: {
|
|
201
|
-
allowFallbacks: null,
|
|
202
|
-
requireParameters: true,
|
|
203
|
-
dataCollection: "deny",
|
|
204
|
-
zdr: true,
|
|
205
|
-
order: [
|
|
206
|
-
"OpenAI",
|
|
207
|
-
],
|
|
208
|
-
only: [
|
|
209
|
-
"OpenAI",
|
|
210
|
-
],
|
|
211
|
-
ignore: null,
|
|
212
|
-
quantizations: [
|
|
213
|
-
"fp16",
|
|
214
|
-
],
|
|
215
|
-
sort: "price",
|
|
216
|
-
maxPrice: {
|
|
217
|
-
prompt: "1000",
|
|
218
|
-
completion: 1000,
|
|
219
|
-
image: 1000,
|
|
220
|
-
audio: "1000",
|
|
221
|
-
request: 1000,
|
|
222
|
-
},
|
|
223
|
-
experimental: {},
|
|
224
|
-
},
|
|
225
|
-
plugins: [
|
|
226
|
-
{
|
|
227
|
-
id: "file-parser",
|
|
228
|
-
maxFiles: 4870.55,
|
|
229
|
-
pdf: {
|
|
230
|
-
engine: "mistral-ocr",
|
|
231
|
-
},
|
|
232
|
-
},
|
|
233
|
-
],
|
|
234
|
-
user: "Elmer_Yundt72",
|
|
235
|
-
});
|
|
122
|
+
mutate({});
|
|
236
123
|
}}
|
|
237
124
|
>
|
|
238
125
|
{/* Form fields go here... */}
|
|
@@ -366,9 +253,7 @@ export function App() {
|
|
|
366
253
|
}
|
|
367
254
|
|
|
368
255
|
function Example() {
|
|
369
|
-
const { data } = useAnalyticsGetUserActivitySuspense(
|
|
370
|
-
date: "2025-08-24",
|
|
371
|
-
});
|
|
256
|
+
const { data } = useAnalyticsGetUserActivitySuspense();
|
|
372
257
|
|
|
373
258
|
// Render the UI here...
|
|
374
259
|
}
|
|
@@ -396,9 +281,7 @@ export default async function Page() {
|
|
|
396
281
|
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
|
|
397
282
|
});
|
|
398
283
|
|
|
399
|
-
await prefetchAnalyticsGetUserActivity(
|
|
400
|
-
date: "2025-08-24",
|
|
401
|
-
});
|
|
284
|
+
await prefetchAnalyticsGetUserActivity(openRouter);
|
|
402
285
|
|
|
403
286
|
return (
|
|
404
287
|
// HydrationBoundary is a Client Component, so hydration will happen there.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as operations from "../models/operations/index.js";
|
|
9
|
+
import { APIPromise } from "../types/async.js";
|
|
10
|
+
import { Result } from "../types/fp.js";
|
|
11
|
+
/**
|
|
12
|
+
* Submit an embedding request
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Submits an embedding request to the embeddings router
|
|
16
|
+
*/
|
|
17
|
+
export declare function embeddingsGenerate(client: OpenRouterCore, request: operations.CreateEmbeddingsRequest, options?: RequestOptions): APIPromise<Result<operations.CreateEmbeddingsResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
|
+
//# sourceMappingURL=embeddingsGenerate.d.ts.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
5
|
+
import * as M from "../lib/matchers.js";
|
|
6
|
+
import { compactMap } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
9
|
+
import { pathToFunc } from "../lib/url.js";
|
|
10
|
+
import * as errors from "../models/errors/index.js";
|
|
11
|
+
import * as operations from "../models/operations/index.js";
|
|
12
|
+
import { APIPromise } from "../types/async.js";
|
|
13
|
+
/**
|
|
14
|
+
* Submit an embedding request
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* Submits an embedding request to the embeddings router
|
|
18
|
+
*/
|
|
19
|
+
export function embeddingsGenerate(client, request, options) {
|
|
20
|
+
return new APIPromise($do(client, request, options));
|
|
21
|
+
}
|
|
22
|
+
async function $do(client, request, options) {
|
|
23
|
+
const parsed = safeParse(request, (value) => operations.CreateEmbeddingsRequest$outboundSchema.parse(value), "Input validation failed");
|
|
24
|
+
if (!parsed.ok) {
|
|
25
|
+
return [parsed, { status: "invalid" }];
|
|
26
|
+
}
|
|
27
|
+
const payload = parsed.value;
|
|
28
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
29
|
+
const path = pathToFunc("/embeddings")();
|
|
30
|
+
const headers = new Headers(compactMap({
|
|
31
|
+
"Content-Type": "application/json",
|
|
32
|
+
Accept: "application/json;q=1, text/event-stream;q=0",
|
|
33
|
+
}));
|
|
34
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
35
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
36
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
37
|
+
const context = {
|
|
38
|
+
options: client._options,
|
|
39
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
40
|
+
operationID: "createEmbeddings",
|
|
41
|
+
oAuth2Scopes: null,
|
|
42
|
+
resolvedSecurity: requestSecurity,
|
|
43
|
+
securitySource: client._options.apiKey,
|
|
44
|
+
retryConfig: options?.retries
|
|
45
|
+
|| client._options.retryConfig
|
|
46
|
+
|| { strategy: "none" },
|
|
47
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
48
|
+
};
|
|
49
|
+
const requestRes = client._createRequest(context, {
|
|
50
|
+
security: requestSecurity,
|
|
51
|
+
method: "POST",
|
|
52
|
+
baseURL: options?.serverURL,
|
|
53
|
+
path: path,
|
|
54
|
+
headers: headers,
|
|
55
|
+
body: body,
|
|
56
|
+
userAgent: client._options.userAgent,
|
|
57
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
58
|
+
}, options);
|
|
59
|
+
if (!requestRes.ok) {
|
|
60
|
+
return [requestRes, { status: "invalid" }];
|
|
61
|
+
}
|
|
62
|
+
const req = requestRes.value;
|
|
63
|
+
const doResult = await client._do(req, {
|
|
64
|
+
context,
|
|
65
|
+
errorCodes: [
|
|
66
|
+
"400",
|
|
67
|
+
"401",
|
|
68
|
+
"402",
|
|
69
|
+
"404",
|
|
70
|
+
"429",
|
|
71
|
+
"4XX",
|
|
72
|
+
"500",
|
|
73
|
+
"502",
|
|
74
|
+
"503",
|
|
75
|
+
"524",
|
|
76
|
+
"529",
|
|
77
|
+
"5XX",
|
|
78
|
+
],
|
|
79
|
+
retryConfig: context.retryConfig,
|
|
80
|
+
retryCodes: context.retryCodes,
|
|
81
|
+
});
|
|
82
|
+
if (!doResult.ok) {
|
|
83
|
+
return [doResult, { status: "request-error", request: req }];
|
|
84
|
+
}
|
|
85
|
+
const response = doResult.value;
|
|
86
|
+
const responseFields = {
|
|
87
|
+
HttpMeta: { Response: response, Request: req },
|
|
88
|
+
};
|
|
89
|
+
const [result] = await M.match(M.json(200, operations.CreateEmbeddingsResponse$inboundSchema), M.text(200, operations.CreateEmbeddingsResponse$inboundSchema, {
|
|
90
|
+
ctype: "text/event-stream",
|
|
91
|
+
}), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(402, errors.PaymentRequiredResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.jsonErr(502, errors.BadGatewayResponseError$inboundSchema), M.jsonErr(503, errors.ServiceUnavailableResponseError$inboundSchema), M.jsonErr(524, errors.EdgeNetworkTimeoutResponseError$inboundSchema), M.jsonErr(529, errors.ProviderOverloadedResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
92
|
+
if (!result.ok) {
|
|
93
|
+
return [result, { status: "complete", request: req, response }];
|
|
94
|
+
}
|
|
95
|
+
return [result, { status: "complete", request: req, response }];
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=embeddingsGenerate.js.map
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -37,8 +37,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
37
37
|
export declare const SDK_METADATA: {
|
|
38
38
|
readonly language: "typescript";
|
|
39
39
|
readonly openapiDocVersion: "1.0.0";
|
|
40
|
-
readonly sdkVersion: "0.
|
|
41
|
-
readonly genVersion: "2.
|
|
42
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.
|
|
40
|
+
readonly sdkVersion: "0.1.1";
|
|
41
|
+
readonly genVersion: "2.739.1";
|
|
42
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.1.1 2.739.1 1.0.0 @openrouter/sdk";
|
|
43
43
|
};
|
|
44
44
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -25,8 +25,8 @@ export function serverURLFromOptions(options) {
|
|
|
25
25
|
export const SDK_METADATA = {
|
|
26
26
|
language: "typescript",
|
|
27
27
|
openapiDocVersion: "1.0.0",
|
|
28
|
-
sdkVersion: "0.
|
|
29
|
-
genVersion: "2.
|
|
30
|
-
userAgent: "speakeasy-sdk/typescript 0.
|
|
28
|
+
sdkVersion: "0.1.1",
|
|
29
|
+
genVersion: "2.739.1",
|
|
30
|
+
userAgent: "speakeasy-sdk/typescript 0.1.1 2.739.1 1.0.0 @openrouter/sdk",
|
|
31
31
|
};
|
|
32
32
|
//# sourceMappingURL=config.js.map
|
|
@@ -5,8 +5,8 @@ export type Code = string | number;
|
|
|
5
5
|
export type ChatErrorError = {
|
|
6
6
|
code: string | number | null;
|
|
7
7
|
message: string;
|
|
8
|
-
param
|
|
9
|
-
type
|
|
8
|
+
param?: string | null | undefined;
|
|
9
|
+
type?: string | null | undefined;
|
|
10
10
|
};
|
|
11
11
|
/** @internal */
|
|
12
12
|
export declare const Code$inboundSchema: z.ZodType<Code, unknown>;
|
|
@@ -34,8 +34,8 @@ export declare const ChatErrorError$inboundSchema: z.ZodType<ChatErrorError, unk
|
|
|
34
34
|
export type ChatErrorError$Outbound = {
|
|
35
35
|
code: string | number | null;
|
|
36
36
|
message: string;
|
|
37
|
-
param
|
|
38
|
-
type
|
|
37
|
+
param?: string | null | undefined;
|
|
38
|
+
type?: string | null | undefined;
|
|
39
39
|
};
|
|
40
40
|
/** @internal */
|
|
41
41
|
export declare const ChatErrorError$outboundSchema: z.ZodType<ChatErrorError$Outbound, ChatErrorError>;
|
package/esm/models/chaterror.js
CHANGED
|
@@ -34,15 +34,15 @@ export function codeFromJSON(jsonString) {
|
|
|
34
34
|
export const ChatErrorError$inboundSchema = z.object({
|
|
35
35
|
code: z.nullable(z.union([z.string(), z.number()])),
|
|
36
36
|
message: z.string(),
|
|
37
|
-
param: z.nullable(z.string()),
|
|
38
|
-
type: z.string(),
|
|
37
|
+
param: z.nullable(z.string()).optional(),
|
|
38
|
+
type: z.nullable(z.string()).optional(),
|
|
39
39
|
});
|
|
40
40
|
/** @internal */
|
|
41
41
|
export const ChatErrorError$outboundSchema = z.object({
|
|
42
42
|
code: z.nullable(z.union([z.string(), z.number()])),
|
|
43
43
|
message: z.string(),
|
|
44
|
-
param: z.nullable(z.string()),
|
|
45
|
-
type: z.string(),
|
|
44
|
+
param: z.nullable(z.string()).optional(),
|
|
45
|
+
type: z.nullable(z.string()).optional(),
|
|
46
46
|
});
|
|
47
47
|
/**
|
|
48
48
|
* @internal
|
|
@@ -32,7 +32,8 @@ export type ChatGenerationParamsResponseFormatUnion = ResponseFormatJSONSchema |
|
|
|
32
32
|
export type ChatGenerationParamsStop = string | Array<string>;
|
|
33
33
|
export type ChatGenerationParams = {
|
|
34
34
|
messages: Array<Message>;
|
|
35
|
-
model
|
|
35
|
+
model?: string | undefined;
|
|
36
|
+
models?: Array<string> | undefined;
|
|
36
37
|
frequencyPenalty?: number | null | undefined;
|
|
37
38
|
logitBias?: {
|
|
38
39
|
[k: string]: number;
|
|
@@ -205,7 +206,8 @@ export declare const ChatGenerationParams$inboundSchema: z.ZodType<ChatGeneratio
|
|
|
205
206
|
/** @internal */
|
|
206
207
|
export type ChatGenerationParams$Outbound = {
|
|
207
208
|
messages: Array<Message$Outbound>;
|
|
208
|
-
model
|
|
209
|
+
model?: string | undefined;
|
|
210
|
+
models?: Array<string> | undefined;
|
|
209
211
|
frequency_penalty?: number | null | undefined;
|
|
210
212
|
logit_bias?: {
|
|
211
213
|
[k: string]: number;
|
|
@@ -198,7 +198,8 @@ export function chatGenerationParamsStopFromJSON(jsonString) {
|
|
|
198
198
|
/** @internal */
|
|
199
199
|
export const ChatGenerationParams$inboundSchema = z.object({
|
|
200
200
|
messages: z.array(Message$inboundSchema),
|
|
201
|
-
model: z.string(),
|
|
201
|
+
model: z.string().optional(),
|
|
202
|
+
models: z.array(z.string()).optional(),
|
|
202
203
|
frequency_penalty: z.nullable(z.number()).optional(),
|
|
203
204
|
logit_bias: z.nullable(z.record(z.string(), z.number())).optional(),
|
|
204
205
|
logprobs: z.nullable(z.boolean()).optional(),
|
|
@@ -241,7 +242,8 @@ export const ChatGenerationParams$inboundSchema = z.object({
|
|
|
241
242
|
/** @internal */
|
|
242
243
|
export const ChatGenerationParams$outboundSchema = z.object({
|
|
243
244
|
messages: z.array(Message$outboundSchema),
|
|
244
|
-
model: z.string(),
|
|
245
|
+
model: z.string().optional(),
|
|
246
|
+
models: z.array(z.string()).optional(),
|
|
245
247
|
frequencyPenalty: z.nullable(z.number()).optional(),
|
|
246
248
|
logitBias: z.nullable(z.record(z.string(), z.number())).optional(),
|
|
247
249
|
logprobs: z.nullable(z.boolean()).optional(),
|
|
@@ -12,13 +12,13 @@ export declare const ChatMessageContentItemAudioFormat: {
|
|
|
12
12
|
readonly Pcm24: "pcm24";
|
|
13
13
|
};
|
|
14
14
|
export type ChatMessageContentItemAudioFormat = OpenEnum<typeof ChatMessageContentItemAudioFormat>;
|
|
15
|
-
export type
|
|
15
|
+
export type ChatMessageContentItemAudioInputAudio = {
|
|
16
16
|
data: string;
|
|
17
17
|
format: ChatMessageContentItemAudioFormat;
|
|
18
18
|
};
|
|
19
19
|
export type ChatMessageContentItemAudio = {
|
|
20
20
|
type: "input_audio";
|
|
21
|
-
inputAudio:
|
|
21
|
+
inputAudio: ChatMessageContentItemAudioInputAudio;
|
|
22
22
|
};
|
|
23
23
|
/** @internal */
|
|
24
24
|
export declare const ChatMessageContentItemAudioFormat$inboundSchema: z.ZodType<ChatMessageContentItemAudioFormat, unknown>;
|
|
@@ -35,34 +35,34 @@ export declare namespace ChatMessageContentItemAudioFormat$ {
|
|
|
35
35
|
const outboundSchema: z.ZodType<ChatMessageContentItemAudioFormat, ChatMessageContentItemAudioFormat, z.core.$ZodTypeInternals<ChatMessageContentItemAudioFormat, ChatMessageContentItemAudioFormat>>;
|
|
36
36
|
}
|
|
37
37
|
/** @internal */
|
|
38
|
-
export declare const
|
|
38
|
+
export declare const ChatMessageContentItemAudioInputAudio$inboundSchema: z.ZodType<ChatMessageContentItemAudioInputAudio, unknown>;
|
|
39
39
|
/** @internal */
|
|
40
|
-
export type
|
|
40
|
+
export type ChatMessageContentItemAudioInputAudio$Outbound = {
|
|
41
41
|
data: string;
|
|
42
42
|
format: string;
|
|
43
43
|
};
|
|
44
44
|
/** @internal */
|
|
45
|
-
export declare const
|
|
45
|
+
export declare const ChatMessageContentItemAudioInputAudio$outboundSchema: z.ZodType<ChatMessageContentItemAudioInputAudio$Outbound, ChatMessageContentItemAudioInputAudio>;
|
|
46
46
|
/**
|
|
47
47
|
* @internal
|
|
48
48
|
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
49
49
|
*/
|
|
50
|
-
export declare namespace
|
|
51
|
-
/** @deprecated use `
|
|
52
|
-
const inboundSchema: z.ZodType<
|
|
53
|
-
/** @deprecated use `
|
|
54
|
-
const outboundSchema: z.ZodType<
|
|
55
|
-
/** @deprecated use `
|
|
56
|
-
type Outbound =
|
|
50
|
+
export declare namespace ChatMessageContentItemAudioInputAudio$ {
|
|
51
|
+
/** @deprecated use `ChatMessageContentItemAudioInputAudio$inboundSchema` instead. */
|
|
52
|
+
const inboundSchema: z.ZodType<ChatMessageContentItemAudioInputAudio, unknown, z.core.$ZodTypeInternals<ChatMessageContentItemAudioInputAudio, unknown>>;
|
|
53
|
+
/** @deprecated use `ChatMessageContentItemAudioInputAudio$outboundSchema` instead. */
|
|
54
|
+
const outboundSchema: z.ZodType<ChatMessageContentItemAudioInputAudio$Outbound, ChatMessageContentItemAudioInputAudio, z.core.$ZodTypeInternals<ChatMessageContentItemAudioInputAudio$Outbound, ChatMessageContentItemAudioInputAudio>>;
|
|
55
|
+
/** @deprecated use `ChatMessageContentItemAudioInputAudio$Outbound` instead. */
|
|
56
|
+
type Outbound = ChatMessageContentItemAudioInputAudio$Outbound;
|
|
57
57
|
}
|
|
58
|
-
export declare function
|
|
59
|
-
export declare function
|
|
58
|
+
export declare function chatMessageContentItemAudioInputAudioToJSON(chatMessageContentItemAudioInputAudio: ChatMessageContentItemAudioInputAudio): string;
|
|
59
|
+
export declare function chatMessageContentItemAudioInputAudioFromJSON(jsonString: string): SafeParseResult<ChatMessageContentItemAudioInputAudio, SDKValidationError>;
|
|
60
60
|
/** @internal */
|
|
61
61
|
export declare const ChatMessageContentItemAudio$inboundSchema: z.ZodType<ChatMessageContentItemAudio, unknown>;
|
|
62
62
|
/** @internal */
|
|
63
63
|
export type ChatMessageContentItemAudio$Outbound = {
|
|
64
64
|
type: "input_audio";
|
|
65
|
-
input_audio:
|
|
65
|
+
input_audio: ChatMessageContentItemAudioInputAudio$Outbound;
|
|
66
66
|
};
|
|
67
67
|
/** @internal */
|
|
68
68
|
export declare const ChatMessageContentItemAudio$outboundSchema: z.ZodType<ChatMessageContentItemAudio$Outbound, ChatMessageContentItemAudio>;
|
|
@@ -37,13 +37,12 @@ export var ChatMessageContentItemAudioFormat$;
|
|
|
37
37
|
ChatMessageContentItemAudioFormat$.outboundSchema = ChatMessageContentItemAudioFormat$outboundSchema;
|
|
38
38
|
})(ChatMessageContentItemAudioFormat$ || (ChatMessageContentItemAudioFormat$ = {}));
|
|
39
39
|
/** @internal */
|
|
40
|
-
export const
|
|
41
|
-
.object({
|
|
40
|
+
export const ChatMessageContentItemAudioInputAudio$inboundSchema = z.object({
|
|
42
41
|
data: z.string(),
|
|
43
42
|
format: ChatMessageContentItemAudioFormat$inboundSchema,
|
|
44
43
|
});
|
|
45
44
|
/** @internal */
|
|
46
|
-
export const
|
|
45
|
+
export const ChatMessageContentItemAudioInputAudio$outboundSchema = z.object({
|
|
47
46
|
data: z.string(),
|
|
48
47
|
format: ChatMessageContentItemAudioFormat$outboundSchema,
|
|
49
48
|
});
|
|
@@ -51,23 +50,23 @@ export const InputAudio$outboundSchema = z.object({
|
|
|
51
50
|
* @internal
|
|
52
51
|
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
53
52
|
*/
|
|
54
|
-
export var
|
|
55
|
-
(function (
|
|
56
|
-
/** @deprecated use `
|
|
57
|
-
|
|
58
|
-
/** @deprecated use `
|
|
59
|
-
|
|
60
|
-
})(
|
|
61
|
-
export function
|
|
62
|
-
return JSON.stringify(
|
|
53
|
+
export var ChatMessageContentItemAudioInputAudio$;
|
|
54
|
+
(function (ChatMessageContentItemAudioInputAudio$) {
|
|
55
|
+
/** @deprecated use `ChatMessageContentItemAudioInputAudio$inboundSchema` instead. */
|
|
56
|
+
ChatMessageContentItemAudioInputAudio$.inboundSchema = ChatMessageContentItemAudioInputAudio$inboundSchema;
|
|
57
|
+
/** @deprecated use `ChatMessageContentItemAudioInputAudio$outboundSchema` instead. */
|
|
58
|
+
ChatMessageContentItemAudioInputAudio$.outboundSchema = ChatMessageContentItemAudioInputAudio$outboundSchema;
|
|
59
|
+
})(ChatMessageContentItemAudioInputAudio$ || (ChatMessageContentItemAudioInputAudio$ = {}));
|
|
60
|
+
export function chatMessageContentItemAudioInputAudioToJSON(chatMessageContentItemAudioInputAudio) {
|
|
61
|
+
return JSON.stringify(ChatMessageContentItemAudioInputAudio$outboundSchema.parse(chatMessageContentItemAudioInputAudio));
|
|
63
62
|
}
|
|
64
|
-
export function
|
|
65
|
-
return safeParse(jsonString, (x) =>
|
|
63
|
+
export function chatMessageContentItemAudioInputAudioFromJSON(jsonString) {
|
|
64
|
+
return safeParse(jsonString, (x) => ChatMessageContentItemAudioInputAudio$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatMessageContentItemAudioInputAudio' from JSON`);
|
|
66
65
|
}
|
|
67
66
|
/** @internal */
|
|
68
67
|
export const ChatMessageContentItemAudio$inboundSchema = z.object({
|
|
69
68
|
type: z.literal("input_audio"),
|
|
70
|
-
input_audio: z.lazy(() =>
|
|
69
|
+
input_audio: z.lazy(() => ChatMessageContentItemAudioInputAudio$inboundSchema),
|
|
71
70
|
}).transform((v) => {
|
|
72
71
|
return remap$(v, {
|
|
73
72
|
"input_audio": "inputAudio",
|
|
@@ -76,7 +75,7 @@ export const ChatMessageContentItemAudio$inboundSchema = z.object({
|
|
|
76
75
|
/** @internal */
|
|
77
76
|
export const ChatMessageContentItemAudio$outboundSchema = z.object({
|
|
78
77
|
type: z.literal("input_audio"),
|
|
79
|
-
inputAudio: z.lazy(() =>
|
|
78
|
+
inputAudio: z.lazy(() => ChatMessageContentItemAudioInputAudio$outboundSchema),
|
|
80
79
|
}).transform((v) => {
|
|
81
80
|
return remap$(v, {
|
|
82
81
|
inputAudio: "input_audio",
|
|
@@ -19,7 +19,8 @@ export type CompletionCreateParamsResponseFormatText = {
|
|
|
19
19
|
};
|
|
20
20
|
export type CompletionCreateParamsResponseFormatUnion = ResponseFormatJSONSchema | ResponseFormatTextGrammar | CompletionCreateParamsResponseFormatText | CompletionCreateParamsResponseFormatJSONObject | CompletionCreateParamsResponseFormatPython;
|
|
21
21
|
export type CompletionCreateParams = {
|
|
22
|
-
model
|
|
22
|
+
model?: string | undefined;
|
|
23
|
+
models?: Array<string> | undefined;
|
|
23
24
|
prompt: string | Array<string> | Array<number> | Array<Array<number>>;
|
|
24
25
|
bestOf?: number | null | undefined;
|
|
25
26
|
echo?: boolean | null | undefined;
|
|
@@ -196,7 +197,8 @@ export declare function completionCreateParamsResponseFormatUnionFromJSON(jsonSt
|
|
|
196
197
|
export declare const CompletionCreateParams$inboundSchema: z.ZodType<CompletionCreateParams, unknown>;
|
|
197
198
|
/** @internal */
|
|
198
199
|
export type CompletionCreateParams$Outbound = {
|
|
199
|
-
model
|
|
200
|
+
model?: string | undefined;
|
|
201
|
+
models?: Array<string> | undefined;
|
|
200
202
|
prompt: string | Array<string> | Array<number> | Array<Array<number>>;
|
|
201
203
|
best_of?: number | null | undefined;
|
|
202
204
|
echo?: boolean | null | undefined;
|
|
@@ -203,7 +203,8 @@ export function completionCreateParamsResponseFormatUnionFromJSON(jsonString) {
|
|
|
203
203
|
}
|
|
204
204
|
/** @internal */
|
|
205
205
|
export const CompletionCreateParams$inboundSchema = z.object({
|
|
206
|
-
model: z.string(),
|
|
206
|
+
model: z.string().optional(),
|
|
207
|
+
models: z.array(z.string()).optional(),
|
|
207
208
|
prompt: z.union([
|
|
208
209
|
z.string(),
|
|
209
210
|
z.array(z.string()),
|
|
@@ -249,7 +250,8 @@ export const CompletionCreateParams$inboundSchema = z.object({
|
|
|
249
250
|
});
|
|
250
251
|
/** @internal */
|
|
251
252
|
export const CompletionCreateParams$outboundSchema = z.object({
|
|
252
|
-
model: z.string(),
|
|
253
|
+
model: z.string().optional(),
|
|
254
|
+
models: z.array(z.string()).optional(),
|
|
253
255
|
prompt: z.union([
|
|
254
256
|
z.string(),
|
|
255
257
|
z.array(z.string()),
|