@openrouter/sdk 1.5.97 → 1.5.99
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/responsesSend.d.ts +3 -3
- package/esm/funcs/responsesSend.js +2 -2
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/contentfilterentry.d.ts +0 -5
- package/esm/models/contentfilterentry.js +1 -11
- package/esm/models/contentfilterreadentry.d.ts +29 -0
- package/esm/models/contentfilterreadentry.js +23 -0
- package/esm/models/errors/index.d.ts +1 -0
- package/esm/models/errors/index.js +1 -0
- package/esm/models/errors/responsesbadrequestresponseerror.d.ts +51 -0
- package/esm/models/errors/responsesbadrequestresponseerror.js +50 -0
- package/esm/models/guardrail.d.ts +2 -2
- package/esm/models/guardrail.js +2 -2
- package/esm/models/index.d.ts +2 -0
- package/esm/models/index.js +2 -0
- package/esm/models/responsesbadrequestresponseerrordata.d.ts +27 -0
- package/esm/models/responsesbadrequestresponseerrordata.js +24 -0
- package/jsr.json +1 -1
- package/package.json +7 -7
|
@@ -20,11 +20,11 @@ export declare function responsesSend(client: OpenRouterCore, request: operation
|
|
|
20
20
|
responsesRequest: {
|
|
21
21
|
stream?: false;
|
|
22
22
|
};
|
|
23
|
-
}, options?: RequestOptions): APIPromise<Result<models.OpenResponsesResult, errors.
|
|
23
|
+
}, options?: RequestOptions): APIPromise<Result<models.OpenResponsesResult, errors.ResponsesBadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.PayloadTooLargeResponseError | errors.UnprocessableEntityResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
24
24
|
export declare function responsesSend(client: OpenRouterCore, request: operations.CreateResponsesRequest & {
|
|
25
25
|
responsesRequest: {
|
|
26
26
|
stream: true;
|
|
27
27
|
};
|
|
28
|
-
}, options?: RequestOptions): APIPromise<Result<EventStream<models.StreamEvents>, errors.
|
|
29
|
-
export declare function responsesSend(client: OpenRouterCore, request: operations.CreateResponsesRequest, options?: RequestOptions): APIPromise<Result<operations.CreateResponsesResponse, errors.
|
|
28
|
+
}, options?: RequestOptions): APIPromise<Result<EventStream<models.StreamEvents>, errors.ResponsesBadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.PayloadTooLargeResponseError | errors.UnprocessableEntityResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
29
|
+
export declare function responsesSend(client: OpenRouterCore, request: operations.CreateResponsesRequest, options?: RequestOptions): APIPromise<Result<operations.CreateResponsesResponse, errors.ResponsesBadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.PayloadTooLargeResponseError | errors.UnprocessableEntityResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
30
30
|
//# sourceMappingURL=responsesSend.d.ts.map
|
|
@@ -9,7 +9,7 @@ import { compactMap } from "../lib/primitives.js";
|
|
|
9
9
|
import { safeParse } from "../lib/schemas.js";
|
|
10
10
|
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
11
|
import { pathToFunc } from "../lib/url.js";
|
|
12
|
-
import { BadGatewayResponseError$inboundSchema as errors_BadGatewayResponseError$inboundSchema } from "../models/errors/badgatewayresponseerror.js"; import {
|
|
12
|
+
import { BadGatewayResponseError$inboundSchema as errors_BadGatewayResponseError$inboundSchema } from "../models/errors/badgatewayresponseerror.js"; import { EdgeNetworkTimeoutResponseError$inboundSchema as errors_EdgeNetworkTimeoutResponseError$inboundSchema } from "../models/errors/edgenetworktimeoutresponseerror.js"; import { ForbiddenResponseError$inboundSchema as errors_ForbiddenResponseError$inboundSchema } from "../models/errors/forbiddenresponseerror.js"; import { InternalServerResponseError$inboundSchema as errors_InternalServerResponseError$inboundSchema } from "../models/errors/internalserverresponseerror.js"; import { NotFoundResponseError$inboundSchema as errors_NotFoundResponseError$inboundSchema } from "../models/errors/notfoundresponseerror.js"; import { PayloadTooLargeResponseError$inboundSchema as errors_PayloadTooLargeResponseError$inboundSchema } from "../models/errors/payloadtoolargeresponseerror.js"; import { PaymentRequiredResponseError$inboundSchema as errors_PaymentRequiredResponseError$inboundSchema } from "../models/errors/paymentrequiredresponseerror.js"; import { ProviderOverloadedResponseError$inboundSchema as errors_ProviderOverloadedResponseError$inboundSchema } from "../models/errors/provideroverloadedresponseerror.js"; import { RequestTimeoutResponseError$inboundSchema as errors_RequestTimeoutResponseError$inboundSchema } from "../models/errors/requesttimeoutresponseerror.js"; import { ResponsesBadRequestResponseError$inboundSchema as errors_ResponsesBadRequestResponseError$inboundSchema } from "../models/errors/responsesbadrequestresponseerror.js"; import { ServiceUnavailableResponseError$inboundSchema as errors_ServiceUnavailableResponseError$inboundSchema } from "../models/errors/serviceunavailableresponseerror.js"; import { TooManyRequestsResponseError$inboundSchema as errors_TooManyRequestsResponseError$inboundSchema } from "../models/errors/toomanyrequestsresponseerror.js"; import { UnauthorizedResponseError$inboundSchema as errors_UnauthorizedResponseError$inboundSchema } from "../models/errors/unauthorizedresponseerror.js"; import { UnprocessableEntityResponseError$inboundSchema as errors_UnprocessableEntityResponseError$inboundSchema } from "../models/errors/unprocessableentityresponseerror.js";
|
|
13
13
|
import { CreateResponsesRequest$outboundSchema as operations_CreateResponsesRequest$outboundSchema, CreateResponsesResponse$inboundSchema as operations_CreateResponsesResponse$inboundSchema } from "../models/operations/createresponses.js";
|
|
14
14
|
import { APIPromise } from "../types/async.js";
|
|
15
15
|
export function responsesSend(client, request, options) {
|
|
@@ -85,7 +85,7 @@ async function $do(client, request, options) {
|
|
|
85
85
|
const responseFields = {
|
|
86
86
|
HttpMeta: { Response: response, Request: req },
|
|
87
87
|
};
|
|
88
|
-
const [result] = await M.match(M.json(200, operations_CreateResponsesResponse$inboundSchema), M.sse(200, operations_CreateResponsesResponse$inboundSchema), M.jsonErr(400,
|
|
88
|
+
const [result] = await M.match(M.json(200, operations_CreateResponsesResponse$inboundSchema), M.sse(200, operations_CreateResponsesResponse$inboundSchema), M.jsonErr(400, errors_ResponsesBadRequestResponseError$inboundSchema), M.jsonErr(401, errors_UnauthorizedResponseError$inboundSchema), M.jsonErr(402, errors_PaymentRequiredResponseError$inboundSchema), M.jsonErr(403, errors_ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors_NotFoundResponseError$inboundSchema), M.jsonErr(408, errors_RequestTimeoutResponseError$inboundSchema), M.jsonErr(413, errors_PayloadTooLargeResponseError$inboundSchema), M.jsonErr(422, errors_UnprocessableEntityResponseError$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 });
|
|
89
89
|
if (!result.ok) {
|
|
90
90
|
return [result, { status: "complete", request: req, response }];
|
|
91
91
|
}
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -50,8 +50,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
50
50
|
export declare const SDK_METADATA: {
|
|
51
51
|
readonly language: "typescript";
|
|
52
52
|
readonly openapiDocVersion: "1.0.0";
|
|
53
|
-
readonly sdkVersion: "1.5.
|
|
53
|
+
readonly sdkVersion: "1.5.99";
|
|
54
54
|
readonly genVersion: "2.960.8";
|
|
55
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.5.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.5.99 2.960.8 1.0.0 @openrouter/sdk";
|
|
56
56
|
};
|
|
57
57
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -29,8 +29,8 @@ export function serverURLFromOptions(options) {
|
|
|
29
29
|
export const SDK_METADATA = {
|
|
30
30
|
language: "typescript",
|
|
31
31
|
openapiDocVersion: "1.0.0",
|
|
32
|
-
sdkVersion: "1.5.
|
|
32
|
+
sdkVersion: "1.5.99",
|
|
33
33
|
genVersion: "2.960.8",
|
|
34
|
-
userAgent: "speakeasy-sdk/typescript 1.5.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.5.99 2.960.8 1.0.0 @openrouter/sdk",
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=config.js.map
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
-
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
2
|
import { ContentFilterAction } from "./contentfilteraction.js";
|
|
4
|
-
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
3
|
/**
|
|
6
4
|
* A custom regex content filter that scans request messages for matching patterns.
|
|
7
5
|
*/
|
|
@@ -20,8 +18,6 @@ export type ContentFilterEntry = {
|
|
|
20
18
|
pattern: string;
|
|
21
19
|
};
|
|
22
20
|
/** @internal */
|
|
23
|
-
export declare const ContentFilterEntry$inboundSchema: z.ZodType<ContentFilterEntry, unknown>;
|
|
24
|
-
/** @internal */
|
|
25
21
|
export type ContentFilterEntry$Outbound = {
|
|
26
22
|
action: string;
|
|
27
23
|
label?: string | null | undefined;
|
|
@@ -30,5 +26,4 @@ export type ContentFilterEntry$Outbound = {
|
|
|
30
26
|
/** @internal */
|
|
31
27
|
export declare const ContentFilterEntry$outboundSchema: z.ZodType<ContentFilterEntry$Outbound, ContentFilterEntry>;
|
|
32
28
|
export declare function contentFilterEntryToJSON(contentFilterEntry: ContentFilterEntry): string;
|
|
33
|
-
export declare function contentFilterEntryFromJSON(jsonString: string): SafeParseResult<ContentFilterEntry, SDKValidationError>;
|
|
34
29
|
//# sourceMappingURL=contentfilterentry.d.ts.map
|
|
@@ -3,14 +3,7 @@
|
|
|
3
3
|
* @generated-id: 309efd3ad069
|
|
4
4
|
*/
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
|
-
import {
|
|
7
|
-
import { ContentFilterAction$inboundSchema, ContentFilterAction$outboundSchema, } from "./contentfilteraction.js";
|
|
8
|
-
/** @internal */
|
|
9
|
-
export const ContentFilterEntry$inboundSchema = z.object({
|
|
10
|
-
action: ContentFilterAction$inboundSchema,
|
|
11
|
-
label: z.nullable(z.string()).optional(),
|
|
12
|
-
pattern: z.string(),
|
|
13
|
-
});
|
|
6
|
+
import { ContentFilterAction$outboundSchema, } from "./contentfilteraction.js";
|
|
14
7
|
/** @internal */
|
|
15
8
|
export const ContentFilterEntry$outboundSchema = z.object({
|
|
16
9
|
action: ContentFilterAction$outboundSchema,
|
|
@@ -20,7 +13,4 @@ export const ContentFilterEntry$outboundSchema = z.object({
|
|
|
20
13
|
export function contentFilterEntryToJSON(contentFilterEntry) {
|
|
21
14
|
return JSON.stringify(ContentFilterEntry$outboundSchema.parse(contentFilterEntry));
|
|
22
15
|
}
|
|
23
|
-
export function contentFilterEntryFromJSON(jsonString) {
|
|
24
|
-
return safeParse(jsonString, (x) => ContentFilterEntry$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContentFilterEntry' from JSON`);
|
|
25
|
-
}
|
|
26
16
|
//# sourceMappingURL=contentfilterentry.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { ContentFilterAction } from "./contentfilteraction.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
/**
|
|
6
|
+
* A custom regex content filter, with whether inference enforces it.
|
|
7
|
+
*/
|
|
8
|
+
export type ContentFilterReadEntry = {
|
|
9
|
+
/**
|
|
10
|
+
* Action taken when the pattern matches
|
|
11
|
+
*/
|
|
12
|
+
action: ContentFilterAction;
|
|
13
|
+
/**
|
|
14
|
+
* Optional label used in redaction placeholders or error messages
|
|
15
|
+
*/
|
|
16
|
+
label?: string | null | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* A regex pattern to match against request content
|
|
19
|
+
*/
|
|
20
|
+
pattern: string;
|
|
21
|
+
/**
|
|
22
|
+
* Whether inference applies this pattern. False for a pattern saved before pattern validation that is too complex to run safely; it is kept but skipped until replaced.
|
|
23
|
+
*/
|
|
24
|
+
isEnforced: boolean;
|
|
25
|
+
};
|
|
26
|
+
/** @internal */
|
|
27
|
+
export declare const ContentFilterReadEntry$inboundSchema: z.ZodType<ContentFilterReadEntry, unknown>;
|
|
28
|
+
export declare function contentFilterReadEntryFromJSON(jsonString: string): SafeParseResult<ContentFilterReadEntry, SDKValidationError>;
|
|
29
|
+
//# sourceMappingURL=contentfilterreadentry.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: b8a70234f549
|
|
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 { ContentFilterAction$inboundSchema, } from "./contentfilteraction.js";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export const ContentFilterReadEntry$inboundSchema = z.object({
|
|
11
|
+
action: ContentFilterAction$inboundSchema,
|
|
12
|
+
label: z.nullable(z.string()).optional(),
|
|
13
|
+
pattern: z.string(),
|
|
14
|
+
is_enforced: z.boolean(),
|
|
15
|
+
}).transform((v) => {
|
|
16
|
+
return remap$(v, {
|
|
17
|
+
"is_enforced": "isEnforced",
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
export function contentFilterReadEntryFromJSON(jsonString) {
|
|
21
|
+
return safeParse(jsonString, (x) => ContentFilterReadEntry$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContentFilterReadEntry' from JSON`);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=contentfilterreadentry.js.map
|
|
@@ -20,6 +20,7 @@ export * from "./payloadtoolargeresponseerror.js";
|
|
|
20
20
|
export * from "./paymentrequiredresponseerror.js";
|
|
21
21
|
export * from "./provideroverloadedresponseerror.js";
|
|
22
22
|
export * from "./requesttimeoutresponseerror.js";
|
|
23
|
+
export * from "./responsesbadrequestresponseerror.js";
|
|
23
24
|
export * from "./responsevalidationerror.js";
|
|
24
25
|
export * from "./sdkvalidationerror.js";
|
|
25
26
|
export * from "./serviceunavailableresponseerror.js";
|
|
@@ -24,6 +24,7 @@ export * from "./payloadtoolargeresponseerror.js";
|
|
|
24
24
|
export * from "./paymentrequiredresponseerror.js";
|
|
25
25
|
export * from "./provideroverloadedresponseerror.js";
|
|
26
26
|
export * from "./requesttimeoutresponseerror.js";
|
|
27
|
+
export * from "./responsesbadrequestresponseerror.js";
|
|
27
28
|
export * from "./responsevalidationerror.js";
|
|
28
29
|
export * from "./sdkvalidationerror.js";
|
|
29
30
|
export * from "./serviceunavailableresponseerror.js";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import * as models from "../index.js";
|
|
3
|
+
import { OpenRouterError } from "./openroutererror.js";
|
|
4
|
+
/**
|
|
5
|
+
* Bad Request - Invalid request parameters or malformed input. Request-shape validation failures carry a Responses API string code (e.g. `invalid_prompt`) with details in the top-level `metadata`; all other failures carry the integer HTTP status.
|
|
6
|
+
*/
|
|
7
|
+
export type ResponsesBadRequestResponseErrorData = {
|
|
8
|
+
/**
|
|
9
|
+
* Error data for ResponsesBadRequestResponse
|
|
10
|
+
*/
|
|
11
|
+
error: models.ResponsesBadRequestResponseErrorData;
|
|
12
|
+
/**
|
|
13
|
+
* Validation details for string-coded errors; `raw` holds the serialized schema issues
|
|
14
|
+
*/
|
|
15
|
+
metadata?: {
|
|
16
|
+
[k: string]: string;
|
|
17
|
+
} | null | undefined;
|
|
18
|
+
openrouterMetadata?: {
|
|
19
|
+
[k: string]: any;
|
|
20
|
+
} | null | undefined;
|
|
21
|
+
userId?: string | null | undefined;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Bad Request - Invalid request parameters or malformed input. Request-shape validation failures carry a Responses API string code (e.g. `invalid_prompt`) with details in the top-level `metadata`; all other failures carry the integer HTTP status.
|
|
25
|
+
*/
|
|
26
|
+
export declare class ResponsesBadRequestResponseError extends OpenRouterError {
|
|
27
|
+
/**
|
|
28
|
+
* Error data for ResponsesBadRequestResponse
|
|
29
|
+
*/
|
|
30
|
+
error: models.ResponsesBadRequestResponseErrorData;
|
|
31
|
+
/**
|
|
32
|
+
* Validation details for string-coded errors; `raw` holds the serialized schema issues
|
|
33
|
+
*/
|
|
34
|
+
metadata?: {
|
|
35
|
+
[k: string]: string;
|
|
36
|
+
} | null | undefined;
|
|
37
|
+
openrouterMetadata?: {
|
|
38
|
+
[k: string]: any;
|
|
39
|
+
} | null | undefined;
|
|
40
|
+
userId?: string | null | undefined;
|
|
41
|
+
/** The original data that was passed to this error instance. */
|
|
42
|
+
data$: ResponsesBadRequestResponseErrorData;
|
|
43
|
+
constructor(err: ResponsesBadRequestResponseErrorData, httpMeta: {
|
|
44
|
+
response: Response;
|
|
45
|
+
request: Request;
|
|
46
|
+
body: string;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/** @internal */
|
|
50
|
+
export declare const ResponsesBadRequestResponseError$inboundSchema: z.ZodType<ResponsesBadRequestResponseError, unknown>;
|
|
51
|
+
//# sourceMappingURL=responsesbadrequestresponseerror.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 0404d3d94803
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { ResponsesBadRequestResponseErrorData$inboundSchema as models_ResponsesBadRequestResponseErrorData$inboundSchema } from "../responsesbadrequestresponseerrordata.js";
|
|
8
|
+
import { OpenRouterError } from "./openroutererror.js";
|
|
9
|
+
/**
|
|
10
|
+
* Bad Request - Invalid request parameters or malformed input. Request-shape validation failures carry a Responses API string code (e.g. `invalid_prompt`) with details in the top-level `metadata`; all other failures carry the integer HTTP status.
|
|
11
|
+
*/
|
|
12
|
+
export class ResponsesBadRequestResponseError extends OpenRouterError {
|
|
13
|
+
constructor(err, httpMeta) {
|
|
14
|
+
const message = err.error?.message
|
|
15
|
+
|| `API error occurred: ${JSON.stringify(err)}`;
|
|
16
|
+
super(message, httpMeta);
|
|
17
|
+
this.data$ = err;
|
|
18
|
+
this.error = err.error;
|
|
19
|
+
if (err.metadata != null)
|
|
20
|
+
this.metadata = err.metadata;
|
|
21
|
+
if (err.openrouterMetadata != null) {
|
|
22
|
+
this.openrouterMetadata = err.openrouterMetadata;
|
|
23
|
+
}
|
|
24
|
+
if (err.userId != null)
|
|
25
|
+
this.userId = err.userId;
|
|
26
|
+
this.name = "ResponsesBadRequestResponseError";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** @internal */
|
|
30
|
+
export const ResponsesBadRequestResponseError$inboundSchema = z.object({
|
|
31
|
+
error: models_ResponsesBadRequestResponseErrorData$inboundSchema,
|
|
32
|
+
metadata: z.nullable(z.record(z.string(), z.string())).optional(),
|
|
33
|
+
openrouter_metadata: z.nullable(z.record(z.string(), z.any())).optional(),
|
|
34
|
+
user_id: z.nullable(z.string()).optional(),
|
|
35
|
+
request$: z.custom(x => x instanceof Request),
|
|
36
|
+
response$: z.custom(x => x instanceof Response),
|
|
37
|
+
body$: z.string(),
|
|
38
|
+
})
|
|
39
|
+
.transform((v) => {
|
|
40
|
+
const remapped = remap$(v, {
|
|
41
|
+
"openrouter_metadata": "openrouterMetadata",
|
|
42
|
+
"user_id": "userId",
|
|
43
|
+
});
|
|
44
|
+
return new ResponsesBadRequestResponseError(remapped, {
|
|
45
|
+
request: v.request$,
|
|
46
|
+
response: v.response$,
|
|
47
|
+
body: v.body$,
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=responsesbadrequestresponseerror.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
3
|
import { ContentFilterBuiltinEntry } from "./contentfilterbuiltinentry.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ContentFilterReadEntry } from "./contentfilterreadentry.js";
|
|
5
5
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
6
6
|
import { GuardrailDataRegion } from "./guardraildataregion.js";
|
|
7
7
|
import { GuardrailInterval } from "./guardrailinterval.js";
|
|
@@ -33,7 +33,7 @@ export type Guardrail = {
|
|
|
33
33
|
/**
|
|
34
34
|
* Custom regex content filters applied to request messages
|
|
35
35
|
*/
|
|
36
|
-
contentFilters?: Array<
|
|
36
|
+
contentFilters?: Array<ContentFilterReadEntry> | null | undefined;
|
|
37
37
|
/**
|
|
38
38
|
* ISO 8601 timestamp of when the guardrail was created
|
|
39
39
|
*/
|
package/esm/models/guardrail.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as z from "zod/v4";
|
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../lib/schemas.js";
|
|
8
8
|
import { ContentFilterBuiltinEntry$inboundSchema, } from "./contentfilterbuiltinentry.js";
|
|
9
|
-
import {
|
|
9
|
+
import { ContentFilterReadEntry$inboundSchema, } from "./contentfilterreadentry.js";
|
|
10
10
|
import { GuardrailDataRegion$inboundSchema, } from "./guardraildataregion.js";
|
|
11
11
|
import { GuardrailInterval$inboundSchema, } from "./guardrailinterval.js";
|
|
12
12
|
/** @internal */
|
|
@@ -18,7 +18,7 @@ export const Guardrail$inboundSchema = z.object({
|
|
|
18
18
|
allowed_models: z.nullable(z.array(z.string())).optional(),
|
|
19
19
|
allowed_providers: z.nullable(z.array(z.string())).optional(),
|
|
20
20
|
content_filter_builtins: z.nullable(z.array(ContentFilterBuiltinEntry$inboundSchema)).optional(),
|
|
21
|
-
content_filters: z.nullable(z.array(
|
|
21
|
+
content_filters: z.nullable(z.array(ContentFilterReadEntry$inboundSchema))
|
|
22
22
|
.optional(),
|
|
23
23
|
created_at: z.string(),
|
|
24
24
|
description: z.nullable(z.string()).optional(),
|
package/esm/models/index.d.ts
CHANGED
|
@@ -274,6 +274,7 @@ export * from "./contentfilterbuiltinentry.js";
|
|
|
274
274
|
export * from "./contentfilterbuiltinentryinput.js";
|
|
275
275
|
export * from "./contentfilterbuiltinslug.js";
|
|
276
276
|
export * from "./contentfilterentry.js";
|
|
277
|
+
export * from "./contentfilterreadentry.js";
|
|
277
278
|
export * from "./contentpartaddedevent.js";
|
|
278
279
|
export * from "./contentpartaudio.js";
|
|
279
280
|
export * from "./contentpartdoneevent.js";
|
|
@@ -771,6 +772,7 @@ export * from "./rerank.js";
|
|
|
771
772
|
export * from "./responsehealingplugin.js";
|
|
772
773
|
export * from "./responseincludesenum.js";
|
|
773
774
|
export * from "./responseoutputtext.js";
|
|
775
|
+
export * from "./responsesbadrequestresponseerrordata.js";
|
|
774
776
|
export * from "./responsesrequest.js";
|
|
775
777
|
export * from "./responsesstreamingresponse.js";
|
|
776
778
|
export * from "./routerattempt.js";
|
package/esm/models/index.js
CHANGED
|
@@ -278,6 +278,7 @@ export * from "./contentfilterbuiltinentry.js";
|
|
|
278
278
|
export * from "./contentfilterbuiltinentryinput.js";
|
|
279
279
|
export * from "./contentfilterbuiltinslug.js";
|
|
280
280
|
export * from "./contentfilterentry.js";
|
|
281
|
+
export * from "./contentfilterreadentry.js";
|
|
281
282
|
export * from "./contentpartaddedevent.js";
|
|
282
283
|
export * from "./contentpartaudio.js";
|
|
283
284
|
export * from "./contentpartdoneevent.js";
|
|
@@ -775,6 +776,7 @@ export * from "./rerank.js";
|
|
|
775
776
|
export * from "./responsehealingplugin.js";
|
|
776
777
|
export * from "./responseincludesenum.js";
|
|
777
778
|
export * from "./responseoutputtext.js";
|
|
779
|
+
export * from "./responsesbadrequestresponseerrordata.js";
|
|
778
780
|
export * from "./responsesrequest.js";
|
|
779
781
|
export * from "./responsesstreamingresponse.js";
|
|
780
782
|
export * from "./routerattempt.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
+
/**
|
|
5
|
+
* Integer HTTP status, or a Responses API error code string (e.g. `invalid_prompt`) when the request body fails validation
|
|
6
|
+
*/
|
|
7
|
+
export type Code = number | string;
|
|
8
|
+
/**
|
|
9
|
+
* Error data for ResponsesBadRequestResponse
|
|
10
|
+
*/
|
|
11
|
+
export type ResponsesBadRequestResponseErrorData = {
|
|
12
|
+
/**
|
|
13
|
+
* Integer HTTP status, or a Responses API error code string (e.g. `invalid_prompt`) when the request body fails validation
|
|
14
|
+
*/
|
|
15
|
+
code: number | string;
|
|
16
|
+
message: string;
|
|
17
|
+
metadata?: {
|
|
18
|
+
[k: string]: any;
|
|
19
|
+
} | null | undefined;
|
|
20
|
+
};
|
|
21
|
+
/** @internal */
|
|
22
|
+
export declare const Code$inboundSchema: z.ZodType<Code, unknown>;
|
|
23
|
+
export declare function codeFromJSON(jsonString: string): SafeParseResult<Code, SDKValidationError>;
|
|
24
|
+
/** @internal */
|
|
25
|
+
export declare const ResponsesBadRequestResponseErrorData$inboundSchema: z.ZodType<ResponsesBadRequestResponseErrorData, unknown>;
|
|
26
|
+
export declare function responsesBadRequestResponseErrorDataFromJSON(jsonString: string): SafeParseResult<ResponsesBadRequestResponseErrorData, SDKValidationError>;
|
|
27
|
+
//# sourceMappingURL=responsesbadrequestresponseerrordata.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 24e206b34a71
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const Code$inboundSchema = z.union([
|
|
9
|
+
z.int(),
|
|
10
|
+
z.string(),
|
|
11
|
+
]);
|
|
12
|
+
export function codeFromJSON(jsonString) {
|
|
13
|
+
return safeParse(jsonString, (x) => Code$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Code' from JSON`);
|
|
14
|
+
}
|
|
15
|
+
/** @internal */
|
|
16
|
+
export const ResponsesBadRequestResponseErrorData$inboundSchema = z.object({
|
|
17
|
+
code: z.union([z.int(), z.string()]),
|
|
18
|
+
message: z.string(),
|
|
19
|
+
metadata: z.nullable(z.record(z.string(), z.any())).optional(),
|
|
20
|
+
});
|
|
21
|
+
export function responsesBadRequestResponseErrorDataFromJSON(jsonString) {
|
|
22
|
+
return safeParse(jsonString, (x) => ResponsesBadRequestResponseErrorData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponsesBadRequestResponseErrorData' from JSON`);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=responsesbadrequestresponseerrordata.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.99",
|
|
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": [
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"packageManager": "pnpm@10.22.0",
|
|
23
23
|
"publishConfig": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
24
|
+
"access": "public",
|
|
25
|
+
"provenance": true
|
|
26
26
|
},
|
|
27
27
|
"type": "module",
|
|
28
28
|
"main": "./esm/index.js",
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
"lint": "eslint --cache --max-warnings=0 src",
|
|
74
74
|
"build": "tsc && node scripts/unbarrel-imports.js",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
|
-
"test:
|
|
77
|
-
"typecheck": "tsc --noEmit",
|
|
76
|
+
"test:e2e": "vitest --run --project e2e",
|
|
78
77
|
"typecheck:transit": "exit 0",
|
|
79
78
|
"compile": "tsc && node scripts/unbarrel-imports.js",
|
|
80
79
|
"postinstall": "node scripts/check-types.js || true",
|
|
81
80
|
"test": "vitest --run --project unit",
|
|
81
|
+
"test:transit": "exit 0",
|
|
82
82
|
"test:watch": "vitest --watch --project unit",
|
|
83
|
-
"
|
|
84
|
-
"
|
|
83
|
+
"typecheck": "tsc --noEmit",
|
|
84
|
+
"prepare": "npm run build"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
|