@openrouter/sdk 1.5.136 → 1.5.138
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/batchGetResults.d.ts +21 -0
- package/esm/funcs/batchGetResults.js +136 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/batchobject.d.ts +6 -658
- package/esm/models/batchobject.js +6 -755
- package/esm/models/batchresult.d.ts +662 -0
- package/esm/models/batchresult.js +755 -0
- package/esm/models/batchresultspageresponse.d.ts +24 -0
- package/esm/models/batchresultspageresponse.js +28 -0
- package/esm/models/createguardrailrequest.d.ts +5 -0
- package/esm/models/createguardrailrequest.js +2 -0
- package/esm/models/guardrail.d.ts +4 -0
- package/esm/models/guardrail.js +2 -0
- package/esm/models/guardrailmodelavailabilitypolicyauthoringconfig.d.ts +2 -0
- package/esm/models/guardrailmodelavailabilitypolicyauthoringconfig.js +2 -0
- package/esm/models/guardrailmodelavailabilitypolicyconfig.d.ts +1 -0
- package/esm/models/guardrailmodelavailabilitypolicyconfig.js +2 -0
- package/esm/models/index.d.ts +2 -0
- package/esm/models/index.js +2 -0
- package/esm/models/operations/getbatchresults.d.ts +77 -0
- package/esm/models/operations/getbatchresults.js +35 -0
- package/esm/models/operations/index.d.ts +1 -0
- package/esm/models/operations/index.js +1 -0
- package/esm/models/updateguardrailrequest.d.ts +5 -0
- package/esm/models/updateguardrailrequest.js +2 -0
- package/esm/sdk/batch.d.ts +9 -0
- package/esm/sdk/batch.js +10 -0
- package/jsr.json +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { BatchResult } from "./batchresult.js";
|
|
5
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
6
|
+
export declare const BatchResultsPageResponseObject: {
|
|
7
|
+
readonly List: "list";
|
|
8
|
+
};
|
|
9
|
+
export type BatchResultsPageResponseObject = ClosedEnum<typeof BatchResultsPageResponseObject>;
|
|
10
|
+
/**
|
|
11
|
+
* A cursor-paginated page of normalized batch result rows.
|
|
12
|
+
*/
|
|
13
|
+
export type BatchResultsPageResponse = {
|
|
14
|
+
data: Array<BatchResult>;
|
|
15
|
+
hasMore: boolean;
|
|
16
|
+
nextCursor: string | null;
|
|
17
|
+
object: BatchResultsPageResponseObject;
|
|
18
|
+
};
|
|
19
|
+
/** @internal */
|
|
20
|
+
export declare const BatchResultsPageResponseObject$inboundSchema: z.ZodEnum<typeof BatchResultsPageResponseObject>;
|
|
21
|
+
/** @internal */
|
|
22
|
+
export declare const BatchResultsPageResponse$inboundSchema: z.ZodType<BatchResultsPageResponse, unknown>;
|
|
23
|
+
export declare function batchResultsPageResponseFromJSON(jsonString: string): SafeParseResult<BatchResultsPageResponse, SDKValidationError>;
|
|
24
|
+
//# sourceMappingURL=batchresultspageresponse.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4";
|
|
5
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { BatchResult$inboundSchema } from "./batchresult.js";
|
|
8
|
+
export const BatchResultsPageResponseObject = {
|
|
9
|
+
List: "list",
|
|
10
|
+
};
|
|
11
|
+
/** @internal */
|
|
12
|
+
export const BatchResultsPageResponseObject$inboundSchema = z.enum(BatchResultsPageResponseObject);
|
|
13
|
+
/** @internal */
|
|
14
|
+
export const BatchResultsPageResponse$inboundSchema = z.object({
|
|
15
|
+
data: z.array(BatchResult$inboundSchema),
|
|
16
|
+
has_more: z.boolean(),
|
|
17
|
+
next_cursor: z.nullable(z.string()),
|
|
18
|
+
object: BatchResultsPageResponseObject$inboundSchema,
|
|
19
|
+
}).transform((v) => {
|
|
20
|
+
return remap$(v, {
|
|
21
|
+
"has_more": "hasMore",
|
|
22
|
+
"next_cursor": "nextCursor",
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
export function batchResultsPageResponseFromJSON(jsonString) {
|
|
26
|
+
return safeParse(jsonString, (x) => BatchResultsPageResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultsPageResponse' from JSON`);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=batchresultspageresponse.js.map
|
|
@@ -12,6 +12,10 @@ export type CreateGuardrailRequest = {
|
|
|
12
12
|
* Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided.
|
|
13
13
|
*/
|
|
14
14
|
allowSafetyRetentionGoogle?: boolean | null | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Whether ZDR-only requests to openai/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. Applies only while OpenAI ZDR is on for the account or this guardrail; otherwise allow_safety_retention_other applies. Follows allow_safety_retention_other when null; on update, null clears a saved choice and omitting the field leaves it unchanged. While the account enforces ZDR for OpenAI or for other models, a guardrail can only be more restrictive than that account setting.
|
|
17
|
+
*/
|
|
18
|
+
allowSafetyRetentionOpenai?: boolean | null | undefined;
|
|
15
19
|
/**
|
|
16
20
|
* Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided.
|
|
17
21
|
*/
|
|
@@ -115,6 +119,7 @@ export type CreateGuardrailRequest = {
|
|
|
115
119
|
export type CreateGuardrailRequest$Outbound = {
|
|
116
120
|
allow_provisional_providers?: boolean | null | undefined;
|
|
117
121
|
allow_safety_retention_google?: boolean | null | undefined;
|
|
122
|
+
allow_safety_retention_openai?: boolean | null | undefined;
|
|
118
123
|
allow_safety_retention_other?: boolean | null | undefined;
|
|
119
124
|
allowed_data_regions?: Array<string> | null | undefined;
|
|
120
125
|
allowed_models?: Array<string> | null | undefined;
|
|
@@ -11,6 +11,7 @@ import { GuardrailInterval$outboundSchema, } from "./guardrailinterval.js";
|
|
|
11
11
|
export const CreateGuardrailRequest$outboundSchema = z.object({
|
|
12
12
|
allowProvisionalProviders: z.nullable(z.boolean()).optional(),
|
|
13
13
|
allowSafetyRetentionGoogle: z.nullable(z.boolean()).optional(),
|
|
14
|
+
allowSafetyRetentionOpenai: z.nullable(z.boolean()).optional(),
|
|
14
15
|
allowSafetyRetentionOther: z.nullable(z.boolean()).optional(),
|
|
15
16
|
allowedDataRegions: z.nullable(z.array(GuardrailDataRegion$outboundSchema))
|
|
16
17
|
.optional(),
|
|
@@ -41,6 +42,7 @@ export const CreateGuardrailRequest$outboundSchema = z.object({
|
|
|
41
42
|
return remap$(v, {
|
|
42
43
|
allowProvisionalProviders: "allow_provisional_providers",
|
|
43
44
|
allowSafetyRetentionGoogle: "allow_safety_retention_google",
|
|
45
|
+
allowSafetyRetentionOpenai: "allow_safety_retention_openai",
|
|
44
46
|
allowSafetyRetentionOther: "allow_safety_retention_other",
|
|
45
47
|
allowedDataRegions: "allowed_data_regions",
|
|
46
48
|
allowedModels: "allowed_models",
|
|
@@ -14,6 +14,10 @@ export type Guardrail = {
|
|
|
14
14
|
* Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided.
|
|
15
15
|
*/
|
|
16
16
|
allowSafetyRetentionGoogle?: boolean | null | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Whether ZDR-only requests to openai/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. Applies only while OpenAI ZDR is on for the account or this guardrail; otherwise allow_safety_retention_other applies. Follows allow_safety_retention_other when null; on update, null clears a saved choice and omitting the field leaves it unchanged. While the account enforces ZDR for OpenAI or for other models, a guardrail can only be more restrictive than that account setting.
|
|
19
|
+
*/
|
|
20
|
+
allowSafetyRetentionOpenai?: boolean | null | undefined;
|
|
17
21
|
/**
|
|
18
22
|
* Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided.
|
|
19
23
|
*/
|
package/esm/models/guardrail.js
CHANGED
|
@@ -12,6 +12,7 @@ import { GuardrailInterval$inboundSchema, } from "./guardrailinterval.js";
|
|
|
12
12
|
export const Guardrail$inboundSchema = z.object({
|
|
13
13
|
allow_provisional_providers: z.nullable(z.boolean()).optional(),
|
|
14
14
|
allow_safety_retention_google: z.nullable(z.boolean()).optional(),
|
|
15
|
+
allow_safety_retention_openai: z.nullable(z.boolean()).optional(),
|
|
15
16
|
allow_safety_retention_other: z.nullable(z.boolean()).optional(),
|
|
16
17
|
allowed_data_regions: z.nullable(z.array(GuardrailDataRegion$inboundSchema))
|
|
17
18
|
.optional(),
|
|
@@ -45,6 +46,7 @@ export const Guardrail$inboundSchema = z.object({
|
|
|
45
46
|
return remap$(v, {
|
|
46
47
|
"allow_provisional_providers": "allowProvisionalProviders",
|
|
47
48
|
"allow_safety_retention_google": "allowSafetyRetentionGoogle",
|
|
49
|
+
"allow_safety_retention_openai": "allowSafetyRetentionOpenai",
|
|
48
50
|
"allow_safety_retention_other": "allowSafetyRetentionOther",
|
|
49
51
|
"allowed_data_regions": "allowedDataRegions",
|
|
50
52
|
"allowed_models": "allowedModels",
|
|
@@ -2,6 +2,7 @@ import * as z from "zod/v4";
|
|
|
2
2
|
export type GuardrailModelAvailabilityPolicyAuthoringConfig = {
|
|
3
3
|
allowProvisionalProviders?: boolean | null | undefined;
|
|
4
4
|
allowSafetyRetentionGoogle?: boolean | null | undefined;
|
|
5
|
+
allowSafetyRetentionOpenai?: boolean | null | undefined;
|
|
5
6
|
allowSafetyRetentionOther?: boolean | null | undefined;
|
|
6
7
|
allowedDataRegions?: Array<string> | null | undefined;
|
|
7
8
|
allowedModels?: Array<string> | null | undefined;
|
|
@@ -27,6 +28,7 @@ export type GuardrailModelAvailabilityPolicyAuthoringConfig = {
|
|
|
27
28
|
export type GuardrailModelAvailabilityPolicyAuthoringConfig$Outbound = {
|
|
28
29
|
allow_provisional_providers?: boolean | null | undefined;
|
|
29
30
|
allow_safety_retention_google?: boolean | null | undefined;
|
|
31
|
+
allow_safety_retention_openai?: boolean | null | undefined;
|
|
30
32
|
allow_safety_retention_other?: boolean | null | undefined;
|
|
31
33
|
allowed_data_regions?: Array<string> | null | undefined;
|
|
32
34
|
allowed_models?: Array<string> | null | undefined;
|
|
@@ -7,6 +7,7 @@ import { remap as remap$ } from "../lib/primitives.js";
|
|
|
7
7
|
export const GuardrailModelAvailabilityPolicyAuthoringConfig$outboundSchema = z.object({
|
|
8
8
|
allowProvisionalProviders: z.nullable(z.boolean()).optional(),
|
|
9
9
|
allowSafetyRetentionGoogle: z.nullable(z.boolean()).optional(),
|
|
10
|
+
allowSafetyRetentionOpenai: z.nullable(z.boolean()).optional(),
|
|
10
11
|
allowSafetyRetentionOther: z.nullable(z.boolean()).optional(),
|
|
11
12
|
allowedDataRegions: z.nullable(z.array(z.string())).optional(),
|
|
12
13
|
allowedModels: z.nullable(z.array(z.string())).optional(),
|
|
@@ -31,6 +32,7 @@ export const GuardrailModelAvailabilityPolicyAuthoringConfig$outboundSchema = z.
|
|
|
31
32
|
return remap$(v, {
|
|
32
33
|
allowProvisionalProviders: "allow_provisional_providers",
|
|
33
34
|
allowSafetyRetentionGoogle: "allow_safety_retention_google",
|
|
35
|
+
allowSafetyRetentionOpenai: "allow_safety_retention_openai",
|
|
34
36
|
allowSafetyRetentionOther: "allow_safety_retention_other",
|
|
35
37
|
allowedDataRegions: "allowed_data_regions",
|
|
36
38
|
allowedModels: "allowed_models",
|
|
@@ -4,6 +4,7 @@ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
|
4
4
|
export type GuardrailModelAvailabilityPolicyConfig = {
|
|
5
5
|
allowProvisionalProviders?: boolean | null | undefined;
|
|
6
6
|
allowSafetyRetentionGoogle?: boolean | null | undefined;
|
|
7
|
+
allowSafetyRetentionOpenai?: boolean | null | undefined;
|
|
7
8
|
allowSafetyRetentionOther?: boolean | null | undefined;
|
|
8
9
|
allowedDataRegions?: Array<string> | null | undefined;
|
|
9
10
|
allowedModels?: Array<string> | null | undefined;
|
|
@@ -8,6 +8,7 @@ import { safeParse } from "../lib/schemas.js";
|
|
|
8
8
|
export const GuardrailModelAvailabilityPolicyConfig$inboundSchema = z.object({
|
|
9
9
|
allow_provisional_providers: z.nullable(z.boolean()).optional(),
|
|
10
10
|
allow_safety_retention_google: z.nullable(z.boolean()).optional(),
|
|
11
|
+
allow_safety_retention_openai: z.nullable(z.boolean()).optional(),
|
|
11
12
|
allow_safety_retention_other: z.nullable(z.boolean()).optional(),
|
|
12
13
|
allowed_data_regions: z.nullable(z.array(z.string())).optional(),
|
|
13
14
|
allowed_models: z.nullable(z.array(z.string())).optional(),
|
|
@@ -32,6 +33,7 @@ export const GuardrailModelAvailabilityPolicyConfig$inboundSchema = z.object({
|
|
|
32
33
|
return remap$(v, {
|
|
33
34
|
"allow_provisional_providers": "allowProvisionalProviders",
|
|
34
35
|
"allow_safety_retention_google": "allowSafetyRetentionGoogle",
|
|
36
|
+
"allow_safety_retention_openai": "allowSafetyRetentionOpenai",
|
|
35
37
|
"allow_safety_retention_other": "allowSafetyRetentionOther",
|
|
36
38
|
"allowed_data_regions": "allowedDataRegions",
|
|
37
39
|
"allowed_models": "allowedModels",
|
package/esm/models/index.d.ts
CHANGED
|
@@ -170,6 +170,8 @@ export * from "./batchobject.js";
|
|
|
170
170
|
export * from "./batchoutputreference.js";
|
|
171
171
|
export * from "./batchpaymentrequiredresponseerror.js";
|
|
172
172
|
export * from "./batchproviderpreferences.js";
|
|
173
|
+
export * from "./batchresult.js";
|
|
174
|
+
export * from "./batchresultspageresponse.js";
|
|
173
175
|
export * from "./batchsubmitbody.js";
|
|
174
176
|
export * from "./booleancapability.js";
|
|
175
177
|
export * from "./budgetaccountguardrailpolicy.js";
|
package/esm/models/index.js
CHANGED
|
@@ -173,6 +173,8 @@ export * from "./batchobject.js";
|
|
|
173
173
|
export * from "./batchoutputreference.js";
|
|
174
174
|
export * from "./batchpaymentrequiredresponseerror.js";
|
|
175
175
|
export * from "./batchproviderpreferences.js";
|
|
176
|
+
export * from "./batchresult.js";
|
|
177
|
+
export * from "./batchresultspageresponse.js";
|
|
176
178
|
export * from "./batchsubmitbody.js";
|
|
177
179
|
export * from "./booleancapability.js";
|
|
178
180
|
export * from "./budgetaccountguardrailpolicy.js";
|
|
@@ -0,0 +1,77 @@
|
|
|
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 * as models from "../index.js";
|
|
5
|
+
export type GetBatchResultsGlobals = {
|
|
6
|
+
/**
|
|
7
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* This is used to track API usage per application.
|
|
11
|
+
*/
|
|
12
|
+
httpReferer?: string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
*/
|
|
18
|
+
appTitle?: string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
*/
|
|
24
|
+
appCategories?: string | undefined;
|
|
25
|
+
};
|
|
26
|
+
export type GetBatchResultsRequest = {
|
|
27
|
+
/**
|
|
28
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* This is used to track API usage per application.
|
|
32
|
+
*/
|
|
33
|
+
httpReferer?: string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
*/
|
|
39
|
+
appTitle?: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
*/
|
|
45
|
+
appCategories?: string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* The batch job id returned from submit.
|
|
48
|
+
*/
|
|
49
|
+
id: string;
|
|
50
|
+
/**
|
|
51
|
+
* Maximum number of result items to return, from 1 through 1000.
|
|
52
|
+
*/
|
|
53
|
+
limit?: number | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Opaque pagination cursor from the previous page's `next_cursor`. Omit for the first page.
|
|
56
|
+
*/
|
|
57
|
+
cursor?: string | undefined;
|
|
58
|
+
};
|
|
59
|
+
export type GetBatchResultsResponse = {
|
|
60
|
+
result: models.BatchResultsPageResponse;
|
|
61
|
+
};
|
|
62
|
+
/** @internal */
|
|
63
|
+
export type GetBatchResultsRequest$Outbound = {
|
|
64
|
+
"HTTP-Referer"?: string | undefined;
|
|
65
|
+
appTitle?: string | undefined;
|
|
66
|
+
appCategories?: string | undefined;
|
|
67
|
+
id: string;
|
|
68
|
+
limit?: number | undefined;
|
|
69
|
+
cursor?: string | undefined;
|
|
70
|
+
};
|
|
71
|
+
/** @internal */
|
|
72
|
+
export declare const GetBatchResultsRequest$outboundSchema: z.ZodType<GetBatchResultsRequest$Outbound, GetBatchResultsRequest>;
|
|
73
|
+
export declare function getBatchResultsRequestToJSON(getBatchResultsRequest: GetBatchResultsRequest): string;
|
|
74
|
+
/** @internal */
|
|
75
|
+
export declare const GetBatchResultsResponse$inboundSchema: z.ZodType<GetBatchResultsResponse, unknown>;
|
|
76
|
+
export declare function getBatchResultsResponseFromJSON(jsonString: string): SafeParseResult<GetBatchResultsResponse, SDKValidationError>;
|
|
77
|
+
//# sourceMappingURL=getbatchresults.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4";
|
|
5
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { BatchResultsPageResponse$inboundSchema as models_BatchResultsPageResponse$inboundSchema } from "../batchresultspageresponse.js";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export const GetBatchResultsRequest$outboundSchema = z.object({
|
|
10
|
+
httpReferer: z.string().optional(),
|
|
11
|
+
appTitle: z.string().optional(),
|
|
12
|
+
appCategories: z.string().optional(),
|
|
13
|
+
id: z.string(),
|
|
14
|
+
limit: z.int().optional(),
|
|
15
|
+
cursor: z.string().optional(),
|
|
16
|
+
}).transform((v) => {
|
|
17
|
+
return remap$(v, {
|
|
18
|
+
httpReferer: "HTTP-Referer",
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
export function getBatchResultsRequestToJSON(getBatchResultsRequest) {
|
|
22
|
+
return JSON.stringify(GetBatchResultsRequest$outboundSchema.parse(getBatchResultsRequest));
|
|
23
|
+
}
|
|
24
|
+
/** @internal */
|
|
25
|
+
export const GetBatchResultsResponse$inboundSchema = z.object({
|
|
26
|
+
Result: models_BatchResultsPageResponse$inboundSchema,
|
|
27
|
+
}).transform((v) => {
|
|
28
|
+
return remap$(v, {
|
|
29
|
+
"Result": "result",
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
export function getBatchResultsResponseFromJSON(jsonString) {
|
|
33
|
+
return safeParse(jsonString, (x) => GetBatchResultsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetBatchResultsResponse' from JSON`);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=getbatchresults.js.map
|
|
@@ -67,6 +67,7 @@ export * from "./getanalyticsmeta.js";
|
|
|
67
67
|
export * from "./getapikeypolicyassignment.js";
|
|
68
68
|
export * from "./getapprankings.js";
|
|
69
69
|
export * from "./getbatches.js";
|
|
70
|
+
export * from "./getbatchresults.js";
|
|
70
71
|
export * from "./getbenchmarks.js";
|
|
71
72
|
export * from "./getbudgetpolicy.js";
|
|
72
73
|
export * from "./getbyokkey.js";
|
|
@@ -70,6 +70,7 @@ export * from "./getanalyticsmeta.js";
|
|
|
70
70
|
export * from "./getapikeypolicyassignment.js";
|
|
71
71
|
export * from "./getapprankings.js";
|
|
72
72
|
export * from "./getbatches.js";
|
|
73
|
+
export * from "./getbatchresults.js";
|
|
73
74
|
export * from "./getbenchmarks.js";
|
|
74
75
|
export * from "./getbudgetpolicy.js";
|
|
75
76
|
export * from "./getbyokkey.js";
|
|
@@ -12,6 +12,10 @@ export type UpdateGuardrailRequest = {
|
|
|
12
12
|
* Whether ZDR-only requests to google/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided.
|
|
13
13
|
*/
|
|
14
14
|
allowSafetyRetentionGoogle?: boolean | null | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Whether ZDR-only requests to openai/* models may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. Applies only while OpenAI ZDR is on for the account or this guardrail; otherwise allow_safety_retention_other applies. Follows allow_safety_retention_other when null; on update, null clears a saved choice and omitting the field leaves it unchanged. While the account enforces ZDR for OpenAI or for other models, a guardrail can only be more restrictive than that account setting.
|
|
17
|
+
*/
|
|
18
|
+
allowSafetyRetentionOpenai?: boolean | null | undefined;
|
|
15
19
|
/**
|
|
16
20
|
* Whether ZDR-only requests to models outside the named providers (for example open-weight models on Vertex) may also use Safety Retention endpoints, which may retain prompts and responses from any request, only to prevent abuse, and do not use them for training. false allows only ZDR endpoints. A guardrail can only be more restrictive than the account setting. Inherits the account setting when not provided.
|
|
17
21
|
*/
|
|
@@ -111,6 +115,7 @@ export type UpdateGuardrailRequest = {
|
|
|
111
115
|
export type UpdateGuardrailRequest$Outbound = {
|
|
112
116
|
allow_provisional_providers?: boolean | null | undefined;
|
|
113
117
|
allow_safety_retention_google?: boolean | null | undefined;
|
|
118
|
+
allow_safety_retention_openai?: boolean | null | undefined;
|
|
114
119
|
allow_safety_retention_other?: boolean | null | undefined;
|
|
115
120
|
allowed_data_regions?: Array<string> | null | undefined;
|
|
116
121
|
allowed_models?: Array<string> | null | undefined;
|
|
@@ -11,6 +11,7 @@ import { GuardrailInterval$outboundSchema, } from "./guardrailinterval.js";
|
|
|
11
11
|
export const UpdateGuardrailRequest$outboundSchema = z.object({
|
|
12
12
|
allowProvisionalProviders: z.nullable(z.boolean()).optional(),
|
|
13
13
|
allowSafetyRetentionGoogle: z.nullable(z.boolean()).optional(),
|
|
14
|
+
allowSafetyRetentionOpenai: z.nullable(z.boolean()).optional(),
|
|
14
15
|
allowSafetyRetentionOther: z.nullable(z.boolean()).optional(),
|
|
15
16
|
allowedDataRegions: z.nullable(z.array(GuardrailDataRegion$outboundSchema))
|
|
16
17
|
.optional(),
|
|
@@ -40,6 +41,7 @@ export const UpdateGuardrailRequest$outboundSchema = z.object({
|
|
|
40
41
|
return remap$(v, {
|
|
41
42
|
allowProvisionalProviders: "allow_provisional_providers",
|
|
42
43
|
allowSafetyRetentionGoogle: "allow_safety_retention_google",
|
|
44
|
+
allowSafetyRetentionOpenai: "allow_safety_retention_openai",
|
|
43
45
|
allowSafetyRetentionOther: "allow_safety_retention_other",
|
|
44
46
|
allowedDataRegions: "allowed_data_regions",
|
|
45
47
|
allowedModels: "allowed_models",
|
package/esm/sdk/batch.d.ts
CHANGED
|
@@ -33,5 +33,14 @@ export declare class Batch extends ClientSDK {
|
|
|
33
33
|
* Returns a batch with its status and request counts. Batches in a terminal status include `results`. Failed batches report the reason in `error.message`. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
|
|
34
34
|
*/
|
|
35
35
|
getBatches(request: operations.GetBatchesRequest, options?: RequestOptions): Promise<models.BatchObject>;
|
|
36
|
+
/**
|
|
37
|
+
* Get batch results
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* Returns a cursor-paginated page of normalized OpenRouter-format results for a finished batch. Pass the previous page's `next_cursor` as `cursor` to read the next page. Pages are stable across retries for the 30-day artifact retention window. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
|
|
41
|
+
*/
|
|
42
|
+
getResults(request: operations.GetBatchResultsRequest, options?: RequestOptions): Promise<PageIterator<operations.GetBatchResultsResponse, {
|
|
43
|
+
cursor: string;
|
|
44
|
+
}>>;
|
|
36
45
|
}
|
|
37
46
|
//# sourceMappingURL=batch.d.ts.map
|
package/esm/sdk/batch.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { batchCreateBatches } from "../funcs/batchCreateBatches.js";
|
|
5
5
|
import { batchDelete } from "../funcs/batchDelete.js";
|
|
6
6
|
import { batchGetBatches } from "../funcs/batchGetBatches.js";
|
|
7
|
+
import { batchGetResults } from "../funcs/batchGetResults.js";
|
|
7
8
|
import { batchList } from "../funcs/batchList.js";
|
|
8
9
|
import { ClientSDK } from "../lib/sdks.js";
|
|
9
10
|
import { unwrapAsync } from "../types/fp.js";
|
|
@@ -45,5 +46,14 @@ export class Batch extends ClientSDK {
|
|
|
45
46
|
async getBatches(request, options) {
|
|
46
47
|
return unwrapAsync(batchGetBatches(this, request, options));
|
|
47
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Get batch results
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* Returns a cursor-paginated page of normalized OpenRouter-format results for a finished batch. Pass the previous page's `next_cursor` as `cursor` to read the next page. Pages are stable across retries for the 30-day artifact retention window. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
|
|
54
|
+
*/
|
|
55
|
+
async getResults(request, options) {
|
|
56
|
+
return unwrapResultIterator(batchGetResults(this, request, options));
|
|
57
|
+
}
|
|
48
58
|
}
|
|
49
59
|
//# sourceMappingURL=batch.js.map
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.138",
|
|
4
4
|
"author": "OpenRouter",
|
|
5
5
|
"description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.",
|
|
6
6
|
"keywords": [
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
"lint": "eslint --cache --max-warnings=0 src",
|
|
74
74
|
"build": "node --max-old-space-size=8192 ./node_modules/typescript/bin/tsc && node scripts/unbarrel-imports.js",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
|
+
"typecheck:transit": "exit 0",
|
|
76
77
|
"compile": "node --max-old-space-size=8192 ./node_modules/typescript/bin/tsc && node scripts/unbarrel-imports.js",
|
|
77
|
-
"
|
|
78
|
+
"prepare": "npm run build",
|
|
78
79
|
"test:e2e": "vitest --run --project e2e",
|
|
79
|
-
"test:
|
|
80
|
-
"typecheck": "tsc --noEmit",
|
|
81
|
-
"typecheck:transit": "exit 0",
|
|
80
|
+
"test:watch": "vitest --watch --project unit",
|
|
82
81
|
"postinstall": "node scripts/check-types.js || true",
|
|
83
|
-
"
|
|
84
|
-
"test:
|
|
82
|
+
"test": "vitest --run --project unit",
|
|
83
|
+
"test:transit": "exit 0",
|
|
84
|
+
"typecheck": "tsc --noEmit"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
|