@openrouter/sdk 0.12.14 → 0.12.16

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.
Files changed (40) hide show
  1. package/esm/funcs/apiKeysCreate.d.ts +1 -1
  2. package/esm/funcs/apiKeysCreate.js +2 -2
  3. package/esm/funcs/apiKeysList.js +1 -0
  4. package/esm/funcs/guardrailsCreate.d.ts +1 -1
  5. package/esm/funcs/guardrailsCreate.js +2 -2
  6. package/esm/funcs/guardrailsList.js +1 -0
  7. package/esm/funcs/ttsCreateSpeech.d.ts +18 -0
  8. package/esm/funcs/ttsCreateSpeech.js +110 -0
  9. package/esm/lib/config.d.ts +2 -2
  10. package/esm/lib/config.js +2 -2
  11. package/esm/models/createguardrailrequest.d.ts +5 -0
  12. package/esm/models/createguardrailrequest.js +2 -0
  13. package/esm/models/guardrail.d.ts +4 -0
  14. package/esm/models/guardrail.js +2 -0
  15. package/esm/models/operations/createembeddings.d.ts +28 -0
  16. package/esm/models/operations/createembeddings.js +20 -0
  17. package/esm/models/operations/createkeys.d.ts +9 -0
  18. package/esm/models/operations/createkeys.js +4 -0
  19. package/esm/models/operations/createtts.d.ts +779 -0
  20. package/esm/models/operations/createtts.js +193 -0
  21. package/esm/models/operations/getgeneration.d.ts +1 -0
  22. package/esm/models/operations/getgeneration.js +1 -0
  23. package/esm/models/operations/getkey.d.ts +4 -0
  24. package/esm/models/operations/getkey.js +2 -0
  25. package/esm/models/operations/index.d.ts +1 -0
  26. package/esm/models/operations/index.js +1 -0
  27. package/esm/models/operations/list.d.ts +9 -0
  28. package/esm/models/operations/list.js +4 -0
  29. package/esm/models/operations/listguardrails.d.ts +5 -0
  30. package/esm/models/operations/listguardrails.js +2 -0
  31. package/esm/models/operations/updatekeys.d.ts +4 -0
  32. package/esm/models/operations/updatekeys.js +2 -0
  33. package/esm/models/outputmodality.d.ts +1 -0
  34. package/esm/models/outputmodality.js +1 -0
  35. package/esm/sdk/sdk.d.ts +3 -0
  36. package/esm/sdk/sdk.js +4 -0
  37. package/esm/sdk/tts.d.ts +12 -0
  38. package/esm/sdk/tts.js +19 -0
  39. package/jsr.json +1 -1
  40. package/package.json +6 -6
@@ -14,5 +14,5 @@ import { Result } from "../types/fp.js";
14
14
  * @remarks
15
15
  * Create a new API key for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
16
16
  */
17
- export declare function apiKeysCreate(client: OpenRouterCore, request: operations.CreateKeysRequest, options?: RequestOptions): APIPromise<Result<operations.CreateKeysResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
17
+ export declare function apiKeysCreate(client: OpenRouterCore, request: operations.CreateKeysRequest, options?: RequestOptions): APIPromise<Result<operations.CreateKeysResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
18
18
  //# sourceMappingURL=apiKeysCreate.d.ts.map
@@ -76,7 +76,7 @@ async function $do(client, request, options) {
76
76
  const req = requestRes.value;
77
77
  const doResult = await client._do(req, {
78
78
  context,
79
- errorCodes: ["400", "401", "429", "4XX", "500", "5XX"],
79
+ errorCodes: ["400", "401", "403", "429", "4XX", "500", "5XX"],
80
80
  retryConfig: context.retryConfig,
81
81
  retryCodes: context.retryCodes,
82
82
  });
@@ -87,7 +87,7 @@ async function $do(client, request, options) {
87
87
  const responseFields = {
88
88
  HttpMeta: { Response: response, Request: req },
89
89
  };
90
- const [result] = await M.match(M.json(201, operations.CreateKeysResponse$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 });
90
+ const [result] = await M.match(M.json(201, operations.CreateKeysResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors.ForbiddenResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
91
91
  if (!result.ok) {
92
92
  return [result, { status: "complete", request: req, response }];
93
93
  }
@@ -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",
@@ -15,5 +15,5 @@ import { Result } from "../types/fp.js";
15
15
  * @remarks
16
16
  * Create a new guardrail for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
17
17
  */
18
- export declare function guardrailsCreate(client: OpenRouterCore, request: operations.CreateGuardrailRequest, options?: RequestOptions): APIPromise<Result<models.CreateGuardrailResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
18
+ export declare function guardrailsCreate(client: OpenRouterCore, request: operations.CreateGuardrailRequest, options?: RequestOptions): APIPromise<Result<models.CreateGuardrailResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
19
19
  //# sourceMappingURL=guardrailsCreate.d.ts.map
@@ -79,7 +79,7 @@ async function $do(client, request, options) {
79
79
  const req = requestRes.value;
80
80
  const doResult = await client._do(req, {
81
81
  context,
82
- errorCodes: ["400", "401", "4XX", "500", "5XX"],
82
+ errorCodes: ["400", "401", "403", "4XX", "500", "5XX"],
83
83
  retryConfig: context.retryConfig,
84
84
  retryCodes: context.retryCodes,
85
85
  });
@@ -90,7 +90,7 @@ async function $do(client, request, options) {
90
90
  const responseFields = {
91
91
  HttpMeta: { Response: response, Request: req },
92
92
  };
93
- const [result] = await M.match(M.json(201, models.CreateGuardrailResponse$inboundSchema), 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 });
93
+ const [result] = await M.match(M.json(201, models.CreateGuardrailResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors.ForbiddenResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
94
94
  if (!result.ok) {
95
95
  return [result, { status: "complete", request: req, response }];
96
96
  }
@@ -33,6 +33,7 @@ async function $do(client, request, options) {
33
33
  const query = encodeFormQuery({
34
34
  "limit": payload?.limit,
35
35
  "offset": payload?.offset,
36
+ "workspace_id": payload?.workspace_id,
36
37
  });
37
38
  const headers = new Headers(compactMap({
38
39
  Accept: "application/json",
@@ -0,0 +1,18 @@
1
+ import { OpenRouterCore } from "../core.js";
2
+ import { RequestOptions } from "../lib/sdks.js";
3
+ import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
4
+ import * as errors from "../models/errors/index.js";
5
+ import { OpenRouterError } from "../models/errors/openroutererror.js";
6
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
7
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
8
+ import * as operations from "../models/operations/index.js";
9
+ import { APIPromise } from "../types/async.js";
10
+ import { Result } from "../types/fp.js";
11
+ /**
12
+ * Create speech
13
+ *
14
+ * @remarks
15
+ * Synthesizes audio from the input text
16
+ */
17
+ export declare function ttsCreateSpeech(client: OpenRouterCore, request: operations.CreateTtsRequest, options?: RequestOptions): APIPromise<Result<ReadableStream<Uint8Array>, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
18
+ //# sourceMappingURL=ttsCreateSpeech.d.ts.map
@@ -0,0 +1,110 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: ed304f5d6ad8
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import * as errors from "../models/errors/index.js";
13
+ import * as operations from "../models/operations/index.js";
14
+ import { APIPromise } from "../types/async.js";
15
+ /**
16
+ * Create speech
17
+ *
18
+ * @remarks
19
+ * Synthesizes audio from the input text
20
+ */
21
+ export function ttsCreateSpeech(client, request, options) {
22
+ return new APIPromise($do(client, request, options));
23
+ }
24
+ async function $do(client, request, options) {
25
+ const parsed = safeParse(request, (value) => operations.CreateTtsRequest$outboundSchema.parse(value), "Input validation failed");
26
+ if (!parsed.ok) {
27
+ return [parsed, { status: "invalid" }];
28
+ }
29
+ const payload = parsed.value;
30
+ const body = encodeJSON("body", payload.RequestBody, { explode: true });
31
+ const path = pathToFunc("/tts")();
32
+ const headers = new Headers(compactMap({
33
+ "Content-Type": "application/json",
34
+ Accept: "application/octet-stream",
35
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
36
+ "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
37
+ "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
38
+ }));
39
+ const secConfig = await extractSecurity(client._options.apiKey);
40
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
41
+ const requestSecurity = resolveGlobalSecurity(securityInput);
42
+ const context = {
43
+ options: client._options,
44
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
45
+ operationID: "createTts",
46
+ oAuth2Scopes: null,
47
+ resolvedSecurity: requestSecurity,
48
+ securitySource: client._options.apiKey,
49
+ retryConfig: options?.retries
50
+ || client._options.retryConfig
51
+ || {
52
+ strategy: "backoff",
53
+ backoff: {
54
+ initialInterval: 500,
55
+ maxInterval: 60000,
56
+ exponent: 1.5,
57
+ maxElapsedTime: 3600000,
58
+ },
59
+ retryConnectionErrors: true,
60
+ }
61
+ || { strategy: "none" },
62
+ retryCodes: options?.retryCodes || ["5XX"],
63
+ };
64
+ const requestRes = client._createRequest(context, {
65
+ security: requestSecurity,
66
+ method: "POST",
67
+ baseURL: options?.serverURL,
68
+ path: path,
69
+ headers: headers,
70
+ body: body,
71
+ userAgent: client._options.userAgent,
72
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
73
+ }, options);
74
+ if (!requestRes.ok) {
75
+ return [requestRes, { status: "invalid" }];
76
+ }
77
+ const req = requestRes.value;
78
+ const doResult = await client._do(req, {
79
+ context,
80
+ errorCodes: [
81
+ "400",
82
+ "401",
83
+ "402",
84
+ "404",
85
+ "429",
86
+ "4XX",
87
+ "500",
88
+ "502",
89
+ "503",
90
+ "524",
91
+ "529",
92
+ "5XX",
93
+ ],
94
+ retryConfig: context.retryConfig,
95
+ retryCodes: context.retryCodes,
96
+ });
97
+ if (!doResult.ok) {
98
+ return [doResult, { status: "request-error", request: req }];
99
+ }
100
+ const response = doResult.value;
101
+ const responseFields = {
102
+ HttpMeta: { Response: response, Request: req },
103
+ };
104
+ const [result] = await M.match(M.stream(200, z.custom(x => x instanceof ReadableStream)), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(402, errors.PaymentRequiredResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$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 });
105
+ if (!result.ok) {
106
+ return [result, { status: "complete", request: req, response }];
107
+ }
108
+ return [result, { status: "complete", request: req, response }];
109
+ }
110
+ //# sourceMappingURL=ttsCreateSpeech.js.map
@@ -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.14";
52
+ readonly sdkVersion: "0.12.16";
53
53
  readonly genVersion: "2.879.1";
54
- readonly userAgent: "speakeasy-sdk/typescript 0.12.14 2.879.1 1.0.0 @openrouter/sdk";
54
+ readonly userAgent: "speakeasy-sdk/typescript 0.12.16 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.14",
29
+ sdkVersion: "0.12.16",
30
30
  genVersion: "2.879.1",
31
- userAgent: "speakeasy-sdk/typescript 0.12.14 2.879.1 1.0.0 @openrouter/sdk",
31
+ userAgent: "speakeasy-sdk/typescript 0.12.16 2.879.1 1.0.0 @openrouter/sdk",
32
32
  };
33
33
  //# sourceMappingURL=config.js.map
@@ -37,6 +37,10 @@ export type CreateGuardrailRequest = {
37
37
  * Interval at which the limit resets (daily, weekly, monthly)
38
38
  */
39
39
  resetInterval?: GuardrailInterval | null | undefined;
40
+ /**
41
+ * The workspace to create the guardrail in. Defaults to the default workspace if not provided.
42
+ */
43
+ workspaceId?: string | undefined;
40
44
  };
41
45
  /** @internal */
42
46
  export type CreateGuardrailRequest$Outbound = {
@@ -49,6 +53,7 @@ export type CreateGuardrailRequest$Outbound = {
49
53
  limit_usd?: number | null | undefined;
50
54
  name: string;
51
55
  reset_interval?: string | null | undefined;
56
+ workspace_id?: string | undefined;
52
57
  };
53
58
  /** @internal */
54
59
  export declare const CreateGuardrailRequest$outboundSchema: z.ZodType<CreateGuardrailRequest$Outbound, CreateGuardrailRequest>;
@@ -16,6 +16,7 @@ export const CreateGuardrailRequest$outboundSchema = z.object({
16
16
  limitUsd: z.nullable(z.number()).optional(),
17
17
  name: z.string(),
18
18
  resetInterval: z.nullable(GuardrailInterval$outboundSchema).optional(),
19
+ workspaceId: z.string().optional(),
19
20
  }).transform((v) => {
20
21
  return remap$(v, {
21
22
  allowedModels: "allowed_models",
@@ -25,6 +26,7 @@ export const CreateGuardrailRequest$outboundSchema = z.object({
25
26
  ignoredProviders: "ignored_providers",
26
27
  limitUsd: "limit_usd",
27
28
  resetInterval: "reset_interval",
29
+ workspaceId: "workspace_id",
28
30
  });
29
31
  });
30
32
  export function createGuardrailRequestToJSON(createGuardrailRequest) {
@@ -51,6 +51,10 @@ export type Guardrail = {
51
51
  * ISO 8601 timestamp of when the guardrail was last updated
52
52
  */
53
53
  updatedAt?: string | null | undefined;
54
+ /**
55
+ * The workspace ID this guardrail belongs to.
56
+ */
57
+ workspaceId: string;
54
58
  };
55
59
  /** @internal */
56
60
  export declare const Guardrail$inboundSchema: z.ZodType<Guardrail, unknown>;
@@ -20,6 +20,7 @@ export const Guardrail$inboundSchema = z.object({
20
20
  name: z.string(),
21
21
  reset_interval: z.nullable(GuardrailInterval$inboundSchema).optional(),
22
22
  updated_at: z.nullable(z.string()).optional(),
23
+ workspace_id: z.string(),
23
24
  }).transform((v) => {
24
25
  return remap$(v, {
25
26
  "allowed_models": "allowedModels",
@@ -31,6 +32,7 @@ export const Guardrail$inboundSchema = z.object({
31
32
  "limit_usd": "limitUsd",
32
33
  "reset_interval": "resetInterval",
33
34
  "updated_at": "updatedAt",
35
+ "workspace_id": "workspaceId",
34
36
  });
35
37
  });
36
38
  export function guardrailFromJSON(jsonString) {
@@ -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
  });
@@ -60,6 +60,10 @@ export type CreateKeysRequestBody = {
60
60
  * Name for the new API key
61
61
  */
62
62
  name: string;
63
+ /**
64
+ * The workspace to create the API key in. Defaults to the default workspace if not provided.
65
+ */
66
+ workspaceId?: string | undefined;
63
67
  };
64
68
  export type CreateKeysRequest = {
65
69
  /**
@@ -167,6 +171,10 @@ export type CreateKeysData = {
167
171
  * OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)
168
172
  */
169
173
  usageWeekly: number;
174
+ /**
175
+ * The workspace ID this API key belongs to.
176
+ */
177
+ workspaceId: string;
170
178
  };
171
179
  /**
172
180
  * API key created successfully
@@ -191,6 +199,7 @@ export type CreateKeysRequestBody$Outbound = {
191
199
  limit?: number | null | undefined;
192
200
  limit_reset?: string | null | undefined;
193
201
  name: string;
202
+ workspace_id?: string | undefined;
194
203
  };
195
204
  /** @internal */
196
205
  export declare const CreateKeysRequestBody$outboundSchema: z.ZodType<CreateKeysRequestBody$Outbound, CreateKeysRequestBody>;
@@ -24,12 +24,14 @@ export const CreateKeysRequestBody$outboundSchema = z.object({
24
24
  limit: z.nullable(z.number()).optional(),
25
25
  limitReset: z.nullable(CreateKeysLimitReset$outboundSchema).optional(),
26
26
  name: z.string(),
27
+ workspaceId: z.string().optional(),
27
28
  }).transform((v) => {
28
29
  return remap$(v, {
29
30
  creatorUserId: "creator_user_id",
30
31
  expiresAt: "expires_at",
31
32
  includeByokInLimit: "include_byok_in_limit",
32
33
  limitReset: "limit_reset",
34
+ workspaceId: "workspace_id",
33
35
  });
34
36
  });
35
37
  export function createKeysRequestBodyToJSON(createKeysRequestBody) {
@@ -72,6 +74,7 @@ export const CreateKeysData$inboundSchema = z.object({
72
74
  usage_daily: z.number(),
73
75
  usage_monthly: z.number(),
74
76
  usage_weekly: z.number(),
77
+ workspace_id: z.string(),
75
78
  }).transform((v) => {
76
79
  return remap$(v, {
77
80
  "byok_usage": "byokUsage",
@@ -88,6 +91,7 @@ export const CreateKeysData$inboundSchema = z.object({
88
91
  "usage_daily": "usageDaily",
89
92
  "usage_monthly": "usageMonthly",
90
93
  "usage_weekly": "usageWeekly",
94
+ "workspace_id": "workspaceId",
91
95
  });
92
96
  });
93
97
  export function createKeysDataFromJSON(jsonString) {