@openrouter/sdk 1.0.2 → 1.0.4
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/apiKeysList.d.ts +1 -1
- package/esm/funcs/apiKeysList.js +1 -1
- package/esm/funcs/byokList.d.ts +1 -1
- package/esm/funcs/byokList.js +1 -1
- package/esm/funcs/guardrailsList.d.ts +1 -1
- package/esm/funcs/guardrailsList.js +1 -1
- package/esm/funcs/observabilityList.d.ts +1 -1
- package/esm/funcs/observabilityList.js +1 -1
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/anthropictoolsearchtoolbm25.d.ts +41 -0
- package/esm/models/anthropictoolsearchtoolbm25.js +39 -0
- package/esm/models/anthropictoolsearchtoolregex.d.ts +41 -0
- package/esm/models/anthropictoolsearchtoolregex.js +39 -0
- package/esm/models/chatrequest.d.ts +1 -1
- package/esm/models/index.d.ts +2 -0
- package/esm/models/index.js +2 -0
- package/esm/models/messagesrequest.d.ts +7 -5
- package/esm/models/messagesrequest.js +6 -0
- package/esm/models/responsesrequest.d.ts +1 -1
- package/jsr.json +1 -1
- package/package.json +7 -7
|
@@ -14,5 +14,5 @@ import { Result } from "../types/fp.js";
|
|
|
14
14
|
* @remarks
|
|
15
15
|
* List all API keys for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
16
16
|
*/
|
|
17
|
-
export declare function apiKeysList(client: OpenRouterCore, request?: operations.ListRequest | undefined, options?: RequestOptions): APIPromise<Result<operations.ListResponse, errors.UnauthorizedResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
17
|
+
export declare function apiKeysList(client: OpenRouterCore, request?: operations.ListRequest | undefined, options?: RequestOptions): APIPromise<Result<operations.ListResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
18
|
//# sourceMappingURL=apiKeysList.d.ts.map
|
package/esm/funcs/apiKeysList.js
CHANGED
|
@@ -93,7 +93,7 @@ async function $do(client, request, options) {
|
|
|
93
93
|
const responseFields = {
|
|
94
94
|
HttpMeta: { Response: response, Request: req },
|
|
95
95
|
};
|
|
96
|
-
const [result] = await M.match(M.json(200, operations.ListResponse$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
96
|
+
const [result] = await M.match(M.json(200, operations.ListResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
97
97
|
if (!result.ok) {
|
|
98
98
|
return [result, { status: "complete", request: req, response }];
|
|
99
99
|
}
|
package/esm/funcs/byokList.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ import { PageIterator } from "../types/operations.js";
|
|
|
15
15
|
* @remarks
|
|
16
16
|
* List the bring-your-own-key (BYOK) provider credentials for the authenticated entity's default workspace. Use the `workspace_id` query parameter to scope the result to a different workspace, or the `provider` query parameter to filter by upstream provider. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
17
17
|
*/
|
|
18
|
-
export declare function byokList(client: OpenRouterCore, request?: operations.ListBYOKKeysRequest | undefined, options?: RequestOptions): APIPromise<PageIterator<Result<operations.ListBYOKKeysResponse, errors.UnauthorizedResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
|
|
18
|
+
export declare function byokList(client: OpenRouterCore, request?: operations.ListBYOKKeysRequest | undefined, options?: RequestOptions): APIPromise<PageIterator<Result<operations.ListBYOKKeysResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
|
|
19
19
|
offset: number;
|
|
20
20
|
}>>;
|
|
21
21
|
//# sourceMappingURL=byokList.d.ts.map
|
package/esm/funcs/byokList.js
CHANGED
|
@@ -97,7 +97,7 @@ async function $do(client, request, options) {
|
|
|
97
97
|
};
|
|
98
98
|
const [result, raw] = await M.match(M.json(200, operations.ListBYOKKeysResponse$inboundSchema, {
|
|
99
99
|
key: "Result",
|
|
100
|
-
}), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
100
|
+
}), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
101
101
|
if (!result.ok) {
|
|
102
102
|
return [haltIterator(result), {
|
|
103
103
|
status: "complete",
|
|
@@ -15,7 +15,7 @@ import { PageIterator } from "../types/operations.js";
|
|
|
15
15
|
* @remarks
|
|
16
16
|
* List all guardrails for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
17
17
|
*/
|
|
18
|
-
export declare function guardrailsList(client: OpenRouterCore, request?: operations.ListGuardrailsRequest | undefined, options?: RequestOptions): APIPromise<PageIterator<Result<operations.ListGuardrailsResponse, errors.UnauthorizedResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
|
|
18
|
+
export declare function guardrailsList(client: OpenRouterCore, request?: operations.ListGuardrailsRequest | undefined, options?: RequestOptions): APIPromise<PageIterator<Result<operations.ListGuardrailsResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
|
|
19
19
|
offset: number;
|
|
20
20
|
}>>;
|
|
21
21
|
//# sourceMappingURL=guardrailsList.d.ts.map
|
|
@@ -96,7 +96,7 @@ async function $do(client, request, options) {
|
|
|
96
96
|
};
|
|
97
97
|
const [result, raw] = await M.match(M.json(200, operations.ListGuardrailsResponse$inboundSchema, {
|
|
98
98
|
key: "Result",
|
|
99
|
-
}), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
99
|
+
}), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
100
100
|
if (!result.ok) {
|
|
101
101
|
return [haltIterator(result), {
|
|
102
102
|
status: "complete",
|
|
@@ -15,7 +15,7 @@ import { PageIterator } from "../types/operations.js";
|
|
|
15
15
|
* @remarks
|
|
16
16
|
* List the observability destinations configured for the authenticated entity's default workspace. Use the `workspace_id` query parameter to scope the result to a different workspace. Only destinations with stable release status are surfaced — destinations of other types are excluded. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
17
17
|
*/
|
|
18
|
-
export declare function observabilityList(client: OpenRouterCore, request?: operations.ListObservabilityDestinationsRequest | undefined, options?: RequestOptions): APIPromise<PageIterator<Result<operations.ListObservabilityDestinationsResponse, errors.UnauthorizedResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
|
|
18
|
+
export declare function observabilityList(client: OpenRouterCore, request?: operations.ListObservabilityDestinationsRequest | undefined, options?: RequestOptions): APIPromise<PageIterator<Result<operations.ListObservabilityDestinationsResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
|
|
19
19
|
offset: number;
|
|
20
20
|
}>>;
|
|
21
21
|
//# sourceMappingURL=observabilityList.d.ts.map
|
|
@@ -95,7 +95,7 @@ async function $do(client, request, options) {
|
|
|
95
95
|
const responseFields = {
|
|
96
96
|
HttpMeta: { Response: response, Request: req },
|
|
97
97
|
};
|
|
98
|
-
const [result, raw] = await M.match(M.json(200, operations.ListObservabilityDestinationsResponse$inboundSchema, { key: "Result" }), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
98
|
+
const [result, raw] = await M.match(M.json(200, operations.ListObservabilityDestinationsResponse$inboundSchema, { key: "Result" }), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
99
99
|
if (!result.ok) {
|
|
100
100
|
return [haltIterator(result), {
|
|
101
101
|
status: "complete",
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -49,8 +49,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
49
49
|
export declare const SDK_METADATA: {
|
|
50
50
|
readonly language: "typescript";
|
|
51
51
|
readonly openapiDocVersion: "1.0.0";
|
|
52
|
-
readonly sdkVersion: "1.0.
|
|
52
|
+
readonly sdkVersion: "1.0.4";
|
|
53
53
|
readonly genVersion: "2.914.0";
|
|
54
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.0.
|
|
54
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.0.4 2.914.0 1.0.0 @openrouter/sdk";
|
|
55
55
|
};
|
|
56
56
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -26,8 +26,8 @@ export function serverURLFromOptions(options) {
|
|
|
26
26
|
export const SDK_METADATA = {
|
|
27
27
|
language: "typescript",
|
|
28
28
|
openapiDocVersion: "1.0.0",
|
|
29
|
-
sdkVersion: "1.0.
|
|
29
|
+
sdkVersion: "1.0.4",
|
|
30
30
|
genVersion: "2.914.0",
|
|
31
|
-
userAgent: "speakeasy-sdk/typescript 1.0.
|
|
31
|
+
userAgent: "speakeasy-sdk/typescript 1.0.4 2.914.0 1.0.0 @openrouter/sdk",
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { ClosedEnum, OpenEnum } from "../types/enums.js";
|
|
3
|
+
import { AnthropicAllowedCallers } from "./anthropicallowedcallers.js";
|
|
4
|
+
import { AnthropicCacheControlDirective, AnthropicCacheControlDirective$Outbound } from "./anthropiccachecontroldirective.js";
|
|
5
|
+
export declare const AnthropicToolSearchToolBm25Name: {
|
|
6
|
+
readonly ToolSearchToolBm25: "tool_search_tool_bm25";
|
|
7
|
+
};
|
|
8
|
+
export type AnthropicToolSearchToolBm25Name = ClosedEnum<typeof AnthropicToolSearchToolBm25Name>;
|
|
9
|
+
export declare const AnthropicToolSearchToolBm25Type: {
|
|
10
|
+
readonly ToolSearchToolBm2520251119: "tool_search_tool_bm25_20251119";
|
|
11
|
+
readonly ToolSearchToolBm25: "tool_search_tool_bm25";
|
|
12
|
+
};
|
|
13
|
+
export type AnthropicToolSearchToolBm25Type = OpenEnum<typeof AnthropicToolSearchToolBm25Type>;
|
|
14
|
+
export type AnthropicToolSearchToolBm25 = {
|
|
15
|
+
allowedCallers?: Array<AnthropicAllowedCallers> | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.
|
|
18
|
+
*/
|
|
19
|
+
cacheControl?: AnthropicCacheControlDirective | undefined;
|
|
20
|
+
deferLoading?: boolean | undefined;
|
|
21
|
+
name: AnthropicToolSearchToolBm25Name;
|
|
22
|
+
strict?: boolean | undefined;
|
|
23
|
+
type: AnthropicToolSearchToolBm25Type;
|
|
24
|
+
};
|
|
25
|
+
/** @internal */
|
|
26
|
+
export declare const AnthropicToolSearchToolBm25Name$outboundSchema: z.ZodEnum<typeof AnthropicToolSearchToolBm25Name>;
|
|
27
|
+
/** @internal */
|
|
28
|
+
export declare const AnthropicToolSearchToolBm25Type$outboundSchema: z.ZodType<string, AnthropicToolSearchToolBm25Type>;
|
|
29
|
+
/** @internal */
|
|
30
|
+
export type AnthropicToolSearchToolBm25$Outbound = {
|
|
31
|
+
allowed_callers?: Array<string> | undefined;
|
|
32
|
+
cache_control?: AnthropicCacheControlDirective$Outbound | undefined;
|
|
33
|
+
defer_loading?: boolean | undefined;
|
|
34
|
+
name: string;
|
|
35
|
+
strict?: boolean | undefined;
|
|
36
|
+
type: string;
|
|
37
|
+
};
|
|
38
|
+
/** @internal */
|
|
39
|
+
export declare const AnthropicToolSearchToolBm25$outboundSchema: z.ZodType<AnthropicToolSearchToolBm25$Outbound, AnthropicToolSearchToolBm25>;
|
|
40
|
+
export declare function anthropicToolSearchToolBm25ToJSON(anthropicToolSearchToolBm25: AnthropicToolSearchToolBm25): string;
|
|
41
|
+
//# sourceMappingURL=anthropictoolsearchtoolbm25.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: d06d81d905be
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import * as openEnums from "../types/enums.js";
|
|
8
|
+
import { AnthropicAllowedCallers$outboundSchema, } from "./anthropicallowedcallers.js";
|
|
9
|
+
import { AnthropicCacheControlDirective$outboundSchema, } from "./anthropiccachecontroldirective.js";
|
|
10
|
+
export const AnthropicToolSearchToolBm25Name = {
|
|
11
|
+
ToolSearchToolBm25: "tool_search_tool_bm25",
|
|
12
|
+
};
|
|
13
|
+
export const AnthropicToolSearchToolBm25Type = {
|
|
14
|
+
ToolSearchToolBm2520251119: "tool_search_tool_bm25_20251119",
|
|
15
|
+
ToolSearchToolBm25: "tool_search_tool_bm25",
|
|
16
|
+
};
|
|
17
|
+
/** @internal */
|
|
18
|
+
export const AnthropicToolSearchToolBm25Name$outboundSchema = z.enum(AnthropicToolSearchToolBm25Name);
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const AnthropicToolSearchToolBm25Type$outboundSchema = openEnums.outboundSchema(AnthropicToolSearchToolBm25Type);
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const AnthropicToolSearchToolBm25$outboundSchema = z.object({
|
|
23
|
+
allowedCallers: z.array(AnthropicAllowedCallers$outboundSchema).optional(),
|
|
24
|
+
cacheControl: AnthropicCacheControlDirective$outboundSchema.optional(),
|
|
25
|
+
deferLoading: z.boolean().optional(),
|
|
26
|
+
name: AnthropicToolSearchToolBm25Name$outboundSchema,
|
|
27
|
+
strict: z.boolean().optional(),
|
|
28
|
+
type: AnthropicToolSearchToolBm25Type$outboundSchema,
|
|
29
|
+
}).transform((v) => {
|
|
30
|
+
return remap$(v, {
|
|
31
|
+
allowedCallers: "allowed_callers",
|
|
32
|
+
cacheControl: "cache_control",
|
|
33
|
+
deferLoading: "defer_loading",
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
export function anthropicToolSearchToolBm25ToJSON(anthropicToolSearchToolBm25) {
|
|
37
|
+
return JSON.stringify(AnthropicToolSearchToolBm25$outboundSchema.parse(anthropicToolSearchToolBm25));
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=anthropictoolsearchtoolbm25.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { ClosedEnum, OpenEnum } from "../types/enums.js";
|
|
3
|
+
import { AnthropicAllowedCallers } from "./anthropicallowedcallers.js";
|
|
4
|
+
import { AnthropicCacheControlDirective, AnthropicCacheControlDirective$Outbound } from "./anthropiccachecontroldirective.js";
|
|
5
|
+
export declare const AnthropicToolSearchToolRegexName: {
|
|
6
|
+
readonly ToolSearchToolRegex: "tool_search_tool_regex";
|
|
7
|
+
};
|
|
8
|
+
export type AnthropicToolSearchToolRegexName = ClosedEnum<typeof AnthropicToolSearchToolRegexName>;
|
|
9
|
+
export declare const AnthropicToolSearchToolRegexType: {
|
|
10
|
+
readonly ToolSearchToolRegex20251119: "tool_search_tool_regex_20251119";
|
|
11
|
+
readonly ToolSearchToolRegex: "tool_search_tool_regex";
|
|
12
|
+
};
|
|
13
|
+
export type AnthropicToolSearchToolRegexType = OpenEnum<typeof AnthropicToolSearchToolRegexType>;
|
|
14
|
+
export type AnthropicToolSearchToolRegex = {
|
|
15
|
+
allowedCallers?: Array<AnthropicAllowedCallers> | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.
|
|
18
|
+
*/
|
|
19
|
+
cacheControl?: AnthropicCacheControlDirective | undefined;
|
|
20
|
+
deferLoading?: boolean | undefined;
|
|
21
|
+
name: AnthropicToolSearchToolRegexName;
|
|
22
|
+
strict?: boolean | undefined;
|
|
23
|
+
type: AnthropicToolSearchToolRegexType;
|
|
24
|
+
};
|
|
25
|
+
/** @internal */
|
|
26
|
+
export declare const AnthropicToolSearchToolRegexName$outboundSchema: z.ZodEnum<typeof AnthropicToolSearchToolRegexName>;
|
|
27
|
+
/** @internal */
|
|
28
|
+
export declare const AnthropicToolSearchToolRegexType$outboundSchema: z.ZodType<string, AnthropicToolSearchToolRegexType>;
|
|
29
|
+
/** @internal */
|
|
30
|
+
export type AnthropicToolSearchToolRegex$Outbound = {
|
|
31
|
+
allowed_callers?: Array<string> | undefined;
|
|
32
|
+
cache_control?: AnthropicCacheControlDirective$Outbound | undefined;
|
|
33
|
+
defer_loading?: boolean | undefined;
|
|
34
|
+
name: string;
|
|
35
|
+
strict?: boolean | undefined;
|
|
36
|
+
type: string;
|
|
37
|
+
};
|
|
38
|
+
/** @internal */
|
|
39
|
+
export declare const AnthropicToolSearchToolRegex$outboundSchema: z.ZodType<AnthropicToolSearchToolRegex$Outbound, AnthropicToolSearchToolRegex>;
|
|
40
|
+
export declare function anthropicToolSearchToolRegexToJSON(anthropicToolSearchToolRegex: AnthropicToolSearchToolRegex): string;
|
|
41
|
+
//# sourceMappingURL=anthropictoolsearchtoolregex.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 70c2d1fd66ec
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import * as openEnums from "../types/enums.js";
|
|
8
|
+
import { AnthropicAllowedCallers$outboundSchema, } from "./anthropicallowedcallers.js";
|
|
9
|
+
import { AnthropicCacheControlDirective$outboundSchema, } from "./anthropiccachecontroldirective.js";
|
|
10
|
+
export const AnthropicToolSearchToolRegexName = {
|
|
11
|
+
ToolSearchToolRegex: "tool_search_tool_regex",
|
|
12
|
+
};
|
|
13
|
+
export const AnthropicToolSearchToolRegexType = {
|
|
14
|
+
ToolSearchToolRegex20251119: "tool_search_tool_regex_20251119",
|
|
15
|
+
ToolSearchToolRegex: "tool_search_tool_regex",
|
|
16
|
+
};
|
|
17
|
+
/** @internal */
|
|
18
|
+
export const AnthropicToolSearchToolRegexName$outboundSchema = z.enum(AnthropicToolSearchToolRegexName);
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const AnthropicToolSearchToolRegexType$outboundSchema = openEnums.outboundSchema(AnthropicToolSearchToolRegexType);
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const AnthropicToolSearchToolRegex$outboundSchema = z.object({
|
|
23
|
+
allowedCallers: z.array(AnthropicAllowedCallers$outboundSchema).optional(),
|
|
24
|
+
cacheControl: AnthropicCacheControlDirective$outboundSchema.optional(),
|
|
25
|
+
deferLoading: z.boolean().optional(),
|
|
26
|
+
name: AnthropicToolSearchToolRegexName$outboundSchema,
|
|
27
|
+
strict: z.boolean().optional(),
|
|
28
|
+
type: AnthropicToolSearchToolRegexType$outboundSchema,
|
|
29
|
+
}).transform((v) => {
|
|
30
|
+
return remap$(v, {
|
|
31
|
+
allowedCallers: "allowed_callers",
|
|
32
|
+
cacheControl: "cache_control",
|
|
33
|
+
deferLoading: "defer_loading",
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
export function anthropicToolSearchToolRegexToJSON(anthropicToolSearchToolRegex) {
|
|
37
|
+
return JSON.stringify(AnthropicToolSearchToolRegex$outboundSchema.parse(anthropicToolSearchToolRegex));
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=anthropictoolsearchtoolregex.js.map
|
|
@@ -223,7 +223,7 @@ export type ChatRequest = {
|
|
|
223
223
|
*/
|
|
224
224
|
stop?: string | Array<string> | null | undefined;
|
|
225
225
|
/**
|
|
226
|
-
* Stop conditions for the server-tool agent loop. Any condition firing halts the loop (OR logic). When set, this overrides `max_tool_calls`.
|
|
226
|
+
* Stop conditions for the server-tool agent loop. Any condition firing halts the loop (OR logic). When set, this overrides `max_tool_calls`. When a condition fires while the model is still emitting tool calls, the pending tool calls are executed and one final turn is made with tool calls disabled so the response ends with a natural-language answer instead of an unfinished tool call.
|
|
227
227
|
*/
|
|
228
228
|
stopServerToolsWhen?: Array<StopServerToolsWhenCondition> | undefined;
|
|
229
229
|
/**
|
package/esm/models/index.d.ts
CHANGED
|
@@ -35,6 +35,8 @@ export * from "./anthropicspeed.js";
|
|
|
35
35
|
export * from "./anthropictextblockparam.js";
|
|
36
36
|
export * from "./anthropicthinkingdisplay.js";
|
|
37
37
|
export * from "./anthropicthinkingturns.js";
|
|
38
|
+
export * from "./anthropictoolsearchtoolbm25.js";
|
|
39
|
+
export * from "./anthropictoolsearchtoolregex.js";
|
|
38
40
|
export * from "./anthropictooluseskeep.js";
|
|
39
41
|
export * from "./anthropictoolusestrigger.js";
|
|
40
42
|
export * from "./anthropicunknownusageiteration.js";
|
package/esm/models/index.js
CHANGED
|
@@ -39,6 +39,8 @@ export * from "./anthropicspeed.js";
|
|
|
39
39
|
export * from "./anthropictextblockparam.js";
|
|
40
40
|
export * from "./anthropicthinkingdisplay.js";
|
|
41
41
|
export * from "./anthropicthinkingturns.js";
|
|
42
|
+
export * from "./anthropictoolsearchtoolbm25.js";
|
|
43
|
+
export * from "./anthropictoolsearchtoolregex.js";
|
|
42
44
|
export * from "./anthropictooluseskeep.js";
|
|
43
45
|
export * from "./anthropictoolusestrigger.js";
|
|
44
46
|
export * from "./anthropicunknownusageiteration.js";
|
|
@@ -7,6 +7,8 @@ import { AnthropicInputTokensTrigger, AnthropicInputTokensTrigger$Outbound } fro
|
|
|
7
7
|
import { AnthropicTextBlockParam, AnthropicTextBlockParam$Outbound } from "./anthropictextblockparam.js";
|
|
8
8
|
import { AnthropicThinkingDisplay } from "./anthropicthinkingdisplay.js";
|
|
9
9
|
import { AnthropicThinkingTurns, AnthropicThinkingTurns$Outbound } from "./anthropicthinkingturns.js";
|
|
10
|
+
import { AnthropicToolSearchToolBm25, AnthropicToolSearchToolBm25$Outbound } from "./anthropictoolsearchtoolbm25.js";
|
|
11
|
+
import { AnthropicToolSearchToolRegex, AnthropicToolSearchToolRegex$Outbound } from "./anthropictoolsearchtoolregex.js";
|
|
10
12
|
import { AnthropicToolUsesKeep, AnthropicToolUsesKeep$Outbound } from "./anthropictooluseskeep.js";
|
|
11
13
|
import { AnthropicToolUsesTrigger, AnthropicToolUsesTrigger$Outbound } from "./anthropictoolusestrigger.js";
|
|
12
14
|
import { AnthropicWebSearchToolUserLocation, AnthropicWebSearchToolUserLocation$Outbound } from "./anthropicwebsearchtooluserlocation.js";
|
|
@@ -244,7 +246,7 @@ export type ToolCustom = {
|
|
|
244
246
|
name: string;
|
|
245
247
|
type?: ToolTypeCustom | undefined;
|
|
246
248
|
};
|
|
247
|
-
export type MessagesRequestToolUnion = ToolAdvisor20260301 | ToolCustom | ToolBash20250124 | ToolTextEditor20250124 | ToolWebSearch20250305 | ToolWebSearch20260209 | BashServerTool | DatetimeServerTool | ImageGenerationServerToolOpenRouter | MessagesSearchModelsServerTool | WebFetchServerTool | OpenRouterWebSearchServerTool | MessagesRequestTool;
|
|
249
|
+
export type MessagesRequestToolUnion = ToolAdvisor20260301 | ToolCustom | ToolBash20250124 | ToolTextEditor20250124 | ToolWebSearch20250305 | ToolWebSearch20260209 | AnthropicToolSearchToolBm25 | AnthropicToolSearchToolRegex | BashServerTool | DatetimeServerTool | ImageGenerationServerToolOpenRouter | MessagesSearchModelsServerTool | WebFetchServerTool | OpenRouterWebSearchServerTool | MessagesRequestTool;
|
|
248
250
|
/**
|
|
249
251
|
* Request schema for Anthropic Messages API endpoint
|
|
250
252
|
*/
|
|
@@ -283,7 +285,7 @@ export type MessagesRequest = {
|
|
|
283
285
|
speed?: Speed | null | undefined;
|
|
284
286
|
stopSequences?: Array<string> | undefined;
|
|
285
287
|
/**
|
|
286
|
-
* Stop conditions for the server-tool agent loop. Any condition firing halts the loop (OR logic). When set, this overrides `max_tool_calls`.
|
|
288
|
+
* Stop conditions for the server-tool agent loop. Any condition firing halts the loop (OR logic). When set, this overrides `max_tool_calls`. When a condition fires while the model is still emitting tool calls, the pending tool calls are executed and one final turn is made with tool calls disabled so the response ends with a natural-language answer instead of an unfinished tool call.
|
|
287
289
|
*/
|
|
288
290
|
stopServerToolsWhen?: Array<StopServerToolsWhenCondition> | undefined;
|
|
289
291
|
stream?: boolean | undefined;
|
|
@@ -291,7 +293,7 @@ export type MessagesRequest = {
|
|
|
291
293
|
temperature?: number | undefined;
|
|
292
294
|
thinking?: ThinkingEnabled | ThinkingDisabled | ThinkingAdaptive | undefined;
|
|
293
295
|
toolChoice?: ToolChoiceAuto | ToolChoiceAny | ToolChoiceNone | ToolChoiceTool | undefined;
|
|
294
|
-
tools?: Array<ToolAdvisor20260301 | ToolCustom | ToolBash20250124 | ToolTextEditor20250124 | ToolWebSearch20250305 | ToolWebSearch20260209 | BashServerTool | DatetimeServerTool | ImageGenerationServerToolOpenRouter | MessagesSearchModelsServerTool | WebFetchServerTool | OpenRouterWebSearchServerTool | MessagesRequestTool> | undefined;
|
|
296
|
+
tools?: Array<ToolAdvisor20260301 | ToolCustom | ToolBash20250124 | ToolTextEditor20250124 | ToolWebSearch20250305 | ToolWebSearch20260209 | AnthropicToolSearchToolBm25 | AnthropicToolSearchToolRegex | BashServerTool | DatetimeServerTool | ImageGenerationServerToolOpenRouter | MessagesSearchModelsServerTool | WebFetchServerTool | OpenRouterWebSearchServerTool | MessagesRequestTool> | undefined;
|
|
295
297
|
topK?: number | undefined;
|
|
296
298
|
topP?: number | undefined;
|
|
297
299
|
/**
|
|
@@ -577,7 +579,7 @@ export type ToolCustom$Outbound = {
|
|
|
577
579
|
export declare const ToolCustom$outboundSchema: z.ZodType<ToolCustom$Outbound, ToolCustom>;
|
|
578
580
|
export declare function toolCustomToJSON(toolCustom: ToolCustom): string;
|
|
579
581
|
/** @internal */
|
|
580
|
-
export type MessagesRequestToolUnion$Outbound = ToolAdvisor20260301$Outbound | ToolCustom$Outbound | ToolBash20250124$Outbound | ToolTextEditor20250124$Outbound | ToolWebSearch20250305$Outbound | ToolWebSearch20260209$Outbound | BashServerTool$Outbound | DatetimeServerTool$Outbound | ImageGenerationServerToolOpenRouter$Outbound | MessagesSearchModelsServerTool$Outbound | WebFetchServerTool$Outbound | OpenRouterWebSearchServerTool$Outbound | MessagesRequestTool$Outbound;
|
|
582
|
+
export type MessagesRequestToolUnion$Outbound = ToolAdvisor20260301$Outbound | ToolCustom$Outbound | ToolBash20250124$Outbound | ToolTextEditor20250124$Outbound | ToolWebSearch20250305$Outbound | ToolWebSearch20260209$Outbound | AnthropicToolSearchToolBm25$Outbound | AnthropicToolSearchToolRegex$Outbound | BashServerTool$Outbound | DatetimeServerTool$Outbound | ImageGenerationServerToolOpenRouter$Outbound | MessagesSearchModelsServerTool$Outbound | WebFetchServerTool$Outbound | OpenRouterWebSearchServerTool$Outbound | MessagesRequestTool$Outbound;
|
|
581
583
|
/** @internal */
|
|
582
584
|
export declare const MessagesRequestToolUnion$outboundSchema: z.ZodType<MessagesRequestToolUnion$Outbound, MessagesRequestToolUnion>;
|
|
583
585
|
export declare function messagesRequestToolUnionToJSON(messagesRequestToolUnion: MessagesRequestToolUnion): string;
|
|
@@ -604,7 +606,7 @@ export type MessagesRequest$Outbound = {
|
|
|
604
606
|
temperature?: number | undefined;
|
|
605
607
|
thinking?: ThinkingEnabled$Outbound | ThinkingDisabled$Outbound | ThinkingAdaptive$Outbound | undefined;
|
|
606
608
|
tool_choice?: ToolChoiceAuto$Outbound | ToolChoiceAny$Outbound | ToolChoiceNone$Outbound | ToolChoiceTool$Outbound | undefined;
|
|
607
|
-
tools?: Array<ToolAdvisor20260301$Outbound | ToolCustom$Outbound | ToolBash20250124$Outbound | ToolTextEditor20250124$Outbound | ToolWebSearch20250305$Outbound | ToolWebSearch20260209$Outbound | BashServerTool$Outbound | DatetimeServerTool$Outbound | ImageGenerationServerToolOpenRouter$Outbound | MessagesSearchModelsServerTool$Outbound | WebFetchServerTool$Outbound | OpenRouterWebSearchServerTool$Outbound | MessagesRequestTool$Outbound> | undefined;
|
|
609
|
+
tools?: Array<ToolAdvisor20260301$Outbound | ToolCustom$Outbound | ToolBash20250124$Outbound | ToolTextEditor20250124$Outbound | ToolWebSearch20250305$Outbound | ToolWebSearch20260209$Outbound | AnthropicToolSearchToolBm25$Outbound | AnthropicToolSearchToolRegex$Outbound | BashServerTool$Outbound | DatetimeServerTool$Outbound | ImageGenerationServerToolOpenRouter$Outbound | MessagesSearchModelsServerTool$Outbound | WebFetchServerTool$Outbound | OpenRouterWebSearchServerTool$Outbound | MessagesRequestTool$Outbound> | undefined;
|
|
608
610
|
top_k?: number | undefined;
|
|
609
611
|
top_p?: number | undefined;
|
|
610
612
|
trace?: TraceConfig$Outbound | undefined;
|
|
@@ -12,6 +12,8 @@ import { AnthropicInputTokensTrigger$outboundSchema, } from "./anthropicinputtok
|
|
|
12
12
|
import { AnthropicTextBlockParam$outboundSchema, } from "./anthropictextblockparam.js";
|
|
13
13
|
import { AnthropicThinkingDisplay$outboundSchema, } from "./anthropicthinkingdisplay.js";
|
|
14
14
|
import { AnthropicThinkingTurns$outboundSchema, } from "./anthropicthinkingturns.js";
|
|
15
|
+
import { AnthropicToolSearchToolBm25$outboundSchema, } from "./anthropictoolsearchtoolbm25.js";
|
|
16
|
+
import { AnthropicToolSearchToolRegex$outboundSchema, } from "./anthropictoolsearchtoolregex.js";
|
|
15
17
|
import { AnthropicToolUsesKeep$outboundSchema, } from "./anthropictooluseskeep.js";
|
|
16
18
|
import { AnthropicToolUsesTrigger$outboundSchema, } from "./anthropictoolusestrigger.js";
|
|
17
19
|
import { AnthropicWebSearchToolUserLocation$outboundSchema, } from "./anthropicwebsearchtooluserlocation.js";
|
|
@@ -503,6 +505,8 @@ export const MessagesRequestToolUnion$outboundSchema = z.union([
|
|
|
503
505
|
z.lazy(() => ToolTextEditor20250124$outboundSchema),
|
|
504
506
|
z.lazy(() => ToolWebSearch20250305$outboundSchema),
|
|
505
507
|
z.lazy(() => ToolWebSearch20260209$outboundSchema),
|
|
508
|
+
AnthropicToolSearchToolBm25$outboundSchema,
|
|
509
|
+
AnthropicToolSearchToolRegex$outboundSchema,
|
|
506
510
|
BashServerTool$outboundSchema,
|
|
507
511
|
DatetimeServerTool$outboundSchema,
|
|
508
512
|
ImageGenerationServerToolOpenRouter$outboundSchema,
|
|
@@ -568,6 +572,8 @@ export const MessagesRequest$outboundSchema = z.object({
|
|
|
568
572
|
z.lazy(() => ToolTextEditor20250124$outboundSchema),
|
|
569
573
|
z.lazy(() => ToolWebSearch20250305$outboundSchema),
|
|
570
574
|
z.lazy(() => ToolWebSearch20260209$outboundSchema),
|
|
575
|
+
AnthropicToolSearchToolBm25$outboundSchema,
|
|
576
|
+
AnthropicToolSearchToolRegex$outboundSchema,
|
|
571
577
|
BashServerTool$outboundSchema,
|
|
572
578
|
DatetimeServerTool$outboundSchema,
|
|
573
579
|
ImageGenerationServerToolOpenRouter$outboundSchema,
|
|
@@ -216,7 +216,7 @@ export type ResponsesRequest = {
|
|
|
216
216
|
*/
|
|
217
217
|
sessionId?: string | undefined;
|
|
218
218
|
/**
|
|
219
|
-
* Stop conditions for the server-tool agent loop. Any condition firing halts the loop (OR logic). When set, this overrides `max_tool_calls`.
|
|
219
|
+
* Stop conditions for the server-tool agent loop. Any condition firing halts the loop (OR logic). When set, this overrides `max_tool_calls`. When a condition fires while the model is still emitting tool calls, the pending tool calls are executed and one final turn is made with tool calls disabled so the response ends with a natural-language answer instead of an unfinished tool call.
|
|
220
220
|
*/
|
|
221
221
|
stopServerToolsWhen?: Array<StopServerToolsWhenCondition> | undefined;
|
|
222
222
|
store?: false | undefined;
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
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": "tsc",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
|
-
"
|
|
77
|
-
"test:e2e": "vitest --run --project e2e",
|
|
76
|
+
"test": "vitest --run --project unit",
|
|
78
77
|
"test:transit": "exit 0",
|
|
79
78
|
"test:watch": "vitest --watch --project unit",
|
|
80
|
-
"compile": "tsc",
|
|
81
|
-
"prepare": "npm run build",
|
|
82
|
-
"test": "vitest --run --project unit",
|
|
83
79
|
"typecheck": "tsc --noEmit",
|
|
84
|
-
"
|
|
80
|
+
"prepare": "npm run build",
|
|
81
|
+
"test:e2e": "vitest --run --project e2e",
|
|
82
|
+
"typecheck:transit": "exit 0",
|
|
83
|
+
"compile": "tsc",
|
|
84
|
+
"postinstall": "node scripts/check-types.js || true"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|