@openrouter/sdk 0.12.30 → 0.12.31
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/esm/funcs/betaResponsesSend.js +1 -0
- package/esm/funcs/chatSend.js +1 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/chatresult.d.ts +2 -0
- package/esm/models/chatresult.js +3 -0
- package/esm/models/chatstreamchunk.d.ts +2 -0
- package/esm/models/chatstreamchunk.js +3 -0
- package/esm/models/endpointinfo.d.ts +14 -0
- package/esm/models/endpointinfo.js +25 -0
- package/esm/models/endpointsmetadata.d.ts +14 -0
- package/esm/models/endpointsmetadata.js +23 -0
- package/esm/models/errors/badgatewayresponseerror.d.ts +6 -0
- package/esm/models/errors/badgatewayresponseerror.js +6 -0
- package/esm/models/errors/badrequestresponseerror.d.ts +6 -0
- package/esm/models/errors/badrequestresponseerror.js +6 -0
- package/esm/models/errors/conflictresponseerror.d.ts +6 -0
- package/esm/models/errors/conflictresponseerror.js +6 -0
- package/esm/models/errors/edgenetworktimeoutresponseerror.d.ts +6 -0
- package/esm/models/errors/edgenetworktimeoutresponseerror.js +6 -0
- package/esm/models/errors/forbiddenresponseerror.d.ts +6 -0
- package/esm/models/errors/forbiddenresponseerror.js +6 -0
- package/esm/models/errors/internalserverresponseerror.d.ts +6 -0
- package/esm/models/errors/internalserverresponseerror.js +6 -0
- package/esm/models/errors/notfoundresponseerror.d.ts +6 -0
- package/esm/models/errors/notfoundresponseerror.js +6 -0
- package/esm/models/errors/payloadtoolargeresponseerror.d.ts +6 -0
- package/esm/models/errors/payloadtoolargeresponseerror.js +6 -0
- package/esm/models/errors/paymentrequiredresponseerror.d.ts +6 -0
- package/esm/models/errors/paymentrequiredresponseerror.js +6 -0
- package/esm/models/errors/provideroverloadedresponseerror.d.ts +6 -0
- package/esm/models/errors/provideroverloadedresponseerror.js +6 -0
- package/esm/models/errors/requesttimeoutresponseerror.d.ts +6 -0
- package/esm/models/errors/requesttimeoutresponseerror.js +6 -0
- package/esm/models/errors/serviceunavailableresponseerror.d.ts +6 -0
- package/esm/models/errors/serviceunavailableresponseerror.js +6 -0
- package/esm/models/errors/toomanyrequestsresponseerror.d.ts +6 -0
- package/esm/models/errors/toomanyrequestsresponseerror.js +6 -0
- package/esm/models/errors/unauthorizedresponseerror.d.ts +6 -0
- package/esm/models/errors/unauthorizedresponseerror.js +6 -0
- package/esm/models/errors/unprocessableentityresponseerror.d.ts +6 -0
- package/esm/models/errors/unprocessableentityresponseerror.js +6 -0
- package/esm/models/index.d.ts +10 -0
- package/esm/models/index.js +10 -0
- package/esm/models/metadatalevel.d.ts +16 -0
- package/esm/models/metadatalevel.js +15 -0
- package/esm/models/openresponsesresult.d.ts +2 -0
- package/esm/models/openresponsesresult.js +3 -0
- package/esm/models/openroutermetadata.d.ts +24 -0
- package/esm/models/openroutermetadata.js +33 -0
- package/esm/models/operations/createresponses.d.ts +4 -11
- package/esm/models/operations/createresponses.js +5 -20
- package/esm/models/operations/sendchatcompletionrequest.d.ts +5 -0
- package/esm/models/operations/sendchatcompletionrequest.js +3 -0
- package/esm/models/pipelinestage.d.ts +21 -0
- package/esm/models/pipelinestage.js +28 -0
- package/esm/models/pipelinestagetype.d.ts +21 -0
- package/esm/models/pipelinestagetype.js +20 -0
- package/esm/models/responsesstreamingresponse.d.ts +14 -0
- package/esm/models/responsesstreamingresponse.js +27 -0
- package/esm/models/routerattempt.d.ts +12 -0
- package/esm/models/routerattempt.js +17 -0
- package/esm/models/routerparams.d.ts +16 -0
- package/esm/models/routerparams.js +24 -0
- package/esm/models/routingstrategy.d.ts +16 -0
- package/esm/models/routingstrategy.js +18 -0
- package/jsr.json +1 -1
- package/package.json +6 -6
|
@@ -16,6 +16,9 @@ export class ProviderOverloadedResponseError extends OpenRouterError {
|
|
|
16
16
|
super(message, httpMeta);
|
|
17
17
|
this.data$ = err;
|
|
18
18
|
this.error = err.error;
|
|
19
|
+
if (err.openrouterMetadata != null) {
|
|
20
|
+
this.openrouterMetadata = err.openrouterMetadata;
|
|
21
|
+
}
|
|
19
22
|
if (err.userId != null)
|
|
20
23
|
this.userId = err.userId;
|
|
21
24
|
this.name = "ProviderOverloadedResponseError";
|
|
@@ -24,6 +27,8 @@ export class ProviderOverloadedResponseError extends OpenRouterError {
|
|
|
24
27
|
/** @internal */
|
|
25
28
|
export const ProviderOverloadedResponseError$inboundSchema = z.object({
|
|
26
29
|
error: models.ProviderOverloadedResponseErrorData$inboundSchema,
|
|
30
|
+
openrouter_metadata: z.nullable(z.record(z.string(), z.nullable(z.any())))
|
|
31
|
+
.optional(),
|
|
27
32
|
user_id: z.nullable(z.string()).optional(),
|
|
28
33
|
request$: z.custom(x => x instanceof Request),
|
|
29
34
|
response$: z.custom(x => x instanceof Response),
|
|
@@ -31,6 +36,7 @@ export const ProviderOverloadedResponseError$inboundSchema = z.object({
|
|
|
31
36
|
})
|
|
32
37
|
.transform((v) => {
|
|
33
38
|
const remapped = remap$(v, {
|
|
39
|
+
"openrouter_metadata": "openrouterMetadata",
|
|
34
40
|
"user_id": "userId",
|
|
35
41
|
});
|
|
36
42
|
return new ProviderOverloadedResponseError(remapped, {
|
|
@@ -9,6 +9,9 @@ export type RequestTimeoutResponseErrorData = {
|
|
|
9
9
|
* Error data for RequestTimeoutResponse
|
|
10
10
|
*/
|
|
11
11
|
error: models.RequestTimeoutResponseErrorData;
|
|
12
|
+
openrouterMetadata?: {
|
|
13
|
+
[k: string]: any | null;
|
|
14
|
+
} | null | undefined;
|
|
12
15
|
userId?: string | null | undefined;
|
|
13
16
|
};
|
|
14
17
|
/**
|
|
@@ -19,6 +22,9 @@ export declare class RequestTimeoutResponseError extends OpenRouterError {
|
|
|
19
22
|
* Error data for RequestTimeoutResponse
|
|
20
23
|
*/
|
|
21
24
|
error: models.RequestTimeoutResponseErrorData;
|
|
25
|
+
openrouterMetadata?: {
|
|
26
|
+
[k: string]: any | null;
|
|
27
|
+
} | null | undefined;
|
|
22
28
|
userId?: string | null | undefined;
|
|
23
29
|
/** The original data that was passed to this error instance. */
|
|
24
30
|
data$: RequestTimeoutResponseErrorData;
|
|
@@ -16,6 +16,9 @@ export class RequestTimeoutResponseError extends OpenRouterError {
|
|
|
16
16
|
super(message, httpMeta);
|
|
17
17
|
this.data$ = err;
|
|
18
18
|
this.error = err.error;
|
|
19
|
+
if (err.openrouterMetadata != null) {
|
|
20
|
+
this.openrouterMetadata = err.openrouterMetadata;
|
|
21
|
+
}
|
|
19
22
|
if (err.userId != null)
|
|
20
23
|
this.userId = err.userId;
|
|
21
24
|
this.name = "RequestTimeoutResponseError";
|
|
@@ -24,6 +27,8 @@ export class RequestTimeoutResponseError extends OpenRouterError {
|
|
|
24
27
|
/** @internal */
|
|
25
28
|
export const RequestTimeoutResponseError$inboundSchema = z.object({
|
|
26
29
|
error: models.RequestTimeoutResponseErrorData$inboundSchema,
|
|
30
|
+
openrouter_metadata: z.nullable(z.record(z.string(), z.nullable(z.any())))
|
|
31
|
+
.optional(),
|
|
27
32
|
user_id: z.nullable(z.string()).optional(),
|
|
28
33
|
request$: z.custom(x => x instanceof Request),
|
|
29
34
|
response$: z.custom(x => x instanceof Response),
|
|
@@ -31,6 +36,7 @@ export const RequestTimeoutResponseError$inboundSchema = z.object({
|
|
|
31
36
|
})
|
|
32
37
|
.transform((v) => {
|
|
33
38
|
const remapped = remap$(v, {
|
|
39
|
+
"openrouter_metadata": "openrouterMetadata",
|
|
34
40
|
"user_id": "userId",
|
|
35
41
|
});
|
|
36
42
|
return new RequestTimeoutResponseError(remapped, {
|
|
@@ -9,6 +9,9 @@ export type ServiceUnavailableResponseErrorData = {
|
|
|
9
9
|
* Error data for ServiceUnavailableResponse
|
|
10
10
|
*/
|
|
11
11
|
error: models.ServiceUnavailableResponseErrorData;
|
|
12
|
+
openrouterMetadata?: {
|
|
13
|
+
[k: string]: any | null;
|
|
14
|
+
} | null | undefined;
|
|
12
15
|
userId?: string | null | undefined;
|
|
13
16
|
};
|
|
14
17
|
/**
|
|
@@ -19,6 +22,9 @@ export declare class ServiceUnavailableResponseError extends OpenRouterError {
|
|
|
19
22
|
* Error data for ServiceUnavailableResponse
|
|
20
23
|
*/
|
|
21
24
|
error: models.ServiceUnavailableResponseErrorData;
|
|
25
|
+
openrouterMetadata?: {
|
|
26
|
+
[k: string]: any | null;
|
|
27
|
+
} | null | undefined;
|
|
22
28
|
userId?: string | null | undefined;
|
|
23
29
|
/** The original data that was passed to this error instance. */
|
|
24
30
|
data$: ServiceUnavailableResponseErrorData;
|
|
@@ -16,6 +16,9 @@ export class ServiceUnavailableResponseError extends OpenRouterError {
|
|
|
16
16
|
super(message, httpMeta);
|
|
17
17
|
this.data$ = err;
|
|
18
18
|
this.error = err.error;
|
|
19
|
+
if (err.openrouterMetadata != null) {
|
|
20
|
+
this.openrouterMetadata = err.openrouterMetadata;
|
|
21
|
+
}
|
|
19
22
|
if (err.userId != null)
|
|
20
23
|
this.userId = err.userId;
|
|
21
24
|
this.name = "ServiceUnavailableResponseError";
|
|
@@ -24,6 +27,8 @@ export class ServiceUnavailableResponseError extends OpenRouterError {
|
|
|
24
27
|
/** @internal */
|
|
25
28
|
export const ServiceUnavailableResponseError$inboundSchema = z.object({
|
|
26
29
|
error: models.ServiceUnavailableResponseErrorData$inboundSchema,
|
|
30
|
+
openrouter_metadata: z.nullable(z.record(z.string(), z.nullable(z.any())))
|
|
31
|
+
.optional(),
|
|
27
32
|
user_id: z.nullable(z.string()).optional(),
|
|
28
33
|
request$: z.custom(x => x instanceof Request),
|
|
29
34
|
response$: z.custom(x => x instanceof Response),
|
|
@@ -31,6 +36,7 @@ export const ServiceUnavailableResponseError$inboundSchema = z.object({
|
|
|
31
36
|
})
|
|
32
37
|
.transform((v) => {
|
|
33
38
|
const remapped = remap$(v, {
|
|
39
|
+
"openrouter_metadata": "openrouterMetadata",
|
|
34
40
|
"user_id": "userId",
|
|
35
41
|
});
|
|
36
42
|
return new ServiceUnavailableResponseError(remapped, {
|
|
@@ -9,6 +9,9 @@ export type TooManyRequestsResponseErrorData = {
|
|
|
9
9
|
* Error data for TooManyRequestsResponse
|
|
10
10
|
*/
|
|
11
11
|
error: models.TooManyRequestsResponseErrorData;
|
|
12
|
+
openrouterMetadata?: {
|
|
13
|
+
[k: string]: any | null;
|
|
14
|
+
} | null | undefined;
|
|
12
15
|
userId?: string | null | undefined;
|
|
13
16
|
};
|
|
14
17
|
/**
|
|
@@ -19,6 +22,9 @@ export declare class TooManyRequestsResponseError extends OpenRouterError {
|
|
|
19
22
|
* Error data for TooManyRequestsResponse
|
|
20
23
|
*/
|
|
21
24
|
error: models.TooManyRequestsResponseErrorData;
|
|
25
|
+
openrouterMetadata?: {
|
|
26
|
+
[k: string]: any | null;
|
|
27
|
+
} | null | undefined;
|
|
22
28
|
userId?: string | null | undefined;
|
|
23
29
|
/** The original data that was passed to this error instance. */
|
|
24
30
|
data$: TooManyRequestsResponseErrorData;
|
|
@@ -16,6 +16,9 @@ export class TooManyRequestsResponseError extends OpenRouterError {
|
|
|
16
16
|
super(message, httpMeta);
|
|
17
17
|
this.data$ = err;
|
|
18
18
|
this.error = err.error;
|
|
19
|
+
if (err.openrouterMetadata != null) {
|
|
20
|
+
this.openrouterMetadata = err.openrouterMetadata;
|
|
21
|
+
}
|
|
19
22
|
if (err.userId != null)
|
|
20
23
|
this.userId = err.userId;
|
|
21
24
|
this.name = "TooManyRequestsResponseError";
|
|
@@ -24,6 +27,8 @@ export class TooManyRequestsResponseError extends OpenRouterError {
|
|
|
24
27
|
/** @internal */
|
|
25
28
|
export const TooManyRequestsResponseError$inboundSchema = z.object({
|
|
26
29
|
error: models.TooManyRequestsResponseErrorData$inboundSchema,
|
|
30
|
+
openrouter_metadata: z.nullable(z.record(z.string(), z.nullable(z.any())))
|
|
31
|
+
.optional(),
|
|
27
32
|
user_id: z.nullable(z.string()).optional(),
|
|
28
33
|
request$: z.custom(x => x instanceof Request),
|
|
29
34
|
response$: z.custom(x => x instanceof Response),
|
|
@@ -31,6 +36,7 @@ export const TooManyRequestsResponseError$inboundSchema = z.object({
|
|
|
31
36
|
})
|
|
32
37
|
.transform((v) => {
|
|
33
38
|
const remapped = remap$(v, {
|
|
39
|
+
"openrouter_metadata": "openrouterMetadata",
|
|
34
40
|
"user_id": "userId",
|
|
35
41
|
});
|
|
36
42
|
return new TooManyRequestsResponseError(remapped, {
|
|
@@ -9,6 +9,9 @@ export type UnauthorizedResponseErrorData = {
|
|
|
9
9
|
* Error data for UnauthorizedResponse
|
|
10
10
|
*/
|
|
11
11
|
error: models.UnauthorizedResponseErrorData;
|
|
12
|
+
openrouterMetadata?: {
|
|
13
|
+
[k: string]: any | null;
|
|
14
|
+
} | null | undefined;
|
|
12
15
|
userId?: string | null | undefined;
|
|
13
16
|
};
|
|
14
17
|
/**
|
|
@@ -19,6 +22,9 @@ export declare class UnauthorizedResponseError extends OpenRouterError {
|
|
|
19
22
|
* Error data for UnauthorizedResponse
|
|
20
23
|
*/
|
|
21
24
|
error: models.UnauthorizedResponseErrorData;
|
|
25
|
+
openrouterMetadata?: {
|
|
26
|
+
[k: string]: any | null;
|
|
27
|
+
} | null | undefined;
|
|
22
28
|
userId?: string | null | undefined;
|
|
23
29
|
/** The original data that was passed to this error instance. */
|
|
24
30
|
data$: UnauthorizedResponseErrorData;
|
|
@@ -16,6 +16,9 @@ export class UnauthorizedResponseError extends OpenRouterError {
|
|
|
16
16
|
super(message, httpMeta);
|
|
17
17
|
this.data$ = err;
|
|
18
18
|
this.error = err.error;
|
|
19
|
+
if (err.openrouterMetadata != null) {
|
|
20
|
+
this.openrouterMetadata = err.openrouterMetadata;
|
|
21
|
+
}
|
|
19
22
|
if (err.userId != null)
|
|
20
23
|
this.userId = err.userId;
|
|
21
24
|
this.name = "UnauthorizedResponseError";
|
|
@@ -24,6 +27,8 @@ export class UnauthorizedResponseError extends OpenRouterError {
|
|
|
24
27
|
/** @internal */
|
|
25
28
|
export const UnauthorizedResponseError$inboundSchema = z.object({
|
|
26
29
|
error: models.UnauthorizedResponseErrorData$inboundSchema,
|
|
30
|
+
openrouter_metadata: z.nullable(z.record(z.string(), z.nullable(z.any())))
|
|
31
|
+
.optional(),
|
|
27
32
|
user_id: z.nullable(z.string()).optional(),
|
|
28
33
|
request$: z.custom(x => x instanceof Request),
|
|
29
34
|
response$: z.custom(x => x instanceof Response),
|
|
@@ -31,6 +36,7 @@ export const UnauthorizedResponseError$inboundSchema = z.object({
|
|
|
31
36
|
})
|
|
32
37
|
.transform((v) => {
|
|
33
38
|
const remapped = remap$(v, {
|
|
39
|
+
"openrouter_metadata": "openrouterMetadata",
|
|
34
40
|
"user_id": "userId",
|
|
35
41
|
});
|
|
36
42
|
return new UnauthorizedResponseError(remapped, {
|
|
@@ -9,6 +9,9 @@ export type UnprocessableEntityResponseErrorData = {
|
|
|
9
9
|
* Error data for UnprocessableEntityResponse
|
|
10
10
|
*/
|
|
11
11
|
error: models.UnprocessableEntityResponseErrorData;
|
|
12
|
+
openrouterMetadata?: {
|
|
13
|
+
[k: string]: any | null;
|
|
14
|
+
} | null | undefined;
|
|
12
15
|
userId?: string | null | undefined;
|
|
13
16
|
};
|
|
14
17
|
/**
|
|
@@ -19,6 +22,9 @@ export declare class UnprocessableEntityResponseError extends OpenRouterError {
|
|
|
19
22
|
* Error data for UnprocessableEntityResponse
|
|
20
23
|
*/
|
|
21
24
|
error: models.UnprocessableEntityResponseErrorData;
|
|
25
|
+
openrouterMetadata?: {
|
|
26
|
+
[k: string]: any | null;
|
|
27
|
+
} | null | undefined;
|
|
22
28
|
userId?: string | null | undefined;
|
|
23
29
|
/** The original data that was passed to this error instance. */
|
|
24
30
|
data$: UnprocessableEntityResponseErrorData;
|
|
@@ -16,6 +16,9 @@ export class UnprocessableEntityResponseError extends OpenRouterError {
|
|
|
16
16
|
super(message, httpMeta);
|
|
17
17
|
this.data$ = err;
|
|
18
18
|
this.error = err.error;
|
|
19
|
+
if (err.openrouterMetadata != null) {
|
|
20
|
+
this.openrouterMetadata = err.openrouterMetadata;
|
|
21
|
+
}
|
|
19
22
|
if (err.userId != null)
|
|
20
23
|
this.userId = err.userId;
|
|
21
24
|
this.name = "UnprocessableEntityResponseError";
|
|
@@ -24,6 +27,8 @@ export class UnprocessableEntityResponseError extends OpenRouterError {
|
|
|
24
27
|
/** @internal */
|
|
25
28
|
export const UnprocessableEntityResponseError$inboundSchema = z.object({
|
|
26
29
|
error: models.UnprocessableEntityResponseErrorData$inboundSchema,
|
|
30
|
+
openrouter_metadata: z.nullable(z.record(z.string(), z.nullable(z.any())))
|
|
31
|
+
.optional(),
|
|
27
32
|
user_id: z.nullable(z.string()).optional(),
|
|
28
33
|
request$: z.custom(x => x instanceof Request),
|
|
29
34
|
response$: z.custom(x => x instanceof Response),
|
|
@@ -31,6 +36,7 @@ export const UnprocessableEntityResponseError$inboundSchema = z.object({
|
|
|
31
36
|
})
|
|
32
37
|
.transform((v) => {
|
|
33
38
|
const remapped = remap$(v, {
|
|
39
|
+
"openrouter_metadata": "openrouterMetadata",
|
|
34
40
|
"user_id": "userId",
|
|
35
41
|
});
|
|
36
42
|
return new UnprocessableEntityResponseError(remapped, {
|
package/esm/models/index.d.ts
CHANGED
|
@@ -86,6 +86,8 @@ export * from "./deleteguardrailresponse.js";
|
|
|
86
86
|
export * from "./deleteworkspaceresponse.js";
|
|
87
87
|
export * from "./easyinputmessage.js";
|
|
88
88
|
export * from "./edgenetworktimeoutresponseerrordata.js";
|
|
89
|
+
export * from "./endpointinfo.js";
|
|
90
|
+
export * from "./endpointsmetadata.js";
|
|
89
91
|
export * from "./endpointstatus.js";
|
|
90
92
|
export * from "./errorevent.js";
|
|
91
93
|
export * from "./filecitation.js";
|
|
@@ -140,6 +142,7 @@ export * from "./listmemberassignmentsresponse.js";
|
|
|
140
142
|
export * from "./listworkspacesresponse.js";
|
|
141
143
|
export * from "./mcpservertool.js";
|
|
142
144
|
export * from "./memberassignment.js";
|
|
145
|
+
export * from "./metadatalevel.js";
|
|
143
146
|
export * from "./model.js";
|
|
144
147
|
export * from "./modelarchitecture.js";
|
|
145
148
|
export * from "./modelgroup.js";
|
|
@@ -159,6 +162,7 @@ export * from "./openairesponsestruncation.js";
|
|
|
159
162
|
export * from "./openresponsescreatedevent.js";
|
|
160
163
|
export * from "./openresponsesinprogressevent.js";
|
|
161
164
|
export * from "./openresponsesresult.js";
|
|
165
|
+
export * from "./openroutermetadata.js";
|
|
162
166
|
export * from "./openrouterwebsearchservertool.js";
|
|
163
167
|
export * from "./outputapplypatchservertoolitem.js";
|
|
164
168
|
export * from "./outputbashservertoolitem.js";
|
|
@@ -197,6 +201,8 @@ export * from "./percentilelatencycutoffs.js";
|
|
|
197
201
|
export * from "./percentilestats.js";
|
|
198
202
|
export * from "./percentilethroughputcutoffs.js";
|
|
199
203
|
export * from "./perrequestlimits.js";
|
|
204
|
+
export * from "./pipelinestage.js";
|
|
205
|
+
export * from "./pipelinestagetype.js";
|
|
200
206
|
export * from "./preferredmaxlatency.js";
|
|
201
207
|
export * from "./preferredminthroughput.js";
|
|
202
208
|
export * from "./preview20250311websearchservertool.js";
|
|
@@ -237,6 +243,10 @@ export * from "./responseincludesenum.js";
|
|
|
237
243
|
export * from "./responseoutputtext.js";
|
|
238
244
|
export * from "./responseserrorfield.js";
|
|
239
245
|
export * from "./responsesrequest.js";
|
|
246
|
+
export * from "./responsesstreamingresponse.js";
|
|
247
|
+
export * from "./routerattempt.js";
|
|
248
|
+
export * from "./routerparams.js";
|
|
249
|
+
export * from "./routingstrategy.js";
|
|
240
250
|
export * from "./searchcontextsizeenum.js";
|
|
241
251
|
export * from "./searchmodelsservertoolconfig.js";
|
|
242
252
|
export * from "./searchqualitylevel.js";
|
package/esm/models/index.js
CHANGED
|
@@ -90,6 +90,8 @@ export * from "./deleteguardrailresponse.js";
|
|
|
90
90
|
export * from "./deleteworkspaceresponse.js";
|
|
91
91
|
export * from "./easyinputmessage.js";
|
|
92
92
|
export * from "./edgenetworktimeoutresponseerrordata.js";
|
|
93
|
+
export * from "./endpointinfo.js";
|
|
94
|
+
export * from "./endpointsmetadata.js";
|
|
93
95
|
export * from "./endpointstatus.js";
|
|
94
96
|
export * from "./errorevent.js";
|
|
95
97
|
export * from "./filecitation.js";
|
|
@@ -144,6 +146,7 @@ export * from "./listmemberassignmentsresponse.js";
|
|
|
144
146
|
export * from "./listworkspacesresponse.js";
|
|
145
147
|
export * from "./mcpservertool.js";
|
|
146
148
|
export * from "./memberassignment.js";
|
|
149
|
+
export * from "./metadatalevel.js";
|
|
147
150
|
export * from "./model.js";
|
|
148
151
|
export * from "./modelarchitecture.js";
|
|
149
152
|
export * from "./modelgroup.js";
|
|
@@ -163,6 +166,7 @@ export * from "./openairesponsestruncation.js";
|
|
|
163
166
|
export * from "./openresponsescreatedevent.js";
|
|
164
167
|
export * from "./openresponsesinprogressevent.js";
|
|
165
168
|
export * from "./openresponsesresult.js";
|
|
169
|
+
export * from "./openroutermetadata.js";
|
|
166
170
|
export * from "./openrouterwebsearchservertool.js";
|
|
167
171
|
export * from "./outputapplypatchservertoolitem.js";
|
|
168
172
|
export * from "./outputbashservertoolitem.js";
|
|
@@ -201,6 +205,8 @@ export * from "./percentilelatencycutoffs.js";
|
|
|
201
205
|
export * from "./percentilestats.js";
|
|
202
206
|
export * from "./percentilethroughputcutoffs.js";
|
|
203
207
|
export * from "./perrequestlimits.js";
|
|
208
|
+
export * from "./pipelinestage.js";
|
|
209
|
+
export * from "./pipelinestagetype.js";
|
|
204
210
|
export * from "./preferredmaxlatency.js";
|
|
205
211
|
export * from "./preferredminthroughput.js";
|
|
206
212
|
export * from "./preview20250311websearchservertool.js";
|
|
@@ -241,6 +247,10 @@ export * from "./responseincludesenum.js";
|
|
|
241
247
|
export * from "./responseoutputtext.js";
|
|
242
248
|
export * from "./responseserrorfield.js";
|
|
243
249
|
export * from "./responsesrequest.js";
|
|
250
|
+
export * from "./responsesstreamingresponse.js";
|
|
251
|
+
export * from "./routerattempt.js";
|
|
252
|
+
export * from "./routerparams.js";
|
|
253
|
+
export * from "./routingstrategy.js";
|
|
244
254
|
export * from "./searchcontextsizeenum.js";
|
|
245
255
|
export * from "./searchmodelsservertoolconfig.js";
|
|
246
256
|
export * from "./searchqualitylevel.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
/**
|
|
4
|
+
* Opt-in level for surfacing routing metadata on the response under `openrouter_metadata`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const MetadataLevel: {
|
|
7
|
+
readonly Disabled: "disabled";
|
|
8
|
+
readonly Enabled: "enabled";
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Opt-in level for surfacing routing metadata on the response under `openrouter_metadata`.
|
|
12
|
+
*/
|
|
13
|
+
export type MetadataLevel = OpenEnum<typeof MetadataLevel>;
|
|
14
|
+
/** @internal */
|
|
15
|
+
export declare const MetadataLevel$outboundSchema: z.ZodType<string, MetadataLevel>;
|
|
16
|
+
//# sourceMappingURL=metadatalevel.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: d3f8399ef138
|
|
4
|
+
*/
|
|
5
|
+
import * as openEnums from "../types/enums.js";
|
|
6
|
+
/**
|
|
7
|
+
* Opt-in level for surfacing routing metadata on the response under `openrouter_metadata`.
|
|
8
|
+
*/
|
|
9
|
+
export const MetadataLevel = {
|
|
10
|
+
Disabled: "disabled",
|
|
11
|
+
Enabled: "enabled",
|
|
12
|
+
};
|
|
13
|
+
/** @internal */
|
|
14
|
+
export const MetadataLevel$outboundSchema = openEnums.outboundSchema(MetadataLevel);
|
|
15
|
+
//# sourceMappingURL=metadatalevel.js.map
|
|
@@ -17,6 +17,7 @@ import { LegacyWebSearchServerTool } from "./legacywebsearchservertool.js";
|
|
|
17
17
|
import { McpServerTool } from "./mcpservertool.js";
|
|
18
18
|
import { OpenAIResponsesResponseStatus } from "./openairesponsesresponsestatus.js";
|
|
19
19
|
import { OpenAIResponsesToolChoiceUnion } from "./openairesponsestoolchoiceunion.js";
|
|
20
|
+
import { OpenRouterMetadata } from "./openroutermetadata.js";
|
|
20
21
|
import { OutputItems } from "./outputitems.js";
|
|
21
22
|
import { Preview20250311WebSearchServerTool } from "./preview20250311websearchservertool.js";
|
|
22
23
|
import { PreviewWebSearchServerTool } from "./previewwebsearchservertool.js";
|
|
@@ -96,6 +97,7 @@ export type OpenResponsesResult = {
|
|
|
96
97
|
*/
|
|
97
98
|
usage?: Usage | null | undefined;
|
|
98
99
|
user?: string | null | undefined;
|
|
100
|
+
openrouterMetadata?: OpenRouterMetadata | undefined;
|
|
99
101
|
};
|
|
100
102
|
/** @internal */
|
|
101
103
|
export declare const OpenResponsesResultObject$inboundSchema: z.ZodEnum<typeof OpenResponsesResultObject>;
|
|
@@ -20,6 +20,7 @@ import { LegacyWebSearchServerTool$inboundSchema, } from "./legacywebsearchserve
|
|
|
20
20
|
import { McpServerTool$inboundSchema } from "./mcpservertool.js";
|
|
21
21
|
import { OpenAIResponsesResponseStatus$inboundSchema, } from "./openairesponsesresponsestatus.js";
|
|
22
22
|
import { OpenAIResponsesToolChoiceUnion$inboundSchema, } from "./openairesponsestoolchoiceunion.js";
|
|
23
|
+
import { OpenRouterMetadata$inboundSchema, } from "./openroutermetadata.js";
|
|
23
24
|
import { OutputItems$inboundSchema } from "./outputitems.js";
|
|
24
25
|
import { Preview20250311WebSearchServerTool$inboundSchema, } from "./preview20250311websearchservertool.js";
|
|
25
26
|
import { PreviewWebSearchServerTool$inboundSchema, } from "./previewwebsearchservertool.js";
|
|
@@ -117,6 +118,7 @@ export const OpenResponsesResult$inboundSchema = z.object({
|
|
|
117
118
|
truncation: z.nullable(Truncation$inboundSchema).optional(),
|
|
118
119
|
usage: z.nullable(Usage$inboundSchema).optional(),
|
|
119
120
|
user: z.nullable(z.string()).optional(),
|
|
121
|
+
openrouter_metadata: OpenRouterMetadata$inboundSchema.optional(),
|
|
120
122
|
}).transform((v) => {
|
|
121
123
|
return remap$(v, {
|
|
122
124
|
"completed_at": "completedAt",
|
|
@@ -135,6 +137,7 @@ export const OpenResponsesResult$inboundSchema = z.object({
|
|
|
135
137
|
"tool_choice": "toolChoice",
|
|
136
138
|
"top_logprobs": "topLogprobs",
|
|
137
139
|
"top_p": "topP",
|
|
140
|
+
"openrouter_metadata": "openrouterMetadata",
|
|
138
141
|
});
|
|
139
142
|
});
|
|
140
143
|
export function openResponsesResultFromJSON(jsonString) {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { EndpointsMetadata } from "./endpointsmetadata.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
import { PipelineStage } from "./pipelinestage.js";
|
|
6
|
+
import { RouterAttempt } from "./routerattempt.js";
|
|
7
|
+
import { RouterParams } from "./routerparams.js";
|
|
8
|
+
import { RoutingStrategy } from "./routingstrategy.js";
|
|
9
|
+
export type OpenRouterMetadata = {
|
|
10
|
+
attempt: number;
|
|
11
|
+
attempts?: Array<RouterAttempt> | undefined;
|
|
12
|
+
endpoints: EndpointsMetadata;
|
|
13
|
+
isByok: boolean;
|
|
14
|
+
params?: RouterParams | undefined;
|
|
15
|
+
pipeline?: Array<PipelineStage> | undefined;
|
|
16
|
+
region: string | null;
|
|
17
|
+
requested: string;
|
|
18
|
+
strategy: RoutingStrategy;
|
|
19
|
+
summary: string;
|
|
20
|
+
};
|
|
21
|
+
/** @internal */
|
|
22
|
+
export declare const OpenRouterMetadata$inboundSchema: z.ZodType<OpenRouterMetadata, unknown>;
|
|
23
|
+
export declare function openRouterMetadataFromJSON(jsonString: string): SafeParseResult<OpenRouterMetadata, SDKValidationError>;
|
|
24
|
+
//# sourceMappingURL=openroutermetadata.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 8a5688777dfa
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
import { EndpointsMetadata$inboundSchema, } from "./endpointsmetadata.js";
|
|
9
|
+
import { PipelineStage$inboundSchema } from "./pipelinestage.js";
|
|
10
|
+
import { RouterAttempt$inboundSchema } from "./routerattempt.js";
|
|
11
|
+
import { RouterParams$inboundSchema } from "./routerparams.js";
|
|
12
|
+
import { RoutingStrategy$inboundSchema, } from "./routingstrategy.js";
|
|
13
|
+
/** @internal */
|
|
14
|
+
export const OpenRouterMetadata$inboundSchema = z.object({
|
|
15
|
+
attempt: z.int(),
|
|
16
|
+
attempts: z.array(RouterAttempt$inboundSchema).optional(),
|
|
17
|
+
endpoints: EndpointsMetadata$inboundSchema,
|
|
18
|
+
is_byok: z.boolean(),
|
|
19
|
+
params: RouterParams$inboundSchema.optional(),
|
|
20
|
+
pipeline: z.array(PipelineStage$inboundSchema).optional(),
|
|
21
|
+
region: z.nullable(z.string()),
|
|
22
|
+
requested: z.string(),
|
|
23
|
+
strategy: RoutingStrategy$inboundSchema,
|
|
24
|
+
summary: z.string(),
|
|
25
|
+
}).transform((v) => {
|
|
26
|
+
return remap$(v, {
|
|
27
|
+
"is_byok": "isByok",
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
export function openRouterMetadataFromJSON(jsonString) {
|
|
31
|
+
return safeParse(jsonString, (x) => OpenRouterMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenRouterMetadata' from JSON`);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=openroutermetadata.js.map
|
|
@@ -44,16 +44,11 @@ export type CreateResponsesRequest = {
|
|
|
44
44
|
* @remarks
|
|
45
45
|
*/
|
|
46
46
|
appCategories?: string | undefined;
|
|
47
|
-
responsesRequest: models.ResponsesRequest;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Successful response
|
|
51
|
-
*/
|
|
52
|
-
export type CreateResponsesResponseBody = {
|
|
53
47
|
/**
|
|
54
|
-
*
|
|
48
|
+
* Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`.
|
|
55
49
|
*/
|
|
56
|
-
|
|
50
|
+
xOpenRouterExperimentalMetadata?: models.MetadataLevel | undefined;
|
|
51
|
+
responsesRequest: models.ResponsesRequest;
|
|
57
52
|
};
|
|
58
53
|
export type CreateResponsesResponse = models.OpenResponsesResult | EventStream<models.StreamEvents>;
|
|
59
54
|
/** @internal */
|
|
@@ -61,15 +56,13 @@ export type CreateResponsesRequest$Outbound = {
|
|
|
61
56
|
"HTTP-Referer"?: string | undefined;
|
|
62
57
|
appTitle?: string | undefined;
|
|
63
58
|
appCategories?: string | undefined;
|
|
59
|
+
"X-OpenRouter-Experimental-Metadata"?: string | undefined;
|
|
64
60
|
ResponsesRequest: models.ResponsesRequest$Outbound;
|
|
65
61
|
};
|
|
66
62
|
/** @internal */
|
|
67
63
|
export declare const CreateResponsesRequest$outboundSchema: z.ZodType<CreateResponsesRequest$Outbound, CreateResponsesRequest>;
|
|
68
64
|
export declare function createResponsesRequestToJSON(createResponsesRequest: CreateResponsesRequest): string;
|
|
69
65
|
/** @internal */
|
|
70
|
-
export declare const CreateResponsesResponseBody$inboundSchema: z.ZodType<CreateResponsesResponseBody, unknown>;
|
|
71
|
-
export declare function createResponsesResponseBodyFromJSON(jsonString: string): SafeParseResult<CreateResponsesResponseBody, SDKValidationError>;
|
|
72
|
-
/** @internal */
|
|
73
66
|
export declare const CreateResponsesResponse$inboundSchema: z.ZodType<CreateResponsesResponse, unknown>;
|
|
74
67
|
export declare function createResponsesResponseFromJSON(jsonString: string): SafeParseResult<CreateResponsesResponse, SDKValidationError>;
|
|
75
68
|
//# sourceMappingURL=createresponses.d.ts.map
|
|
@@ -12,10 +12,13 @@ export const CreateResponsesRequest$outboundSchema = z.object({
|
|
|
12
12
|
httpReferer: z.string().optional(),
|
|
13
13
|
appTitle: z.string().optional(),
|
|
14
14
|
appCategories: z.string().optional(),
|
|
15
|
+
xOpenRouterExperimentalMetadata: models.MetadataLevel$outboundSchema
|
|
16
|
+
.optional(),
|
|
15
17
|
responsesRequest: models.ResponsesRequest$outboundSchema,
|
|
16
18
|
}).transform((v) => {
|
|
17
19
|
return remap$(v, {
|
|
18
20
|
httpReferer: "HTTP-Referer",
|
|
21
|
+
xOpenRouterExperimentalMetadata: "X-OpenRouter-Experimental-Metadata",
|
|
19
22
|
responsesRequest: "ResponsesRequest",
|
|
20
23
|
});
|
|
21
24
|
});
|
|
@@ -23,25 +26,6 @@ export function createResponsesRequestToJSON(createResponsesRequest) {
|
|
|
23
26
|
return JSON.stringify(CreateResponsesRequest$outboundSchema.parse(createResponsesRequest));
|
|
24
27
|
}
|
|
25
28
|
/** @internal */
|
|
26
|
-
export const CreateResponsesResponseBody$inboundSchema = z.object({
|
|
27
|
-
data: z.string().transform((v, ctx) => {
|
|
28
|
-
try {
|
|
29
|
-
return JSON.parse(v);
|
|
30
|
-
}
|
|
31
|
-
catch (err) {
|
|
32
|
-
ctx.addIssue({
|
|
33
|
-
input: v,
|
|
34
|
-
code: "custom",
|
|
35
|
-
message: `malformed json: ${err}`,
|
|
36
|
-
});
|
|
37
|
-
return z.NEVER;
|
|
38
|
-
}
|
|
39
|
-
}).pipe(models.StreamEvents$inboundSchema),
|
|
40
|
-
});
|
|
41
|
-
export function createResponsesResponseBodyFromJSON(jsonString) {
|
|
42
|
-
return safeParse(jsonString, (x) => CreateResponsesResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponsesResponseBody' from JSON`);
|
|
43
|
-
}
|
|
44
|
-
/** @internal */
|
|
45
29
|
export const CreateResponsesResponse$inboundSchema = z.union([
|
|
46
30
|
models.OpenResponsesResult$inboundSchema,
|
|
47
31
|
z.custom(x => x instanceof ReadableStream)
|
|
@@ -51,7 +35,8 @@ export const CreateResponsesResponse$inboundSchema = z.union([
|
|
|
51
35
|
return { done: true, value: undefined };
|
|
52
36
|
return {
|
|
53
37
|
done: false,
|
|
54
|
-
value:
|
|
38
|
+
value: models.ResponsesStreamingResponse$inboundSchema.parse(rawEvent)
|
|
39
|
+
?.data,
|
|
55
40
|
};
|
|
56
41
|
});
|
|
57
42
|
}),
|
|
@@ -44,6 +44,10 @@ export type SendChatCompletionRequestRequest = {
|
|
|
44
44
|
* @remarks
|
|
45
45
|
*/
|
|
46
46
|
appCategories?: string | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`.
|
|
49
|
+
*/
|
|
50
|
+
xOpenRouterExperimentalMetadata?: models.MetadataLevel | undefined;
|
|
47
51
|
chatRequest: models.ChatRequest;
|
|
48
52
|
};
|
|
49
53
|
export type SendChatCompletionRequestResponse = models.ChatResult | EventStream<models.ChatStreamChunk>;
|
|
@@ -52,6 +56,7 @@ export type SendChatCompletionRequestRequest$Outbound = {
|
|
|
52
56
|
"HTTP-Referer"?: string | undefined;
|
|
53
57
|
appTitle?: string | undefined;
|
|
54
58
|
appCategories?: string | undefined;
|
|
59
|
+
"X-OpenRouter-Experimental-Metadata"?: string | undefined;
|
|
55
60
|
ChatRequest: models.ChatRequest$Outbound;
|
|
56
61
|
};
|
|
57
62
|
/** @internal */
|
|
@@ -12,10 +12,13 @@ export const SendChatCompletionRequestRequest$outboundSchema = z.object({
|
|
|
12
12
|
httpReferer: z.string().optional(),
|
|
13
13
|
appTitle: z.string().optional(),
|
|
14
14
|
appCategories: z.string().optional(),
|
|
15
|
+
xOpenRouterExperimentalMetadata: models.MetadataLevel$outboundSchema
|
|
16
|
+
.optional(),
|
|
15
17
|
chatRequest: models.ChatRequest$outboundSchema,
|
|
16
18
|
}).transform((v) => {
|
|
17
19
|
return remap$(v, {
|
|
18
20
|
httpReferer: "HTTP-Referer",
|
|
21
|
+
xOpenRouterExperimentalMetadata: "X-OpenRouter-Experimental-Metadata",
|
|
19
22
|
chatRequest: "ChatRequest",
|
|
20
23
|
});
|
|
21
24
|
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
+
import { PipelineStageType } from "./pipelinestagetype.js";
|
|
5
|
+
export type PipelineStage = {
|
|
6
|
+
costUsd?: number | null | undefined;
|
|
7
|
+
data?: {
|
|
8
|
+
[k: string]: any | null;
|
|
9
|
+
} | undefined;
|
|
10
|
+
guardrailId?: string | undefined;
|
|
11
|
+
guardrailScope?: string | undefined;
|
|
12
|
+
name: string;
|
|
13
|
+
/**
|
|
14
|
+
* Categorical kind of a pipeline stage. Multiple plugins can share a type (e.g. all guardrail-level plugins emit `guardrail`); the `name` field disambiguates which plugin emitted it.
|
|
15
|
+
*/
|
|
16
|
+
type: PipelineStageType;
|
|
17
|
+
};
|
|
18
|
+
/** @internal */
|
|
19
|
+
export declare const PipelineStage$inboundSchema: z.ZodType<PipelineStage, unknown>;
|
|
20
|
+
export declare function pipelineStageFromJSON(jsonString: string): SafeParseResult<PipelineStage, SDKValidationError>;
|
|
21
|
+
//# sourceMappingURL=pipelinestage.d.ts.map
|