@openrouter/sdk 0.12.13 → 0.12.15

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.
@@ -31,6 +31,7 @@ async function $do(client, request, options) {
31
31
  const query = encodeFormQuery({
32
32
  "include_disabled": payload?.include_disabled,
33
33
  "offset": payload?.offset,
34
+ "workspace_id": payload?.workspace_id,
34
35
  });
35
36
  const headers = new Headers(compactMap({
36
37
  Accept: "application/json",
@@ -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.12.13";
52
+ readonly sdkVersion: "0.12.15";
53
53
  readonly genVersion: "2.879.1";
54
- readonly userAgent: "speakeasy-sdk/typescript 0.12.13 2.879.1 1.0.0 @openrouter/sdk";
54
+ readonly userAgent: "speakeasy-sdk/typescript 0.12.15 2.879.1 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.12.13",
29
+ sdkVersion: "0.12.15",
30
30
  genVersion: "2.879.1",
31
- userAgent: "speakeasy-sdk/typescript 0.12.13 2.879.1 1.0.0 @openrouter/sdk",
31
+ userAgent: "speakeasy-sdk/typescript 0.12.15 2.879.1 1.0.0 @openrouter/sdk",
32
32
  };
33
33
  //# sourceMappingURL=config.js.map
@@ -5,7 +5,7 @@ import { ImageGenerationServerToolConfigUnion } from "./imagegenerationservertoo
5
5
  */
6
6
  export type ImageGenerationServerToolConfig = {
7
7
  /**
8
- * Which image generation model to use (e.g. "openai/gpt-image-1"). Defaults to "openai/gpt-image-1".
8
+ * Which image generation model to use (e.g. "openai/gpt-5-image"). Defaults to "openai/gpt-5-image".
9
9
  */
10
10
  model?: string | undefined;
11
11
  additionalProperties?: {
@@ -132,6 +132,27 @@ export declare const ObjectT: {
132
132
  readonly List: "list";
133
133
  };
134
134
  export type ObjectT = ClosedEnum<typeof ObjectT>;
135
+ /**
136
+ * Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.
137
+ */
138
+ export type PromptTokensDetails = {
139
+ /**
140
+ * Number of audio tokens in the input
141
+ */
142
+ audioTokens?: number | undefined;
143
+ /**
144
+ * Number of image tokens in the input
145
+ */
146
+ imageTokens?: number | undefined;
147
+ /**
148
+ * Number of text tokens in the input
149
+ */
150
+ textTokens?: number | undefined;
151
+ /**
152
+ * Number of video tokens in the input
153
+ */
154
+ videoTokens?: number | undefined;
155
+ };
135
156
  /**
136
157
  * Token usage statistics
137
158
  */
@@ -144,6 +165,10 @@ export type CreateEmbeddingsUsage = {
144
165
  * Number of tokens in the input
145
166
  */
146
167
  promptTokens: number;
168
+ /**
169
+ * Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included.
170
+ */
171
+ promptTokensDetails?: PromptTokensDetails | undefined;
147
172
  /**
148
173
  * Total number of tokens used
149
174
  */
@@ -248,6 +273,9 @@ export declare function createEmbeddingsDataFromJSON(jsonString: string): SafePa
248
273
  /** @internal */
249
274
  export declare const ObjectT$inboundSchema: z.ZodEnum<typeof ObjectT>;
250
275
  /** @internal */
276
+ export declare const PromptTokensDetails$inboundSchema: z.ZodType<PromptTokensDetails, unknown>;
277
+ export declare function promptTokensDetailsFromJSON(jsonString: string): SafeParseResult<PromptTokensDetails, SDKValidationError>;
278
+ /** @internal */
251
279
  export declare const CreateEmbeddingsUsage$inboundSchema: z.ZodType<CreateEmbeddingsUsage, unknown>;
252
280
  export declare function createEmbeddingsUsageFromJSON(jsonString: string): SafeParseResult<CreateEmbeddingsUsage, SDKValidationError>;
253
281
  /** @internal */
@@ -141,13 +141,33 @@ export function createEmbeddingsDataFromJSON(jsonString) {
141
141
  /** @internal */
142
142
  export const ObjectT$inboundSchema = z.enum(ObjectT);
143
143
  /** @internal */
144
+ export const PromptTokensDetails$inboundSchema = z.object({
145
+ audio_tokens: z.int().optional(),
146
+ image_tokens: z.int().optional(),
147
+ text_tokens: z.int().optional(),
148
+ video_tokens: z.int().optional(),
149
+ }).transform((v) => {
150
+ return remap$(v, {
151
+ "audio_tokens": "audioTokens",
152
+ "image_tokens": "imageTokens",
153
+ "text_tokens": "textTokens",
154
+ "video_tokens": "videoTokens",
155
+ });
156
+ });
157
+ export function promptTokensDetailsFromJSON(jsonString) {
158
+ return safeParse(jsonString, (x) => PromptTokensDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PromptTokensDetails' from JSON`);
159
+ }
160
+ /** @internal */
144
161
  export const CreateEmbeddingsUsage$inboundSchema = z.object({
145
162
  cost: z.number().optional(),
146
163
  prompt_tokens: z.int(),
164
+ prompt_tokens_details: z.lazy(() => PromptTokensDetails$inboundSchema)
165
+ .optional(),
147
166
  total_tokens: z.int(),
148
167
  }).transform((v) => {
149
168
  return remap$(v, {
150
169
  "prompt_tokens": "promptTokens",
170
+ "prompt_tokens_details": "promptTokensDetails",
151
171
  "total_tokens": "totalTokens",
152
172
  });
153
173
  });
@@ -167,6 +167,10 @@ export type CreateKeysData = {
167
167
  * OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)
168
168
  */
169
169
  usageWeekly: number;
170
+ /**
171
+ * The workspace ID this API key belongs to.
172
+ */
173
+ workspaceId: string;
170
174
  };
171
175
  /**
172
176
  * API key created successfully
@@ -72,6 +72,7 @@ export const CreateKeysData$inboundSchema = z.object({
72
72
  usage_daily: z.number(),
73
73
  usage_monthly: z.number(),
74
74
  usage_weekly: z.number(),
75
+ workspace_id: z.string(),
75
76
  }).transform((v) => {
76
77
  return remap$(v, {
77
78
  "byok_usage": "byokUsage",
@@ -88,6 +89,7 @@ export const CreateKeysData$inboundSchema = z.object({
88
89
  "usage_daily": "usageDaily",
89
90
  "usage_monthly": "usageMonthly",
90
91
  "usage_weekly": "usageWeekly",
92
+ "workspace_id": "workspaceId",
91
93
  });
92
94
  });
93
95
  export function createKeysDataFromJSON(jsonString) {
@@ -56,6 +56,7 @@ export declare const ApiType: {
56
56
  readonly Completions: "completions";
57
57
  readonly Embeddings: "embeddings";
58
58
  readonly Rerank: "rerank";
59
+ readonly Tts: "tts";
59
60
  readonly Video: "video";
60
61
  };
61
62
  /**
@@ -14,6 +14,7 @@ export const ApiType = {
14
14
  Completions: "completions",
15
15
  Embeddings: "embeddings",
16
16
  Rerank: "rerank",
17
+ Tts: "tts",
17
18
  Video: "video",
18
19
  };
19
20
  /** @internal */
@@ -131,6 +131,10 @@ export type GetKeyData = {
131
131
  * OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)
132
132
  */
133
133
  usageWeekly: number;
134
+ /**
135
+ * The workspace ID this API key belongs to.
136
+ */
137
+ workspaceId: string;
134
138
  };
135
139
  /**
136
140
  * API key details
@@ -42,6 +42,7 @@ export const GetKeyData$inboundSchema = z
42
42
  usage_daily: z.number(),
43
43
  usage_monthly: z.number(),
44
44
  usage_weekly: z.number(),
45
+ workspace_id: z.string(),
45
46
  }).transform((v) => {
46
47
  return remap$(v, {
47
48
  "byok_usage": "byokUsage",
@@ -58,6 +59,7 @@ export const GetKeyData$inboundSchema = z
58
59
  "usage_daily": "usageDaily",
59
60
  "usage_monthly": "usageMonthly",
60
61
  "usage_weekly": "usageWeekly",
62
+ "workspace_id": "workspaceId",
61
63
  });
62
64
  });
63
65
  export function getKeyDataFromJSON(jsonString) {
@@ -50,6 +50,10 @@ export type ListRequest = {
50
50
  * Number of API keys to skip for pagination
51
51
  */
52
52
  offset?: number | null | undefined;
53
+ /**
54
+ * Filter API keys by workspace ID. By default, keys in the default workspace are returned.
55
+ */
56
+ workspaceId?: string | undefined;
53
57
  };
54
58
  export type ListData = {
55
59
  /**
@@ -132,6 +136,10 @@ export type ListData = {
132
136
  * OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)
133
137
  */
134
138
  usageWeekly: number;
139
+ /**
140
+ * The workspace ID this API key belongs to.
141
+ */
142
+ workspaceId: string;
135
143
  };
136
144
  /**
137
145
  * List of API keys
@@ -149,6 +157,7 @@ export type ListRequest$Outbound = {
149
157
  appCategories?: string | undefined;
150
158
  include_disabled?: boolean | undefined;
151
159
  offset?: number | null | undefined;
160
+ workspace_id?: string | undefined;
152
161
  };
153
162
  /** @internal */
154
163
  export declare const ListRequest$outboundSchema: z.ZodType<ListRequest$Outbound, ListRequest>;
@@ -12,10 +12,12 @@ export const ListRequest$outboundSchema = z.object({
12
12
  appCategories: z.string().optional(),
13
13
  includeDisabled: z.boolean().optional(),
14
14
  offset: z.nullable(z.int()).optional(),
15
+ workspaceId: z.string().optional(),
15
16
  }).transform((v) => {
16
17
  return remap$(v, {
17
18
  httpReferer: "HTTP-Referer",
18
19
  includeDisabled: "include_disabled",
20
+ workspaceId: "workspace_id",
19
21
  });
20
22
  });
21
23
  export function listRequestToJSON(listRequest) {
@@ -43,6 +45,7 @@ export const ListData$inboundSchema = z.object({
43
45
  usage_daily: z.number(),
44
46
  usage_monthly: z.number(),
45
47
  usage_weekly: z.number(),
48
+ workspace_id: z.string(),
46
49
  }).transform((v) => {
47
50
  return remap$(v, {
48
51
  "byok_usage": "byokUsage",
@@ -59,6 +62,7 @@ export const ListData$inboundSchema = z.object({
59
62
  "usage_daily": "usageDaily",
60
63
  "usage_monthly": "usageMonthly",
61
64
  "usage_weekly": "usageWeekly",
65
+ "workspace_id": "workspaceId",
62
66
  });
63
67
  });
64
68
  export function listDataFromJSON(jsonString) {
@@ -167,6 +167,10 @@ export type UpdateKeysData = {
167
167
  * OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)
168
168
  */
169
169
  usageWeekly: number;
170
+ /**
171
+ * The workspace ID this API key belongs to.
172
+ */
173
+ workspaceId: string;
170
174
  };
171
175
  /**
172
176
  * API key updated successfully
@@ -70,6 +70,7 @@ export const UpdateKeysData$inboundSchema = z.object({
70
70
  usage_daily: z.number(),
71
71
  usage_monthly: z.number(),
72
72
  usage_weekly: z.number(),
73
+ workspace_id: z.string(),
73
74
  }).transform((v) => {
74
75
  return remap$(v, {
75
76
  "byok_usage": "byokUsage",
@@ -86,6 +87,7 @@ export const UpdateKeysData$inboundSchema = z.object({
86
87
  "usage_daily": "usageDaily",
87
88
  "usage_monthly": "usageMonthly",
88
89
  "usage_weekly": "usageWeekly",
90
+ "workspace_id": "workspaceId",
89
91
  });
90
92
  });
91
93
  export function updateKeysDataFromJSON(jsonString) {
@@ -9,6 +9,10 @@ export type OutputImageGenerationServerToolItem = {
9
9
  id?: string | undefined;
10
10
  imageB64?: string | undefined;
11
11
  imageUrl?: string | undefined;
12
+ /**
13
+ * The generated image as a base64-encoded string or URL, matching OpenAI image_generation_call format
14
+ */
15
+ result?: string | null | undefined;
12
16
  revisedPrompt?: string | undefined;
13
17
  status: ToolCallStatus;
14
18
  type: "openrouter:image_generation";
@@ -10,6 +10,7 @@ export const OutputImageGenerationServerToolItem$inboundSchema = z.object({
10
10
  id: z.string().optional(),
11
11
  imageB64: z.string().optional(),
12
12
  imageUrl: z.string().optional(),
13
+ result: z.nullable(z.string()).optional(),
13
14
  revisedPrompt: z.string().optional(),
14
15
  status: ToolCallStatus$inboundSchema,
15
16
  type: z.literal("openrouter:image_generation"),
@@ -7,6 +7,7 @@ export declare const OutputModality: {
7
7
  readonly Audio: "audio";
8
8
  readonly Video: "video";
9
9
  readonly Rerank: "rerank";
10
+ readonly Tts: "tts";
10
11
  };
11
12
  export type OutputModality = OpenEnum<typeof OutputModality>;
12
13
  /** @internal */
@@ -10,6 +10,7 @@ export const OutputModality = {
10
10
  Audio: "audio",
11
11
  Video: "video",
12
12
  Rerank: "rerank",
13
+ Tts: "tts",
13
14
  };
14
15
  /** @internal */
15
16
  export const OutputModality$inboundSchema = openEnums.inboundSchema(OutputModality);
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "0.12.13",
5
+ "version": "0.12.15",
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.12.13",
3
+ "version": "0.12.15",
4
4
  "author": "OpenRouter",
5
5
  "description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 300+ language models through a unified API.",
6
6
  "keywords": [
@@ -69,15 +69,15 @@
69
69
  "lint": "eslint --cache --max-warnings=0 src",
70
70
  "build": "tsc",
71
71
  "prepublishOnly": "npm run build",
72
- "test": "vitest --run --project unit",
73
- "test:e2e": "vitest --run --project e2e",
74
- "test:transit": "exit 0",
75
- "typecheck:transit": "exit 0",
72
+ "compile": "tsc",
76
73
  "postinstall": "node scripts/check-types.js || true",
74
+ "prepare": "npm run build",
77
75
  "test:watch": "vitest --watch --project unit",
78
76
  "typecheck": "tsc --noEmit",
79
- "compile": "tsc",
80
- "prepare": "npm run build"
77
+ "typecheck:transit": "exit 0",
78
+ "test": "vitest --run --project unit",
79
+ "test:e2e": "vitest --run --project e2e",
80
+ "test:transit": "exit 0"
81
81
  },
82
82
  "peerDependencies": {},
83
83
  "devDependencies": {