@openrouter/sdk 0.4.0 → 0.8.0

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 (200) hide show
  1. package/FUNCTIONS.md +5 -1
  2. package/esm/funcs/analyticsGetUserActivity.d.ts +1 -1
  3. package/esm/funcs/analyticsGetUserActivity.js +4 -2
  4. package/esm/funcs/apiKeysCreate.d.ts +1 -1
  5. package/esm/funcs/apiKeysCreate.js +5 -3
  6. package/esm/funcs/apiKeysDelete.d.ts +1 -1
  7. package/esm/funcs/apiKeysDelete.js +3 -1
  8. package/esm/funcs/apiKeysGet.d.ts +1 -1
  9. package/esm/funcs/apiKeysGet.js +3 -1
  10. package/esm/funcs/apiKeysGetCurrentKeyMetadata.d.ts +1 -1
  11. package/esm/funcs/apiKeysGetCurrentKeyMetadata.js +14 -3
  12. package/esm/funcs/apiKeysList.d.ts +1 -1
  13. package/esm/funcs/apiKeysList.js +4 -2
  14. package/esm/funcs/apiKeysUpdate.d.ts +1 -1
  15. package/esm/funcs/apiKeysUpdate.js +3 -1
  16. package/esm/funcs/betaResponsesSend.d.ts +9 -5
  17. package/esm/funcs/betaResponsesSend.js +10 -5
  18. package/esm/funcs/chatSend.d.ts +9 -5
  19. package/esm/funcs/chatSend.js +10 -5
  20. package/esm/funcs/creditsCreateCoinbaseCharge.d.ts +1 -2
  21. package/esm/funcs/creditsCreateCoinbaseCharge.js +7 -4
  22. package/esm/funcs/creditsGetCredits.d.ts +2 -2
  23. package/esm/funcs/creditsGetCredits.js +15 -4
  24. package/esm/funcs/embeddingsGenerate.js +4 -2
  25. package/esm/funcs/embeddingsListModels.d.ts +2 -1
  26. package/esm/funcs/embeddingsListModels.js +15 -3
  27. package/esm/funcs/endpointsList.js +2 -0
  28. package/esm/funcs/endpointsListZdrEndpoints.d.ts +1 -1
  29. package/esm/funcs/endpointsListZdrEndpoints.js +14 -3
  30. package/esm/funcs/generationsGetGeneration.js +3 -1
  31. package/esm/funcs/guardrailsBulkAssignKeys.d.ts +1 -1
  32. package/esm/funcs/guardrailsBulkAssignKeys.js +3 -1
  33. package/esm/funcs/guardrailsBulkAssignMembers.d.ts +1 -1
  34. package/esm/funcs/guardrailsBulkAssignMembers.js +3 -1
  35. package/esm/funcs/guardrailsBulkUnassignKeys.d.ts +1 -1
  36. package/esm/funcs/guardrailsBulkUnassignKeys.js +3 -1
  37. package/esm/funcs/guardrailsBulkUnassignMembers.d.ts +1 -1
  38. package/esm/funcs/guardrailsBulkUnassignMembers.js +3 -1
  39. package/esm/funcs/guardrailsCreate.d.ts +1 -1
  40. package/esm/funcs/guardrailsCreate.js +5 -3
  41. package/esm/funcs/guardrailsDelete.d.ts +1 -1
  42. package/esm/funcs/guardrailsDelete.js +3 -1
  43. package/esm/funcs/guardrailsGet.d.ts +1 -1
  44. package/esm/funcs/guardrailsGet.js +3 -1
  45. package/esm/funcs/guardrailsList.d.ts +1 -1
  46. package/esm/funcs/guardrailsList.js +4 -2
  47. package/esm/funcs/guardrailsListGuardrailKeyAssignments.d.ts +1 -1
  48. package/esm/funcs/guardrailsListGuardrailKeyAssignments.js +3 -1
  49. package/esm/funcs/guardrailsListGuardrailMemberAssignments.d.ts +1 -1
  50. package/esm/funcs/guardrailsListGuardrailMemberAssignments.js +3 -1
  51. package/esm/funcs/guardrailsListKeyAssignments.d.ts +1 -1
  52. package/esm/funcs/guardrailsListKeyAssignments.js +4 -2
  53. package/esm/funcs/guardrailsListMemberAssignments.d.ts +1 -1
  54. package/esm/funcs/guardrailsListMemberAssignments.js +4 -2
  55. package/esm/funcs/guardrailsUpdate.d.ts +1 -1
  56. package/esm/funcs/guardrailsUpdate.js +3 -1
  57. package/esm/funcs/modelsCount.d.ts +2 -1
  58. package/esm/funcs/modelsCount.js +15 -3
  59. package/esm/funcs/modelsList.js +3 -1
  60. package/esm/funcs/modelsListForUser.d.ts +1 -1
  61. package/esm/funcs/modelsListForUser.js +15 -3
  62. package/esm/funcs/oAuthCreateAuthCode.js +4 -2
  63. package/esm/funcs/oAuthExchangeAuthCodeForAPIKey.js +4 -2
  64. package/esm/funcs/providersList.d.ts +1 -1
  65. package/esm/funcs/providersList.js +14 -3
  66. package/esm/lib/config.d.ts +8 -2
  67. package/esm/lib/config.js +2 -2
  68. package/esm/lib/model-result.d.ts +7 -8
  69. package/esm/lib/model-result.js +155 -44
  70. package/esm/lib/sdks.d.ts +1 -1
  71. package/esm/lib/sdks.js +28 -8
  72. package/esm/lib/stream-transformers.js +7 -7
  73. package/esm/lib/stream-type-guards.d.ts +1 -1
  74. package/esm/lib/stream-type-guards.js +1 -1
  75. package/esm/lib/tool-executor.js +11 -14
  76. package/esm/lib/tool-orchestrator.js +2 -2
  77. package/esm/lib/tool-types.d.ts +1 -1
  78. package/esm/models/assistantmessage.d.ts +3 -3
  79. package/esm/models/assistantmessage.js +3 -3
  80. package/esm/models/chatgenerationparams.d.ts +43 -234
  81. package/esm/models/chatgenerationparams.js +32 -159
  82. package/esm/models/chatstreamingmessagechunk.d.ts +2 -2
  83. package/esm/models/chatstreamingmessagechunk.js +2 -2
  84. package/esm/models/developermessage.d.ts +23 -0
  85. package/esm/models/developermessage.js +24 -0
  86. package/esm/models/index.d.ts +6 -2
  87. package/esm/models/index.js +6 -2
  88. package/esm/models/message.d.ts +3 -23
  89. package/esm/models/message.js +2 -19
  90. package/esm/models/openresponsesrequest.d.ts +33 -45
  91. package/esm/models/openresponsesrequest.js +36 -36
  92. package/esm/models/operations/bulkassignkeystoguardrail.d.ts +30 -0
  93. package/esm/models/operations/bulkassignkeystoguardrail.js +4 -0
  94. package/esm/models/operations/bulkassignmemberstoguardrail.d.ts +30 -0
  95. package/esm/models/operations/bulkassignmemberstoguardrail.js +4 -0
  96. package/esm/models/operations/bulkunassignkeysfromguardrail.d.ts +30 -0
  97. package/esm/models/operations/bulkunassignkeysfromguardrail.js +4 -0
  98. package/esm/models/operations/bulkunassignmembersfromguardrail.d.ts +30 -0
  99. package/esm/models/operations/bulkunassignmembersfromguardrail.js +4 -0
  100. package/esm/models/operations/createauthkeyscode.d.ts +42 -2
  101. package/esm/models/operations/createauthkeyscode.js +16 -1
  102. package/esm/models/operations/createcoinbasecharge.d.ts +41 -0
  103. package/esm/models/operations/createcoinbasecharge.js +16 -0
  104. package/esm/models/operations/createembeddings.d.ts +42 -2
  105. package/esm/models/operations/createembeddings.js +16 -1
  106. package/esm/models/operations/createguardrail.d.ts +42 -2
  107. package/esm/models/operations/createguardrail.js +16 -1
  108. package/esm/models/operations/createkeys.d.ts +42 -2
  109. package/esm/models/operations/createkeys.js +16 -1
  110. package/esm/models/operations/createresponses.d.ts +40 -0
  111. package/esm/models/operations/createresponses.js +16 -0
  112. package/esm/models/operations/deleteguardrail.d.ts +30 -0
  113. package/esm/models/operations/deleteguardrail.js +8 -0
  114. package/esm/models/operations/deletekeys.d.ts +30 -0
  115. package/esm/models/operations/deletekeys.js +8 -0
  116. package/esm/models/operations/exchangeauthcodeforapikey.d.ts +42 -2
  117. package/esm/models/operations/exchangeauthcodeforapikey.js +16 -1
  118. package/esm/models/operations/getcredits.d.ts +38 -0
  119. package/esm/models/operations/getcredits.js +13 -0
  120. package/esm/models/operations/getcurrentkey.d.ts +45 -1
  121. package/esm/models/operations/getcurrentkey.js +15 -0
  122. package/esm/models/operations/getgeneration.d.ts +151 -0
  123. package/esm/models/operations/getgeneration.js +133 -0
  124. package/esm/models/operations/getguardrail.d.ts +30 -0
  125. package/esm/models/operations/getguardrail.js +7 -0
  126. package/esm/models/operations/getkey.d.ts +30 -0
  127. package/esm/models/operations/getkey.js +7 -0
  128. package/esm/models/operations/getmodels.d.ts +30 -0
  129. package/esm/models/operations/getmodels.js +4 -0
  130. package/esm/models/operations/getuseractivity.d.ts +30 -0
  131. package/esm/models/operations/getuseractivity.js +8 -0
  132. package/esm/models/operations/index.d.ts +2 -0
  133. package/esm/models/operations/index.js +2 -0
  134. package/esm/models/operations/list.d.ts +30 -0
  135. package/esm/models/operations/list.js +4 -0
  136. package/esm/models/operations/listembeddingsmodels.d.ts +40 -0
  137. package/esm/models/operations/listembeddingsmodels.js +20 -0
  138. package/esm/models/operations/listendpoints.d.ts +30 -0
  139. package/esm/models/operations/listendpoints.js +8 -0
  140. package/esm/models/operations/listendpointszdr.d.ts +38 -0
  141. package/esm/models/operations/listendpointszdr.js +14 -0
  142. package/esm/models/operations/listguardrailkeyassignments.d.ts +30 -0
  143. package/esm/models/operations/listguardrailkeyassignments.js +7 -0
  144. package/esm/models/operations/listguardrailmemberassignments.d.ts +30 -0
  145. package/esm/models/operations/listguardrailmemberassignments.js +7 -0
  146. package/esm/models/operations/listguardrails.d.ts +30 -0
  147. package/esm/models/operations/listguardrails.js +7 -0
  148. package/esm/models/operations/listkeyassignments.d.ts +30 -0
  149. package/esm/models/operations/listkeyassignments.js +7 -0
  150. package/esm/models/operations/listmemberassignments.d.ts +30 -0
  151. package/esm/models/operations/listmemberassignments.js +7 -0
  152. package/esm/models/operations/listmodelscount.d.ts +40 -0
  153. package/esm/models/operations/listmodelscount.js +20 -0
  154. package/esm/models/operations/listmodelsuser.d.ts +38 -0
  155. package/esm/models/operations/listmodelsuser.js +14 -0
  156. package/esm/models/operations/listproviders.d.ts +38 -0
  157. package/esm/models/operations/listproviders.js +13 -0
  158. package/esm/models/operations/sendchatcompletionrequest.d.ts +43 -0
  159. package/esm/models/operations/sendchatcompletionrequest.js +16 -0
  160. package/esm/models/operations/updateguardrail.d.ts +30 -0
  161. package/esm/models/operations/updateguardrail.js +4 -0
  162. package/esm/models/operations/updatekeys.d.ts +30 -0
  163. package/esm/models/operations/updatekeys.js +4 -0
  164. package/esm/models/providername.d.ts +2 -0
  165. package/esm/models/providername.js +2 -0
  166. package/esm/models/providerpreferences.d.ts +1 -13
  167. package/esm/models/publicendpoint.d.ts +0 -39
  168. package/esm/models/publicpricing.d.ts +0 -39
  169. package/esm/models/schema10.d.ts +33 -0
  170. package/esm/models/schema10.js +30 -0
  171. package/esm/models/schema14.d.ts +8 -0
  172. package/esm/models/schema14.js +12 -0
  173. package/esm/models/schema17.d.ts +102 -0
  174. package/esm/models/schema17.js +95 -0
  175. package/esm/models/schema19.d.ts +92 -0
  176. package/esm/models/schema19.js +109 -0
  177. package/esm/models/{schema0.d.ts → schema5.d.ts} +10 -8
  178. package/esm/models/{schema0.js → schema5.js} +10 -8
  179. package/esm/sdk/analytics.d.ts +1 -1
  180. package/esm/sdk/analytics.js +1 -1
  181. package/esm/sdk/apikeys.d.ts +6 -6
  182. package/esm/sdk/apikeys.js +7 -7
  183. package/esm/sdk/chat.d.ts +9 -5
  184. package/esm/sdk/credits.d.ts +3 -4
  185. package/esm/sdk/credits.js +3 -3
  186. package/esm/sdk/embeddings.d.ts +1 -1
  187. package/esm/sdk/embeddings.js +2 -2
  188. package/esm/sdk/endpoints.d.ts +1 -1
  189. package/esm/sdk/endpoints.js +2 -2
  190. package/esm/sdk/guardrails.d.ts +13 -13
  191. package/esm/sdk/guardrails.js +13 -13
  192. package/esm/sdk/models.d.ts +2 -2
  193. package/esm/sdk/models.js +4 -4
  194. package/esm/sdk/providers.d.ts +1 -1
  195. package/esm/sdk/providers.js +2 -2
  196. package/esm/sdk/responses.d.ts +9 -5
  197. package/jsr.json +1 -1
  198. package/package.json +2 -2
  199. package/esm/models/schema2.d.ts +0 -92
  200. package/esm/models/schema2.js +0 -109
package/FUNCTIONS.md CHANGED
@@ -25,11 +25,15 @@ import { betaResponsesSend } from "@openrouter/sdk/funcs/betaResponsesSend.js";
25
25
  // Use `OpenRouterCore` for best tree-shaking performance.
26
26
  // You can create one instance of it to use across an application.
27
27
  const openRouter = new OpenRouterCore({
28
+ httpReferer: "<value>",
29
+ xTitle: "<value>",
28
30
  apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
29
31
  });
30
32
 
31
33
  async function run() {
32
- const res = await betaResponsesSend(openRouter, {});
34
+ const res = await betaResponsesSend(openRouter, {
35
+ openResponsesRequest: {},
36
+ });
33
37
  if (res.ok) {
34
38
  const { value: result } = res;
35
39
  console.log(result);
@@ -12,7 +12,7 @@ import { Result } from "../types/fp.js";
12
12
  * Get user activity grouped by endpoint
13
13
  *
14
14
  * @remarks
15
- * Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
15
+ * Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Management key](/docs/guides/overview/auth/management-api-keys) required.
16
16
  */
17
17
  export declare function analyticsGetUserActivity(client: OpenRouterCore, request?: operations.GetUserActivityRequest | undefined, options?: RequestOptions): APIPromise<Result<operations.GetUserActivityResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
18
18
  //# sourceMappingURL=analyticsGetUserActivity.d.ts.map
@@ -2,7 +2,7 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  * @generated-id: 6525bcc66ab5
4
4
  */
5
- import { encodeFormQuery } from "../lib/encodings.js";
5
+ import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
6
6
  import * as M from "../lib/matchers.js";
7
7
  import { compactMap } from "../lib/primitives.js";
8
8
  import { safeParse } from "../lib/schemas.js";
@@ -15,7 +15,7 @@ import { APIPromise } from "../types/async.js";
15
15
  * Get user activity grouped by endpoint
16
16
  *
17
17
  * @remarks
18
- * Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
18
+ * Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Management key](/docs/guides/overview/auth/management-api-keys) required.
19
19
  */
20
20
  export function analyticsGetUserActivity(client, request, options) {
21
21
  return new APIPromise($do(client, request, options));
@@ -33,6 +33,8 @@ async function $do(client, request, options) {
33
33
  });
34
34
  const headers = new Headers(compactMap({
35
35
  Accept: "application/json",
36
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload?.["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
37
+ "X-Title": encodeSimple("X-Title", payload?.["X-Title"] ?? client._options.xTitle, { explode: false, charEncoding: "none" }),
36
38
  }));
37
39
  const secConfig = await extractSecurity(client._options.apiKey);
38
40
  const securityInput = secConfig == null ? {} : { apiKey: secConfig };
@@ -12,7 +12,7 @@ import { Result } from "../types/fp.js";
12
12
  * Create a new API key
13
13
  *
14
14
  * @remarks
15
- * Create a new API key for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
15
+ * Create a new API key for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
16
16
  */
17
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>>;
18
18
  //# sourceMappingURL=apiKeysCreate.d.ts.map
@@ -2,7 +2,7 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  * @generated-id: 133e2c5f487c
4
4
  */
5
- import { encodeJSON } from "../lib/encodings.js";
5
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
6
6
  import * as M from "../lib/matchers.js";
7
7
  import { compactMap } from "../lib/primitives.js";
8
8
  import { safeParse } from "../lib/schemas.js";
@@ -15,7 +15,7 @@ import { APIPromise } from "../types/async.js";
15
15
  * Create a new API key
16
16
  *
17
17
  * @remarks
18
- * Create a new API key for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
18
+ * Create a new API key for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
19
19
  */
20
20
  export function apiKeysCreate(client, request, options) {
21
21
  return new APIPromise($do(client, request, options));
@@ -26,11 +26,13 @@ async function $do(client, request, options) {
26
26
  return [parsed, { status: "invalid" }];
27
27
  }
28
28
  const payload = parsed.value;
29
- const body = encodeJSON("body", payload, { explode: true });
29
+ const body = encodeJSON("body", payload.RequestBody, { explode: true });
30
30
  const path = pathToFunc("/keys")();
31
31
  const headers = new Headers(compactMap({
32
32
  "Content-Type": "application/json",
33
33
  Accept: "application/json",
34
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
35
+ "X-Title": encodeSimple("X-Title", payload["X-Title"] ?? client._options.xTitle, { explode: false, charEncoding: "none" }),
34
36
  }));
35
37
  const secConfig = await extractSecurity(client._options.apiKey);
36
38
  const securityInput = secConfig == null ? {} : { apiKey: secConfig };
@@ -12,7 +12,7 @@ import { Result } from "../types/fp.js";
12
12
  * Delete an API key
13
13
  *
14
14
  * @remarks
15
- * Delete an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
15
+ * Delete an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required.
16
16
  */
17
17
  export declare function apiKeysDelete(client: OpenRouterCore, request: operations.DeleteKeysRequest, options?: RequestOptions): APIPromise<Result<operations.DeleteKeysResponse, errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
18
18
  //# sourceMappingURL=apiKeysDelete.d.ts.map
@@ -15,7 +15,7 @@ import { APIPromise } from "../types/async.js";
15
15
  * Delete an API key
16
16
  *
17
17
  * @remarks
18
- * Delete an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
18
+ * Delete an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required.
19
19
  */
20
20
  export function apiKeysDelete(client, request, options) {
21
21
  return new APIPromise($do(client, request, options));
@@ -36,6 +36,8 @@ async function $do(client, request, options) {
36
36
  const path = pathToFunc("/keys/{hash}")(pathParams);
37
37
  const headers = new Headers(compactMap({
38
38
  Accept: "application/json",
39
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
40
+ "X-Title": encodeSimple("X-Title", payload["X-Title"] ?? client._options.xTitle, { explode: false, charEncoding: "none" }),
39
41
  }));
40
42
  const secConfig = await extractSecurity(client._options.apiKey);
41
43
  const securityInput = secConfig == null ? {} : { apiKey: secConfig };
@@ -12,7 +12,7 @@ import { Result } from "../types/fp.js";
12
12
  * Get a single API key
13
13
  *
14
14
  * @remarks
15
- * Get a single API key by hash. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
15
+ * Get a single API key by hash. [Management key](/docs/guides/overview/auth/management-api-keys) required.
16
16
  */
17
17
  export declare function apiKeysGet(client: OpenRouterCore, request: operations.GetKeyRequest, options?: RequestOptions): APIPromise<Result<operations.GetKeyResponse, errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
18
18
  //# sourceMappingURL=apiKeysGet.d.ts.map
@@ -15,7 +15,7 @@ import { APIPromise } from "../types/async.js";
15
15
  * Get a single API key
16
16
  *
17
17
  * @remarks
18
- * Get a single API key by hash. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
18
+ * Get a single API key by hash. [Management key](/docs/guides/overview/auth/management-api-keys) required.
19
19
  */
20
20
  export function apiKeysGet(client, request, options) {
21
21
  return new APIPromise($do(client, request, options));
@@ -36,6 +36,8 @@ async function $do(client, request, options) {
36
36
  const path = pathToFunc("/keys/{hash}")(pathParams);
37
37
  const headers = new Headers(compactMap({
38
38
  Accept: "application/json",
39
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
40
+ "X-Title": encodeSimple("X-Title", payload["X-Title"] ?? client._options.xTitle, { explode: false, charEncoding: "none" }),
39
41
  }));
40
42
  const secConfig = await extractSecurity(client._options.apiKey);
41
43
  const securityInput = secConfig == null ? {} : { apiKey: secConfig };
@@ -14,5 +14,5 @@ import { Result } from "../types/fp.js";
14
14
  * @remarks
15
15
  * Get information on the API key associated with the current authentication session
16
16
  */
17
- export declare function apiKeysGetCurrentKeyMetadata(client: OpenRouterCore, options?: RequestOptions): APIPromise<Result<operations.GetCurrentKeyResponse, errors.UnauthorizedResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
17
+ export declare function apiKeysGetCurrentKeyMetadata(client: OpenRouterCore, request?: operations.GetCurrentKeyRequest | undefined, options?: RequestOptions): APIPromise<Result<operations.GetCurrentKeyResponse, errors.UnauthorizedResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
18
18
  //# sourceMappingURL=apiKeysGetCurrentKeyMetadata.d.ts.map
@@ -2,8 +2,10 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  * @generated-id: d9449cb31931
4
4
  */
5
+ import { encodeSimple } from "../lib/encodings.js";
5
6
  import * as M from "../lib/matchers.js";
6
7
  import { compactMap } from "../lib/primitives.js";
8
+ import { safeParse } from "../lib/schemas.js";
7
9
  import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
8
10
  import { pathToFunc } from "../lib/url.js";
9
11
  import * as errors from "../models/errors/index.js";
@@ -15,13 +17,21 @@ import { APIPromise } from "../types/async.js";
15
17
  * @remarks
16
18
  * Get information on the API key associated with the current authentication session
17
19
  */
18
- export function apiKeysGetCurrentKeyMetadata(client, options) {
19
- return new APIPromise($do(client, options));
20
+ export function apiKeysGetCurrentKeyMetadata(client, request, options) {
21
+ return new APIPromise($do(client, request, options));
20
22
  }
21
- async function $do(client, options) {
23
+ async function $do(client, request, options) {
24
+ const parsed = safeParse(request, (value) => operations.GetCurrentKeyRequest$outboundSchema.optional().parse(value), "Input validation failed");
25
+ if (!parsed.ok) {
26
+ return [parsed, { status: "invalid" }];
27
+ }
28
+ const payload = parsed.value;
29
+ const body = null;
22
30
  const path = pathToFunc("/key")();
23
31
  const headers = new Headers(compactMap({
24
32
  Accept: "application/json",
33
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload?.["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
34
+ "X-Title": encodeSimple("X-Title", payload?.["X-Title"] ?? client._options.xTitle, { explode: false, charEncoding: "none" }),
25
35
  }));
26
36
  const secConfig = await extractSecurity(client._options.apiKey);
27
37
  const securityInput = secConfig == null ? {} : { apiKey: secConfig };
@@ -44,6 +54,7 @@ async function $do(client, options) {
44
54
  baseURL: options?.serverURL,
45
55
  path: path,
46
56
  headers: headers,
57
+ body: body,
47
58
  userAgent: client._options.userAgent,
48
59
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
49
60
  }, options);
@@ -12,7 +12,7 @@ import { Result } from "../types/fp.js";
12
12
  * List API keys
13
13
  *
14
14
  * @remarks
15
- * List all API keys for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
15
+ * List all API keys for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
16
16
  */
17
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>>;
18
18
  //# sourceMappingURL=apiKeysList.d.ts.map
@@ -2,7 +2,7 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  * @generated-id: 2afc8d8f1ce0
4
4
  */
5
- import { encodeFormQuery } from "../lib/encodings.js";
5
+ import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
6
6
  import * as M from "../lib/matchers.js";
7
7
  import { compactMap } from "../lib/primitives.js";
8
8
  import { safeParse } from "../lib/schemas.js";
@@ -15,7 +15,7 @@ import { APIPromise } from "../types/async.js";
15
15
  * List API keys
16
16
  *
17
17
  * @remarks
18
- * List all API keys for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
18
+ * List all API keys for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
19
19
  */
20
20
  export function apiKeysList(client, request, options) {
21
21
  return new APIPromise($do(client, request, options));
@@ -34,6 +34,8 @@ async function $do(client, request, options) {
34
34
  });
35
35
  const headers = new Headers(compactMap({
36
36
  Accept: "application/json",
37
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload?.["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
38
+ "X-Title": encodeSimple("X-Title", payload?.["X-Title"] ?? client._options.xTitle, { explode: false, charEncoding: "none" }),
37
39
  }));
38
40
  const secConfig = await extractSecurity(client._options.apiKey);
39
41
  const securityInput = secConfig == null ? {} : { apiKey: secConfig };
@@ -12,7 +12,7 @@ import { Result } from "../types/fp.js";
12
12
  * Update an API key
13
13
  *
14
14
  * @remarks
15
- * Update an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
15
+ * Update an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required.
16
16
  */
17
17
  export declare function apiKeysUpdate(client: OpenRouterCore, request: operations.UpdateKeysRequest, options?: RequestOptions): APIPromise<Result<operations.UpdateKeysResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
18
18
  //# sourceMappingURL=apiKeysUpdate.d.ts.map
@@ -15,7 +15,7 @@ import { APIPromise } from "../types/async.js";
15
15
  * Update an API key
16
16
  *
17
17
  * @remarks
18
- * Update an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
18
+ * Update an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required.
19
19
  */
20
20
  export function apiKeysUpdate(client, request, options) {
21
21
  return new APIPromise($do(client, request, options));
@@ -37,6 +37,8 @@ async function $do(client, request, options) {
37
37
  const headers = new Headers(compactMap({
38
38
  "Content-Type": "application/json",
39
39
  Accept: "application/json",
40
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
41
+ "X-Title": encodeSimple("X-Title", payload["X-Title"] ?? client._options.xTitle, { explode: false, charEncoding: "none" }),
40
42
  }));
41
43
  const secConfig = await extractSecurity(client._options.apiKey);
42
44
  const securityInput = secConfig == null ? {} : { apiKey: secConfig };
@@ -16,11 +16,15 @@ import { Result } from "../types/fp.js";
16
16
  * @remarks
17
17
  * Creates a streaming or non-streaming response using OpenResponses API format
18
18
  */
19
- export declare function betaResponsesSend(client: OpenRouterCore, request: models.OpenResponsesRequest & {
20
- stream?: false;
19
+ export declare function betaResponsesSend(client: OpenRouterCore, request: operations.CreateResponsesRequest & {
20
+ openResponsesRequest: {
21
+ stream?: false;
22
+ };
21
23
  }, options?: RequestOptions): APIPromise<Result<models.OpenResponsesNonStreamingResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | 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>>;
22
- export declare function betaResponsesSend(client: OpenRouterCore, request: models.OpenResponsesRequest & {
23
- stream: true;
24
+ export declare function betaResponsesSend(client: OpenRouterCore, request: operations.CreateResponsesRequest & {
25
+ openResponsesRequest: {
26
+ stream: true;
27
+ };
24
28
  }, options?: RequestOptions): APIPromise<Result<EventStream<models.OpenResponsesStreamEvent>, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | 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>>;
25
- export declare function betaResponsesSend(client: OpenRouterCore, request: models.OpenResponsesRequest, options?: RequestOptions): APIPromise<Result<operations.CreateResponsesResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | 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 betaResponsesSend(client: OpenRouterCore, request: operations.CreateResponsesRequest, options?: RequestOptions): APIPromise<Result<operations.CreateResponsesResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | 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>>;
26
30
  //# sourceMappingURL=betaResponsesSend.d.ts.map
@@ -2,30 +2,35 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  * @generated-id: c5c4ab0c3f76
4
4
  */
5
- import { encodeJSON } from "../lib/encodings.js";
5
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
6
6
  import * as M from "../lib/matchers.js";
7
7
  import { compactMap } from "../lib/primitives.js";
8
8
  import { safeParse } from "../lib/schemas.js";
9
9
  import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
10
10
  import { pathToFunc } from "../lib/url.js";
11
11
  import * as errors from "../models/errors/index.js";
12
- import * as models from "../models/index.js";
13
12
  import * as operations from "../models/operations/index.js";
14
13
  import { APIPromise } from "../types/async.js";
15
14
  export function betaResponsesSend(client, request, options) {
16
15
  return new APIPromise($do(client, request, options));
17
16
  }
18
17
  async function $do(client, request, options) {
19
- const parsed = safeParse(request, (value) => models.OpenResponsesRequest$outboundSchema.parse(value), "Input validation failed");
18
+ const parsed = safeParse(request, (value) => operations.CreateResponsesRequest$outboundSchema.parse(value), "Input validation failed");
20
19
  if (!parsed.ok) {
21
20
  return [parsed, { status: "invalid" }];
22
21
  }
23
22
  const payload = parsed.value;
24
- const body = encodeJSON("body", payload, { explode: true });
23
+ const body = encodeJSON("body", payload.OpenResponsesRequest, {
24
+ explode: true,
25
+ });
25
26
  const path = pathToFunc("/responses")();
26
27
  const headers = new Headers(compactMap({
27
28
  "Content-Type": "application/json",
28
- Accept: request?.stream ? "text/event-stream" : "application/json",
29
+ Accept: request?.openResponsesRequest?.stream
30
+ ? "text/event-stream"
31
+ : "application/json",
32
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
33
+ "X-Title": encodeSimple("X-Title", payload["X-Title"] ?? client._options.xTitle, { explode: false, charEncoding: "none" }),
29
34
  }));
30
35
  const secConfig = await extractSecurity(client._options.apiKey);
31
36
  const securityInput = secConfig == null ? {} : { apiKey: secConfig };
@@ -16,11 +16,15 @@ import { Result } from "../types/fp.js";
16
16
  * @remarks
17
17
  * Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
18
18
  */
19
- export declare function chatSend(client: OpenRouterCore, request: models.ChatGenerationParams & {
20
- stream?: false;
19
+ export declare function chatSend(client: OpenRouterCore, request: operations.SendChatCompletionRequestRequest & {
20
+ chatGenerationParams: {
21
+ stream?: false;
22
+ };
21
23
  }, options?: RequestOptions): APIPromise<Result<models.ChatResponse, errors.ChatError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
22
- export declare function chatSend(client: OpenRouterCore, request: models.ChatGenerationParams & {
23
- stream: true;
24
+ export declare function chatSend(client: OpenRouterCore, request: operations.SendChatCompletionRequestRequest & {
25
+ chatGenerationParams: {
26
+ stream: true;
27
+ };
24
28
  }, options?: RequestOptions): APIPromise<Result<EventStream<models.ChatStreamingResponseChunkData>, errors.ChatError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
25
- export declare function chatSend(client: OpenRouterCore, request: models.ChatGenerationParams, options?: RequestOptions): APIPromise<Result<operations.SendChatCompletionRequestResponse, errors.ChatError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
29
+ export declare function chatSend(client: OpenRouterCore, request: operations.SendChatCompletionRequestRequest, options?: RequestOptions): APIPromise<Result<operations.SendChatCompletionRequestResponse, errors.ChatError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
26
30
  //# sourceMappingURL=chatSend.d.ts.map
@@ -2,30 +2,35 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  * @generated-id: 8c3aa3c963bf
4
4
  */
5
- import { encodeJSON } from "../lib/encodings.js";
5
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
6
6
  import * as M from "../lib/matchers.js";
7
7
  import { compactMap } from "../lib/primitives.js";
8
8
  import { safeParse } from "../lib/schemas.js";
9
9
  import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
10
10
  import { pathToFunc } from "../lib/url.js";
11
11
  import * as errors from "../models/errors/index.js";
12
- import * as models from "../models/index.js";
13
12
  import * as operations from "../models/operations/index.js";
14
13
  import { APIPromise } from "../types/async.js";
15
14
  export function chatSend(client, request, options) {
16
15
  return new APIPromise($do(client, request, options));
17
16
  }
18
17
  async function $do(client, request, options) {
19
- const parsed = safeParse(request, (value) => models.ChatGenerationParams$outboundSchema.parse(value), "Input validation failed");
18
+ const parsed = safeParse(request, (value) => operations.SendChatCompletionRequestRequest$outboundSchema.parse(value), "Input validation failed");
20
19
  if (!parsed.ok) {
21
20
  return [parsed, { status: "invalid" }];
22
21
  }
23
22
  const payload = parsed.value;
24
- const body = encodeJSON("body", payload, { explode: true });
23
+ const body = encodeJSON("body", payload.ChatGenerationParams, {
24
+ explode: true,
25
+ });
25
26
  const path = pathToFunc("/chat/completions")();
26
27
  const headers = new Headers(compactMap({
27
28
  "Content-Type": "application/json",
28
- Accept: request?.stream ? "text/event-stream" : "application/json",
29
+ Accept: request?.chatGenerationParams?.stream
30
+ ? "text/event-stream"
31
+ : "application/json",
32
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
33
+ "X-Title": encodeSimple("X-Title", payload["X-Title"] ?? client._options.xTitle, { explode: false, charEncoding: "none" }),
29
34
  }));
30
35
  const secConfig = await extractSecurity(client._options.apiKey);
31
36
  const securityInput = secConfig == null ? {} : { apiKey: secConfig };
@@ -5,7 +5,6 @@ import * as errors from "../models/errors/index.js";
5
5
  import { OpenRouterError } from "../models/errors/openroutererror.js";
6
6
  import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
7
7
  import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
8
- import * as models from "../models/index.js";
9
8
  import * as operations from "../models/operations/index.js";
10
9
  import { APIPromise } from "../types/async.js";
11
10
  import { Result } from "../types/fp.js";
@@ -15,5 +14,5 @@ import { Result } from "../types/fp.js";
15
14
  * @remarks
16
15
  * Create a Coinbase charge for crypto payment
17
16
  */
18
- export declare function creditsCreateCoinbaseCharge(client: OpenRouterCore, security: operations.CreateCoinbaseChargeSecurity, request: models.CreateChargeRequest, options?: RequestOptions): APIPromise<Result<operations.CreateCoinbaseChargeResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
17
+ export declare function creditsCreateCoinbaseCharge(client: OpenRouterCore, security: operations.CreateCoinbaseChargeSecurity, request: operations.CreateCoinbaseChargeRequest, options?: RequestOptions): APIPromise<Result<operations.CreateCoinbaseChargeResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
19
18
  //# sourceMappingURL=creditsCreateCoinbaseCharge.d.ts.map
@@ -2,14 +2,13 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  * @generated-id: e07ee6831da3
4
4
  */
5
- import { encodeJSON } from "../lib/encodings.js";
5
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
6
6
  import * as M from "../lib/matchers.js";
7
7
  import { compactMap } from "../lib/primitives.js";
8
8
  import { safeParse } from "../lib/schemas.js";
9
9
  import { resolveSecurity } from "../lib/security.js";
10
10
  import { pathToFunc } from "../lib/url.js";
11
11
  import * as errors from "../models/errors/index.js";
12
- import * as models from "../models/index.js";
13
12
  import * as operations from "../models/operations/index.js";
14
13
  import { APIPromise } from "../types/async.js";
15
14
  /**
@@ -22,16 +21,20 @@ export function creditsCreateCoinbaseCharge(client, security, request, options)
22
21
  return new APIPromise($do(client, security, request, options));
23
22
  }
24
23
  async function $do(client, security, request, options) {
25
- const parsed = safeParse(request, (value) => models.CreateChargeRequest$outboundSchema.parse(value), "Input validation failed");
24
+ const parsed = safeParse(request, (value) => operations.CreateCoinbaseChargeRequest$outboundSchema.parse(value), "Input validation failed");
26
25
  if (!parsed.ok) {
27
26
  return [parsed, { status: "invalid" }];
28
27
  }
29
28
  const payload = parsed.value;
30
- const body = encodeJSON("body", payload, { explode: true });
29
+ const body = encodeJSON("body", payload.CreateChargeRequest, {
30
+ explode: true,
31
+ });
31
32
  const path = pathToFunc("/credits/coinbase")();
32
33
  const headers = new Headers(compactMap({
33
34
  "Content-Type": "application/json",
34
35
  Accept: "application/json",
36
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
37
+ "X-Title": encodeSimple("X-Title", payload["X-Title"] ?? client._options.xTitle, { explode: false, charEncoding: "none" }),
35
38
  }));
36
39
  const requestSecurity = resolveSecurity([
37
40
  {
@@ -12,7 +12,7 @@ import { Result } from "../types/fp.js";
12
12
  * Get remaining credits
13
13
  *
14
14
  * @remarks
15
- * Get total credits purchased and used for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
15
+ * Get total credits purchased and used for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
16
16
  */
17
- export declare function creditsGetCredits(client: OpenRouterCore, options?: RequestOptions): APIPromise<Result<operations.GetCreditsResponse, errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
17
+ export declare function creditsGetCredits(client: OpenRouterCore, request?: operations.GetCreditsRequest | undefined, options?: RequestOptions): APIPromise<Result<operations.GetCreditsResponse, errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
18
18
  //# sourceMappingURL=creditsGetCredits.d.ts.map
@@ -2,8 +2,10 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  * @generated-id: 88fdc1315137
4
4
  */
5
+ import { encodeSimple } from "../lib/encodings.js";
5
6
  import * as M from "../lib/matchers.js";
6
7
  import { compactMap } from "../lib/primitives.js";
8
+ import { safeParse } from "../lib/schemas.js";
7
9
  import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
8
10
  import { pathToFunc } from "../lib/url.js";
9
11
  import * as errors from "../models/errors/index.js";
@@ -13,15 +15,23 @@ import { APIPromise } from "../types/async.js";
13
15
  * Get remaining credits
14
16
  *
15
17
  * @remarks
16
- * Get total credits purchased and used for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
18
+ * Get total credits purchased and used for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
17
19
  */
18
- export function creditsGetCredits(client, options) {
19
- return new APIPromise($do(client, options));
20
+ export function creditsGetCredits(client, request, options) {
21
+ return new APIPromise($do(client, request, options));
20
22
  }
21
- async function $do(client, options) {
23
+ async function $do(client, request, options) {
24
+ const parsed = safeParse(request, (value) => operations.GetCreditsRequest$outboundSchema.optional().parse(value), "Input validation failed");
25
+ if (!parsed.ok) {
26
+ return [parsed, { status: "invalid" }];
27
+ }
28
+ const payload = parsed.value;
29
+ const body = null;
22
30
  const path = pathToFunc("/credits")();
23
31
  const headers = new Headers(compactMap({
24
32
  Accept: "application/json",
33
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload?.["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
34
+ "X-Title": encodeSimple("X-Title", payload?.["X-Title"] ?? client._options.xTitle, { explode: false, charEncoding: "none" }),
25
35
  }));
26
36
  const secConfig = await extractSecurity(client._options.apiKey);
27
37
  const securityInput = secConfig == null ? {} : { apiKey: secConfig };
@@ -44,6 +54,7 @@ async function $do(client, options) {
44
54
  baseURL: options?.serverURL,
45
55
  path: path,
46
56
  headers: headers,
57
+ body: body,
47
58
  userAgent: client._options.userAgent,
48
59
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
49
60
  }, options);
@@ -2,7 +2,7 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  * @generated-id: f6455fcfe2c8
4
4
  */
5
- import { encodeJSON } from "../lib/encodings.js";
5
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
6
6
  import * as M from "../lib/matchers.js";
7
7
  import { compactMap } from "../lib/primitives.js";
8
8
  import { safeParse } from "../lib/schemas.js";
@@ -26,11 +26,13 @@ async function $do(client, request, options) {
26
26
  return [parsed, { status: "invalid" }];
27
27
  }
28
28
  const payload = parsed.value;
29
- const body = encodeJSON("body", payload, { explode: true });
29
+ const body = encodeJSON("body", payload.RequestBody, { explode: true });
30
30
  const path = pathToFunc("/embeddings")();
31
31
  const headers = new Headers(compactMap({
32
32
  "Content-Type": "application/json",
33
33
  Accept: "application/json;q=1, text/event-stream;q=0",
34
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
35
+ "X-Title": encodeSimple("X-Title", payload["X-Title"] ?? client._options.xTitle, { explode: false, charEncoding: "none" }),
34
36
  }));
35
37
  const secConfig = await extractSecurity(client._options.apiKey);
36
38
  const securityInput = secConfig == null ? {} : { apiKey: secConfig };
@@ -6,6 +6,7 @@ import { OpenRouterError } from "../models/errors/openroutererror.js";
6
6
  import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
7
7
  import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
8
8
  import * as models from "../models/index.js";
9
+ import * as operations from "../models/operations/index.js";
9
10
  import { APIPromise } from "../types/async.js";
10
11
  import { Result } from "../types/fp.js";
11
12
  /**
@@ -14,5 +15,5 @@ import { Result } from "../types/fp.js";
14
15
  * @remarks
15
16
  * Returns a list of all available embeddings models and their properties
16
17
  */
17
- export declare function embeddingsListModels(client: OpenRouterCore, options?: RequestOptions): APIPromise<Result<models.ModelsListResponse, errors.BadRequestResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
18
+ export declare function embeddingsListModels(client: OpenRouterCore, request?: operations.ListEmbeddingsModelsRequest | undefined, options?: RequestOptions): APIPromise<Result<models.ModelsListResponse, errors.BadRequestResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
18
19
  //# sourceMappingURL=embeddingsListModels.d.ts.map
@@ -2,12 +2,15 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  * @generated-id: dbe9751f8369
4
4
  */
5
+ import { encodeSimple } from "../lib/encodings.js";
5
6
  import * as M from "../lib/matchers.js";
6
7
  import { compactMap } from "../lib/primitives.js";
8
+ import { safeParse } from "../lib/schemas.js";
7
9
  import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
8
10
  import { pathToFunc } from "../lib/url.js";
9
11
  import * as errors from "../models/errors/index.js";
10
12
  import * as models from "../models/index.js";
13
+ import * as operations from "../models/operations/index.js";
11
14
  import { APIPromise } from "../types/async.js";
12
15
  /**
13
16
  * List all embeddings models
@@ -15,13 +18,21 @@ import { APIPromise } from "../types/async.js";
15
18
  * @remarks
16
19
  * Returns a list of all available embeddings models and their properties
17
20
  */
18
- export function embeddingsListModels(client, options) {
19
- return new APIPromise($do(client, options));
21
+ export function embeddingsListModels(client, request, options) {
22
+ return new APIPromise($do(client, request, options));
20
23
  }
21
- async function $do(client, options) {
24
+ async function $do(client, request, options) {
25
+ const parsed = safeParse(request, (value) => operations.ListEmbeddingsModelsRequest$outboundSchema.optional().parse(value), "Input validation failed");
26
+ if (!parsed.ok) {
27
+ return [parsed, { status: "invalid" }];
28
+ }
29
+ const payload = parsed.value;
30
+ const body = null;
22
31
  const path = pathToFunc("/embeddings/models")();
23
32
  const headers = new Headers(compactMap({
24
33
  Accept: "application/json",
34
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload?.["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
35
+ "X-Title": encodeSimple("X-Title", payload?.["X-Title"] ?? client._options.xTitle, { explode: false, charEncoding: "none" }),
25
36
  }));
26
37
  const secConfig = await extractSecurity(client._options.apiKey);
27
38
  const securityInput = secConfig == null ? {} : { apiKey: secConfig };
@@ -44,6 +55,7 @@ async function $do(client, options) {
44
55
  baseURL: options?.serverURL,
45
56
  path: path,
46
57
  headers: headers,
58
+ body: body,
47
59
  userAgent: client._options.userAgent,
48
60
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
49
61
  }, options);