@openrouter/sdk 1.3.28 → 1.3.30

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 (216) hide show
  1. package/README.md +1 -1
  2. package/esm/funcs/batchCreateBatches.d.ts +19 -0
  3. package/esm/funcs/batchCreateBatches.js +98 -0
  4. package/esm/funcs/batchDelete.d.ts +19 -0
  5. package/esm/funcs/batchDelete.js +103 -0
  6. package/esm/funcs/batchGetBatches.d.ts +19 -0
  7. package/esm/funcs/batchGetBatches.js +103 -0
  8. package/esm/funcs/batchList.d.ts +21 -0
  9. package/esm/funcs/batchList.js +134 -0
  10. package/esm/lib/config.d.ts +2 -2
  11. package/esm/lib/config.js +2 -2
  12. package/esm/models/anthropicadvisortoolresult.d.ts +14 -0
  13. package/esm/models/anthropicadvisortoolresult.js +21 -0
  14. package/esm/models/anthropicbase64pdfsource.d.ts +17 -2
  15. package/esm/models/anthropicbase64pdfsource.js +25 -2
  16. package/esm/models/anthropicbashcodeexecutioncontent.d.ts +11 -0
  17. package/esm/models/anthropicbashcodeexecutioncontent.js +17 -0
  18. package/esm/models/anthropicbashcodeexecutionoutput.d.ts +18 -0
  19. package/esm/models/anthropicbashcodeexecutionoutput.js +25 -0
  20. package/esm/models/anthropicbashcodeexecutionresult.d.ts +15 -0
  21. package/esm/models/anthropicbashcodeexecutionresult.js +24 -0
  22. package/esm/models/anthropicbashcodeexecutiontoolresult.d.ts +13 -0
  23. package/esm/models/anthropicbashcodeexecutiontoolresult.js +22 -0
  24. package/esm/models/anthropicbashcodeexecutiontoolresulterror.d.ts +22 -0
  25. package/esm/models/anthropicbashcodeexecutiontoolresulterror.js +30 -0
  26. package/esm/models/anthropiccaller.d.ts +12 -0
  27. package/esm/models/anthropiccaller.js +19 -0
  28. package/esm/models/anthropiccitationcharlocation.d.ts +16 -0
  29. package/esm/models/anthropiccitationcharlocation.js +30 -0
  30. package/esm/models/anthropiccitationcontentblocklocation.d.ts +16 -0
  31. package/esm/models/anthropiccitationcontentblocklocation.js +30 -0
  32. package/esm/models/anthropiccitationpagelocation.d.ts +16 -0
  33. package/esm/models/anthropiccitationpagelocation.js +30 -0
  34. package/esm/models/anthropiccitationsconfig.d.ts +10 -0
  35. package/esm/models/anthropiccitationsconfig.js +14 -0
  36. package/esm/models/anthropiccitationsearchresultlocation.d.ts +16 -0
  37. package/esm/models/anthropiccitationsearchresultlocation.js +28 -0
  38. package/esm/models/anthropiccitationwebsearchresultlocation.d.ts +14 -0
  39. package/esm/models/anthropiccitationwebsearchresultlocation.js +24 -0
  40. package/esm/models/anthropiccodeexecution20250825caller.d.ts +11 -0
  41. package/esm/models/anthropiccodeexecution20250825caller.js +20 -0
  42. package/esm/models/anthropiccodeexecution20260120caller.d.ts +11 -0
  43. package/esm/models/anthropiccodeexecution20260120caller.js +20 -0
  44. package/esm/models/anthropiccodeexecutioncontent.d.ts +12 -0
  45. package/esm/models/anthropiccodeexecutioncontent.js +19 -0
  46. package/esm/models/anthropiccodeexecutionoutput.d.ts +18 -0
  47. package/esm/models/anthropiccodeexecutionoutput.js +25 -0
  48. package/esm/models/anthropiccodeexecutionresult.d.ts +15 -0
  49. package/esm/models/anthropiccodeexecutionresult.js +24 -0
  50. package/esm/models/anthropiccodeexecutiontoolresult.d.ts +13 -0
  51. package/esm/models/anthropiccodeexecutiontoolresult.js +22 -0
  52. package/esm/models/anthropiccodeexecutiontoolresulterror.d.ts +12 -0
  53. package/esm/models/anthropiccodeexecutiontoolresulterror.js +21 -0
  54. package/esm/models/anthropiccompactionblock.d.ts +12 -0
  55. package/esm/models/anthropiccompactionblock.js +21 -0
  56. package/esm/models/anthropiccontainer.d.ts +13 -0
  57. package/esm/models/anthropiccontainer.js +22 -0
  58. package/esm/models/anthropiccontainerskill.d.ts +20 -0
  59. package/esm/models/anthropiccontainerskill.js +28 -0
  60. package/esm/models/anthropiccontainerupload.d.ts +11 -0
  61. package/esm/models/anthropiccontainerupload.js +20 -0
  62. package/esm/models/anthropicdirectcaller.d.ts +10 -0
  63. package/esm/models/anthropicdirectcaller.js +14 -0
  64. package/esm/models/anthropicdocumentblock.d.ts +36 -0
  65. package/esm/models/anthropicdocumentblock.js +45 -0
  66. package/esm/models/anthropicdocumentblockparam.d.ts +20 -4
  67. package/esm/models/anthropicdocumentblockparam.js +4 -4
  68. package/esm/models/anthropicencryptedcodeexecutionresult.d.ts +15 -0
  69. package/esm/models/anthropicencryptedcodeexecutionresult.js +25 -0
  70. package/esm/models/anthropicinputtransformation.d.ts +18 -0
  71. package/esm/models/anthropicinputtransformation.js +16 -0
  72. package/esm/models/anthropicoutputtokensdetails.d.ts +10 -0
  73. package/esm/models/anthropicoutputtokensdetails.js +19 -0
  74. package/esm/models/anthropicplaintextsource.d.ts +17 -2
  75. package/esm/models/anthropicplaintextsource.js +25 -2
  76. package/esm/models/anthropicredactedthinkingblock.d.ts +11 -0
  77. package/esm/models/anthropicredactedthinkingblock.js +15 -0
  78. package/esm/models/anthropicrefusalstopdetails.d.ts +32 -0
  79. package/esm/models/anthropicrefusalstopdetails.js +31 -0
  80. package/esm/models/anthropicservertoolerrorcode.d.ts +12 -0
  81. package/esm/models/anthropicservertoolerrorcode.js +14 -0
  82. package/esm/models/anthropicservertoolusage.d.ts +11 -0
  83. package/esm/models/anthropicservertoolusage.js +21 -0
  84. package/esm/models/anthropicservicetier.d.ts +11 -0
  85. package/esm/models/anthropicservicetier.js +13 -0
  86. package/esm/models/anthropictextblock.d.ts +13 -0
  87. package/esm/models/anthropictextblock.js +17 -0
  88. package/esm/models/anthropictextcitation.d.ts +14 -0
  89. package/esm/models/anthropictextcitation.js +23 -0
  90. package/esm/models/anthropictexteditorcodeexecutioncontent.d.ts +13 -0
  91. package/esm/models/anthropictexteditorcodeexecutioncontent.js +21 -0
  92. package/esm/models/anthropictexteditorcodeexecutioncreateresult.d.ts +11 -0
  93. package/esm/models/anthropictexteditorcodeexecutioncreateresult.js +20 -0
  94. package/esm/models/anthropictexteditorcodeexecutionstrreplaceresult.d.ts +15 -0
  95. package/esm/models/anthropictexteditorcodeexecutionstrreplaceresult.js +28 -0
  96. package/esm/models/anthropictexteditorcodeexecutiontoolresult.d.ts +13 -0
  97. package/esm/models/anthropictexteditorcodeexecutiontoolresult.js +22 -0
  98. package/esm/models/anthropictexteditorcodeexecutiontoolresulterror.d.ts +23 -0
  99. package/esm/models/anthropictexteditorcodeexecutiontoolresulterror.js +33 -0
  100. package/esm/models/anthropictexteditorcodeexecutionviewresult.d.ts +24 -0
  101. package/esm/models/anthropictexteditorcodeexecutionviewresult.js +36 -0
  102. package/esm/models/anthropicthinkingblock.d.ts +12 -0
  103. package/esm/models/anthropicthinkingblock.js +16 -0
  104. package/esm/models/anthropictoolreference.d.ts +18 -0
  105. package/esm/models/anthropictoolreference.js +25 -0
  106. package/esm/models/anthropictoolsearchcontent.d.ts +11 -0
  107. package/esm/models/anthropictoolsearchcontent.js +17 -0
  108. package/esm/models/anthropictoolsearchresult.d.ts +12 -0
  109. package/esm/models/anthropictoolsearchresult.js +21 -0
  110. package/esm/models/anthropictoolsearchresulterror.d.ts +13 -0
  111. package/esm/models/anthropictoolsearchresulterror.js +23 -0
  112. package/esm/models/anthropictoolsearchtoolresult.d.ts +13 -0
  113. package/esm/models/anthropictoolsearchtoolresult.js +22 -0
  114. package/esm/models/anthropictooluseblock.d.ts +15 -0
  115. package/esm/models/anthropictooluseblock.js +19 -0
  116. package/esm/models/anthropicwebfetchblock.d.ts +14 -0
  117. package/esm/models/anthropicwebfetchblock.js +23 -0
  118. package/esm/models/anthropicwebfetchcontent.d.ts +11 -0
  119. package/esm/models/anthropicwebfetchcontent.js +17 -0
  120. package/esm/models/anthropicwebfetchtoolresult.d.ts +15 -0
  121. package/esm/models/anthropicwebfetchtoolresult.js +24 -0
  122. package/esm/models/anthropicwebfetchtoolresulterror.d.ts +25 -0
  123. package/esm/models/anthropicwebfetchtoolresulterror.js +33 -0
  124. package/esm/models/anthropicwebsearchresult.d.ts +21 -0
  125. package/esm/models/anthropicwebsearchresult.js +29 -0
  126. package/esm/models/anthropicwebsearchtoolresult.d.ts +20 -0
  127. package/esm/models/anthropicwebsearchtoolresult.js +36 -0
  128. package/esm/models/anthropicwebsearchtoolresulterror.d.ts +29 -0
  129. package/esm/models/anthropicwebsearchtoolresulterror.js +37 -0
  130. package/esm/models/batchdeletedobject.d.ts +26 -0
  131. package/esm/models/batchdeletedobject.js +22 -0
  132. package/esm/models/batchdeletionoutcome.d.ts +17 -0
  133. package/esm/models/batchdeletionoutcome.js +16 -0
  134. package/esm/models/batchdeletiontargets.d.ts +50 -0
  135. package/esm/models/batchdeletiontargets.js +32 -0
  136. package/esm/models/batcherrorresponse.d.ts +11 -0
  137. package/esm/models/batcherrorresponse.js +15 -0
  138. package/esm/models/batchlistitem.d.ts +181 -0
  139. package/esm/models/batchlistitem.js +159 -0
  140. package/esm/models/batchlistresponse.d.ts +25 -0
  141. package/esm/models/batchlistresponse.js +31 -0
  142. package/esm/models/batchliststatus.d.ts +20 -0
  143. package/esm/models/batchliststatus.js +19 -0
  144. package/esm/models/batchlisttimestamp.d.ts +12 -0
  145. package/esm/models/batchlisttimestamp.js +15 -0
  146. package/esm/models/batchobject.d.ts +750 -0
  147. package/esm/models/batchobject.js +810 -0
  148. package/esm/models/batchpaymentrequiredresponseerror.d.ts +159 -0
  149. package/esm/models/batchpaymentrequiredresponseerror.js +136 -0
  150. package/esm/models/batchproviderpreferences.d.ts +25 -0
  151. package/esm/models/batchproviderpreferences.js +20 -0
  152. package/esm/models/batchsubmitbody.d.ts +62 -0
  153. package/esm/models/batchsubmitbody.js +51 -0
  154. package/esm/models/debugevent.d.ts +12 -12
  155. package/esm/models/debugevent.js +11 -12
  156. package/esm/models/errors/batcherrorresponse.d.ts +19 -0
  157. package/esm/models/errors/batcherrorresponse.js +32 -0
  158. package/esm/models/errors/batchpaymentrequiredresponseerror.d.ts +53 -0
  159. package/esm/models/errors/batchpaymentrequiredresponseerror.js +64 -0
  160. package/esm/models/errors/index.d.ts +2 -0
  161. package/esm/models/errors/index.js +2 -0
  162. package/esm/models/finishreason.d.ts +13 -0
  163. package/esm/models/finishreason.js +15 -0
  164. package/esm/models/imagegenerationusage.d.ts +4 -4
  165. package/esm/models/imagegenerationusage.js +4 -6
  166. package/esm/models/index.d.ts +77 -0
  167. package/esm/models/index.js +77 -0
  168. package/esm/models/internchatchoice.d.ts +4 -4
  169. package/esm/models/internchatchoice.js +3 -3
  170. package/esm/models/messagesmessageparam.d.ts +8 -8
  171. package/esm/models/messagesmessageparam.js +6 -7
  172. package/esm/models/operations/createbatches.d.ts +59 -0
  173. package/esm/models/operations/createbatches.js +23 -0
  174. package/esm/models/operations/deletebatch.d.ts +58 -0
  175. package/esm/models/operations/deletebatch.js +21 -0
  176. package/esm/models/operations/getbatches.d.ts +58 -0
  177. package/esm/models/operations/getbatches.js +21 -0
  178. package/esm/models/operations/index.d.ts +4 -0
  179. package/esm/models/operations/index.js +4 -0
  180. package/esm/models/operations/listbatches.d.ts +87 -0
  181. package/esm/models/operations/listbatches.js +40 -0
  182. package/esm/models/oranthropicbashtoolresult.d.ts +43 -0
  183. package/esm/models/oranthropicbashtoolresult.js +49 -0
  184. package/esm/models/oranthropiccontentblock.d.ts +25 -0
  185. package/esm/models/oranthropiccontentblock.js +45 -0
  186. package/esm/models/oranthropicnullablecaller.d.ts +12 -0
  187. package/esm/models/oranthropicnullablecaller.js +19 -0
  188. package/esm/models/oranthropicservertooluseblock.d.ts +15 -0
  189. package/esm/models/oranthropicservertooluseblock.js +19 -0
  190. package/esm/models/oranthropicshelltoolresult.d.ts +43 -0
  191. package/esm/models/oranthropicshelltoolresult.js +50 -0
  192. package/esm/models/oranthropicstopreason.d.ts +16 -0
  193. package/esm/models/oranthropicstopreason.js +18 -0
  194. package/esm/models/outputfusionservertoolitem.d.ts +8 -8
  195. package/esm/models/outputfusionservertoolitem.js +8 -8
  196. package/esm/models/publicendpoint.d.ts +8 -0
  197. package/esm/models/publicendpoint.js +4 -0
  198. package/esm/models/speechinputreference.d.ts +4 -3
  199. package/esm/models/speechinputreference.js +2 -0
  200. package/esm/models/speechinputreferenceaudio.d.ts +1 -1
  201. package/esm/models/speechinputreferenceaudioinput.d.ts +8 -3
  202. package/esm/models/speechinputreferenceaudioinput.js +2 -1
  203. package/esm/models/speechinputreferenceimage.d.ts +21 -0
  204. package/esm/models/speechinputreferenceimage.js +20 -0
  205. package/esm/models/speechinputreferenceimageinput.d.ts +18 -0
  206. package/esm/models/speechinputreferenceimageinput.js +13 -0
  207. package/esm/models/speechinputreferencetext.d.ts +2 -2
  208. package/esm/models/speechrequest.d.ts +1 -1
  209. package/esm/models/submitgenerationfeedbackrequest.d.ts +4 -4
  210. package/esm/models/submitgenerationfeedbackrequest.js +3 -4
  211. package/esm/sdk/batch.d.ts +37 -0
  212. package/esm/sdk/batch.js +50 -0
  213. package/esm/sdk/sdk.d.ts +3 -0
  214. package/esm/sdk/sdk.js +4 -0
  215. package/jsr.json +1 -1
  216. package/package.json +7 -7
@@ -0,0 +1,50 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 254a218f7d6b
4
+ */
5
+ import { batchCreateBatches } from "../funcs/batchCreateBatches.js";
6
+ import { batchDelete } from "../funcs/batchDelete.js";
7
+ import { batchGetBatches } from "../funcs/batchGetBatches.js";
8
+ import { batchList } from "../funcs/batchList.js";
9
+ import { ClientSDK } from "../lib/sdks.js";
10
+ import { unwrapAsync } from "../types/fp.js";
11
+ import { unwrapResultIterator } from "../types/operations.js";
12
+ export class Batch extends ClientSDK {
13
+ /**
14
+ * List batches
15
+ *
16
+ * @remarks
17
+ * Lists batches in the workspace of the authenticating API key, newest first. To fetch the next page, pass the previous page's `last_id` as `after`. List items omit `results`. Use `GET /batches/{id}` to get them. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
18
+ */
19
+ async list(request, options) {
20
+ return unwrapResultIterator(batchList(this, request, options));
21
+ }
22
+ /**
23
+ * Create a batch
24
+ *
25
+ * @remarks
26
+ * Creates a batch of requests that run asynchronously against a single endpoint (`/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/embeddings`). Returns `202` with `status: "validating"`. Poll `GET /batches/{id}` for progress and results. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
27
+ */
28
+ async createBatches(request, options) {
29
+ return unwrapAsync(batchCreateBatches(this, request, options));
30
+ }
31
+ /**
32
+ * Delete a batch
33
+ *
34
+ * @remarks
35
+ * Deletes a batch in a terminal status (`completed`, `failed`, `expired`, or `cancelled`) and its stored requests and results. Batches still in progress return `409`. Billing and usage records are kept. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
36
+ */
37
+ async delete(request, options) {
38
+ return unwrapAsync(batchDelete(this, request, options));
39
+ }
40
+ /**
41
+ * Get a batch
42
+ *
43
+ * @remarks
44
+ * Returns a batch with its status and request counts. Batches in a terminal status include `results`. Failed batches report the reason in `error.message`. See the [Batch API Quickstart](https://openrouter.ai/docs/batch-quickstart).
45
+ */
46
+ async getBatches(request, options) {
47
+ return unwrapAsync(batchGetBatches(this, request, options));
48
+ }
49
+ }
50
+ //# sourceMappingURL=batch.js.map
package/esm/sdk/sdk.d.ts CHANGED
@@ -2,6 +2,7 @@ import { ClientSDK } from "../lib/sdks.js";
2
2
  import { Alpha } from "./alpha.js";
3
3
  import { Analytics } from "./analytics.js";
4
4
  import { APIKeys } from "./apikeys.js";
5
+ import { Batch } from "./batch.js";
5
6
  import { Benchmarks } from "./benchmarks.js";
6
7
  import { Beta } from "./beta.js";
7
8
  import { BYOK } from "./byok.js";
@@ -49,6 +50,8 @@ export declare class OpenRouter extends ClientSDK {
49
50
  get stt(): STT;
50
51
  private _oAuth?;
51
52
  get oAuth(): OAuth;
53
+ private _batch?;
54
+ get batch(): Batch;
52
55
  private _benchmarks?;
53
56
  get benchmarks(): Benchmarks;
54
57
  private _byok?;
package/esm/sdk/sdk.js CHANGED
@@ -6,6 +6,7 @@ import { ClientSDK } from "../lib/sdks.js";
6
6
  import { Alpha } from "./alpha.js";
7
7
  import { Analytics } from "./analytics.js";
8
8
  import { APIKeys } from "./apikeys.js";
9
+ import { Batch } from "./batch.js";
9
10
  import { Benchmarks } from "./benchmarks.js";
10
11
  import { Beta } from "./beta.js";
11
12
  import { BYOK } from "./byok.js";
@@ -56,6 +57,9 @@ export class OpenRouter extends ClientSDK {
56
57
  get oAuth() {
57
58
  return (this._oAuth ?? (this._oAuth = new OAuth(this._options)));
58
59
  }
60
+ get batch() {
61
+ return (this._batch ?? (this._batch = new Batch(this._options)));
62
+ }
59
63
  get benchmarks() {
60
64
  return (this._benchmarks ?? (this._benchmarks = new Benchmarks(this._options)));
61
65
  }
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "1.3.28",
5
+ "version": "1.3.30",
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": "1.3.28",
3
+ "version": "1.3.30",
4
4
  "author": "OpenRouter",
5
5
  "description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.",
6
6
  "keywords": [
@@ -21,8 +21,8 @@
21
21
  "license": "Apache-2.0",
22
22
  "packageManager": "pnpm@10.22.0",
23
23
  "publishConfig": {
24
- "provenance": true,
25
- "access": "public"
24
+ "access": "public",
25
+ "provenance": true
26
26
  },
27
27
  "type": "module",
28
28
  "main": "./esm/index.js",
@@ -73,15 +73,15 @@
73
73
  "lint": "eslint --cache --max-warnings=0 src",
74
74
  "build": "tsc && node scripts/unbarrel-imports.js",
75
75
  "prepublishOnly": "npm run build",
76
- "prepare": "npm run build",
77
- "test": "vitest --run --project unit",
78
- "test:e2e": "vitest --run --project e2e",
79
76
  "typecheck:transit": "exit 0",
80
77
  "compile": "tsc && node scripts/unbarrel-imports.js",
81
78
  "postinstall": "node scripts/check-types.js || true",
79
+ "test:e2e": "vitest --run --project e2e",
82
80
  "test:transit": "exit 0",
83
81
  "test:watch": "vitest --watch --project unit",
84
- "typecheck": "tsc --noEmit"
82
+ "typecheck": "tsc --noEmit",
83
+ "prepare": "npm run build",
84
+ "test": "vitest --run --project unit"
85
85
  },
86
86
  "peerDependencies": {
87
87