@openrouter/sdk 0.13.50 → 0.13.51

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.
@@ -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: "0.13.50";
52
+ readonly sdkVersion: "0.13.51";
53
53
  readonly genVersion: "2.884.4";
54
- readonly userAgent: "speakeasy-sdk/typescript 0.13.50 2.884.4 1.0.0 @openrouter/sdk";
54
+ readonly userAgent: "speakeasy-sdk/typescript 0.13.51 2.884.4 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: "0.13.50",
29
+ sdkVersion: "0.13.51",
30
30
  genVersion: "2.884.4",
31
- userAgent: "speakeasy-sdk/typescript 0.13.50 2.884.4 1.0.0 @openrouter/sdk",
31
+ userAgent: "speakeasy-sdk/typescript 0.13.51 2.884.4 1.0.0 @openrouter/sdk",
32
32
  };
33
33
  //# sourceMappingURL=config.js.map
@@ -2,6 +2,7 @@ import * as z from "zod/v4";
2
2
  import { Result as SafeParseResult } from "../types/fp.js";
3
3
  import { CostDetails } from "./costdetails.js";
4
4
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
5
+ import { ServerToolUseDetails } from "./servertoolusedetails.js";
5
6
  /**
6
7
  * Detailed completion token usage
7
8
  */
@@ -44,23 +45,6 @@ export type ChatUsagePromptTokensDetails = {
44
45
  */
45
46
  videoTokens?: number | undefined;
46
47
  };
47
- /**
48
- * Usage for server-side tool execution (e.g., web search)
49
- */
50
- export type ServerToolUseDetails = {
51
- /**
52
- * Number of OpenRouter server tool calls that executed and produced a result
53
- */
54
- toolCallsExecuted?: number | null | undefined;
55
- /**
56
- * Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.
57
- */
58
- toolCallsRequested?: number | null | undefined;
59
- /**
60
- * Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.
61
- */
62
- webSearchRequests?: number | null | undefined;
63
- };
64
48
  /**
65
49
  * Token usage statistics
66
50
  */
@@ -109,9 +93,6 @@ export declare function chatUsageCompletionTokensDetailsFromJSON(jsonString: str
109
93
  export declare const ChatUsagePromptTokensDetails$inboundSchema: z.ZodType<ChatUsagePromptTokensDetails, unknown>;
110
94
  export declare function chatUsagePromptTokensDetailsFromJSON(jsonString: string): SafeParseResult<ChatUsagePromptTokensDetails, SDKValidationError>;
111
95
  /** @internal */
112
- export declare const ServerToolUseDetails$inboundSchema: z.ZodType<ServerToolUseDetails, unknown>;
113
- export declare function serverToolUseDetailsFromJSON(jsonString: string): SafeParseResult<ServerToolUseDetails, SDKValidationError>;
114
- /** @internal */
115
96
  export declare const ChatUsage$inboundSchema: z.ZodType<ChatUsage, unknown>;
116
97
  export declare function chatUsageFromJSON(jsonString: string): SafeParseResult<ChatUsage, SDKValidationError>;
117
98
  //# sourceMappingURL=chatusage.d.ts.map
@@ -6,6 +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 { CostDetails$inboundSchema } from "./costdetails.js";
9
+ import { ServerToolUseDetails$inboundSchema, } from "./servertoolusedetails.js";
9
10
  /** @internal */
10
11
  export const ChatUsageCompletionTokensDetails$inboundSchema = z.object({
11
12
  accepted_prediction_tokens: z.nullable(z.int()).optional(),
@@ -41,21 +42,6 @@ export function chatUsagePromptTokensDetailsFromJSON(jsonString) {
41
42
  return safeParse(jsonString, (x) => ChatUsagePromptTokensDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatUsagePromptTokensDetails' from JSON`);
42
43
  }
43
44
  /** @internal */
44
- export const ServerToolUseDetails$inboundSchema = z.object({
45
- tool_calls_executed: z.nullable(z.int()).optional(),
46
- tool_calls_requested: z.nullable(z.int()).optional(),
47
- web_search_requests: z.nullable(z.int()).optional(),
48
- }).transform((v) => {
49
- return remap$(v, {
50
- "tool_calls_executed": "toolCallsExecuted",
51
- "tool_calls_requested": "toolCallsRequested",
52
- "web_search_requests": "webSearchRequests",
53
- });
54
- });
55
- export function serverToolUseDetailsFromJSON(jsonString) {
56
- return safeParse(jsonString, (x) => ServerToolUseDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ServerToolUseDetails' from JSON`);
57
- }
58
- /** @internal */
59
45
  export const ChatUsage$inboundSchema = z.object({
60
46
  completion_tokens: z.int(),
61
47
  completion_tokens_details: z.nullable(z.lazy(() => ChatUsageCompletionTokensDetails$inboundSchema)).optional(),
@@ -64,7 +50,8 @@ export const ChatUsage$inboundSchema = z.object({
64
50
  is_byok: z.boolean().optional(),
65
51
  prompt_tokens: z.int(),
66
52
  prompt_tokens_details: z.nullable(z.lazy(() => ChatUsagePromptTokensDetails$inboundSchema)).optional(),
67
- server_tool_use_details: z.nullable(z.lazy(() => ServerToolUseDetails$inboundSchema)).optional(),
53
+ server_tool_use_details: z.nullable(ServerToolUseDetails$inboundSchema)
54
+ .optional(),
68
55
  total_tokens: z.int(),
69
56
  }).transform((v) => {
70
57
  return remap$(v, {
@@ -458,6 +458,7 @@ export * from "./searchmodelsservertoolconfig.js";
458
458
  export * from "./searchmodelsservertoolopenrouter.js";
459
459
  export * from "./searchqualitylevel.js";
460
460
  export * from "./security.js";
461
+ export * from "./servertoolusedetails.js";
461
462
  export * from "./serviceunavailableresponseerrordata.js";
462
463
  export * from "./shellcallitem.js";
463
464
  export * from "./shellcalloutputitem.js";
@@ -462,6 +462,7 @@ export * from "./searchmodelsservertoolconfig.js";
462
462
  export * from "./searchmodelsservertoolopenrouter.js";
463
463
  export * from "./searchqualitylevel.js";
464
464
  export * from "./security.js";
465
+ export * from "./servertoolusedetails.js";
465
466
  export * from "./serviceunavailableresponseerrordata.js";
466
467
  export * from "./shellcallitem.js";
467
468
  export * from "./shellcalloutputitem.js";
@@ -0,0 +1,24 @@
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
+ * Usage for server-side tool execution (e.g., web search)
6
+ */
7
+ export type ServerToolUseDetails = {
8
+ /**
9
+ * Number of OpenRouter server tool calls that executed and produced a result.
10
+ */
11
+ toolCallsExecuted?: number | null | undefined;
12
+ /**
13
+ * Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here.
14
+ */
15
+ toolCallsRequested?: number | null | undefined;
16
+ /**
17
+ * Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two.
18
+ */
19
+ webSearchRequests?: number | null | undefined;
20
+ };
21
+ /** @internal */
22
+ export declare const ServerToolUseDetails$inboundSchema: z.ZodType<ServerToolUseDetails, unknown>;
23
+ export declare function serverToolUseDetailsFromJSON(jsonString: string): SafeParseResult<ServerToolUseDetails, SDKValidationError>;
24
+ //# sourceMappingURL=servertoolusedetails.d.ts.map
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 5d4b052ad0ed
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
+ /** @internal */
9
+ export const ServerToolUseDetails$inboundSchema = z.object({
10
+ tool_calls_executed: z.nullable(z.int()).optional(),
11
+ tool_calls_requested: z.nullable(z.int()).optional(),
12
+ web_search_requests: z.nullable(z.int()).optional(),
13
+ }).transform((v) => {
14
+ return remap$(v, {
15
+ "tool_calls_executed": "toolCallsExecuted",
16
+ "tool_calls_requested": "toolCallsRequested",
17
+ "web_search_requests": "webSearchRequests",
18
+ });
19
+ });
20
+ export function serverToolUseDetailsFromJSON(jsonString) {
21
+ return safeParse(jsonString, (x) => ServerToolUseDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ServerToolUseDetails' from JSON`);
22
+ }
23
+ //# sourceMappingURL=servertoolusedetails.js.map
@@ -1,6 +1,7 @@
1
1
  import * as z from "zod/v4";
2
2
  import { Result as SafeParseResult } from "../types/fp.js";
3
3
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
+ import { ServerToolUseDetails } from "./servertoolusedetails.js";
4
5
  export type InputTokensDetails = {
5
6
  cacheWriteTokens?: number | null | undefined;
6
7
  cachedTokens: number;
@@ -31,6 +32,10 @@ export type Usage = {
31
32
  * Whether a request was made using a Bring Your Own Key configuration
32
33
  */
33
34
  isByok?: boolean | undefined;
35
+ /**
36
+ * Usage for server-side tool execution (e.g., web search)
37
+ */
38
+ serverToolUseDetails?: ServerToolUseDetails | null | undefined;
34
39
  };
35
40
  /** @internal */
36
41
  export declare const InputTokensDetails$inboundSchema: z.ZodType<InputTokensDetails, unknown>;
@@ -5,6 +5,7 @@
5
5
  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
+ import { ServerToolUseDetails$inboundSchema, } from "./servertoolusedetails.js";
8
9
  /** @internal */
9
10
  export const InputTokensDetails$inboundSchema = z.object({
10
11
  cache_write_tokens: z.nullable(z.int()).optional(),
@@ -54,6 +55,8 @@ export const Usage$inboundSchema = z.object({
54
55
  cost: z.nullable(z.number()).optional(),
55
56
  cost_details: z.lazy(() => UsageCostDetails$inboundSchema).optional(),
56
57
  is_byok: z.boolean().optional(),
58
+ server_tool_use_details: z.nullable(ServerToolUseDetails$inboundSchema)
59
+ .optional(),
57
60
  }).transform((v) => {
58
61
  return remap$(v, {
59
62
  "input_tokens": "inputTokens",
@@ -63,6 +66,7 @@ export const Usage$inboundSchema = z.object({
63
66
  "total_tokens": "totalTokens",
64
67
  "cost_details": "costDetails",
65
68
  "is_byok": "isByok",
69
+ "server_tool_use_details": "serverToolUseDetails",
66
70
  });
67
71
  });
68
72
  export function usageFromJSON(jsonString) {
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "0.13.50",
5
+ "version": "0.13.51",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openrouter/sdk",
3
- "version": "0.13.50",
3
+ "version": "0.13.51",
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
- "provenance": true,
25
- "access": "public"
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",
75
75
  "prepublishOnly": "npm run build",
76
+ "typecheck:transit": "exit 0",
77
+ "compile": "tsc",
78
+ "postinstall": "node scripts/check-types.js || true",
79
+ "test:watch": "vitest --watch --project unit",
76
80
  "prepare": "npm run build",
77
81
  "test": "vitest --run --project unit",
78
82
  "test:e2e": "vitest --run --project e2e",
79
83
  "test:transit": "exit 0",
80
- "test:watch": "vitest --watch --project unit",
81
- "typecheck": "tsc --noEmit",
82
- "typecheck:transit": "exit 0",
83
- "compile": "tsc",
84
- "postinstall": "node scripts/check-types.js || true"
84
+ "typecheck": "tsc --noEmit"
85
85
  },
86
86
  "peerDependencies": {},
87
87
  "devDependencies": {