@cartesia/cartesia-js 3.0.0-b8 → 3.0.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 (171) hide show
  1. package/CHANGELOG.md +134 -0
  2. package/README.md +18 -7
  3. package/backcompat/errors.d.mts +1 -2
  4. package/backcompat/errors.d.mts.map +1 -1
  5. package/backcompat/errors.d.ts +1 -2
  6. package/backcompat/errors.d.ts.map +1 -1
  7. package/backcompat/errors.js +1 -21
  8. package/backcompat/errors.js.map +1 -1
  9. package/backcompat/errors.mjs +1 -20
  10. package/backcompat/errors.mjs.map +1 -1
  11. package/backcompat/index.d.mts +1 -0
  12. package/backcompat/index.d.mts.map +1 -1
  13. package/backcompat/index.d.ts +1 -0
  14. package/backcompat/index.d.ts.map +1 -1
  15. package/backcompat/index.js +41 -2
  16. package/backcompat/index.js.map +1 -1
  17. package/backcompat/index.mjs +41 -2
  18. package/backcompat/index.mjs.map +1 -1
  19. package/backcompat/tts-wrapper.d.mts +48 -8
  20. package/backcompat/tts-wrapper.d.mts.map +1 -1
  21. package/backcompat/tts-wrapper.d.ts +48 -8
  22. package/backcompat/tts-wrapper.d.ts.map +1 -1
  23. package/backcompat/tts-wrapper.js +97 -35
  24. package/backcompat/tts-wrapper.js.map +1 -1
  25. package/backcompat/tts-wrapper.mjs +98 -36
  26. package/backcompat/tts-wrapper.mjs.map +1 -1
  27. package/backcompat/types.d.mts +1 -1
  28. package/backcompat/types.d.mts.map +1 -1
  29. package/backcompat/types.d.ts +1 -1
  30. package/backcompat/types.d.ts.map +1 -1
  31. package/backcompat/utils.d.mts +4 -0
  32. package/backcompat/utils.d.mts.map +1 -0
  33. package/backcompat/utils.d.ts +4 -0
  34. package/backcompat/utils.d.ts.map +1 -0
  35. package/backcompat/utils.js +39 -0
  36. package/backcompat/utils.js.map +1 -0
  37. package/backcompat/utils.mjs +35 -0
  38. package/backcompat/utils.mjs.map +1 -0
  39. package/backcompat/voice-changer-wrapper.d.mts +5 -5
  40. package/backcompat/voice-changer-wrapper.d.mts.map +1 -1
  41. package/backcompat/voice-changer-wrapper.d.ts +5 -5
  42. package/backcompat/voice-changer-wrapper.d.ts.map +1 -1
  43. package/backcompat/voice-changer-wrapper.js +12 -12
  44. package/backcompat/voice-changer-wrapper.js.map +1 -1
  45. package/backcompat/voice-changer-wrapper.mjs +12 -12
  46. package/backcompat/voice-changer-wrapper.mjs.map +1 -1
  47. package/backcompat/voices-wrapper.d.mts +42 -9
  48. package/backcompat/voices-wrapper.d.mts.map +1 -1
  49. package/backcompat/voices-wrapper.d.ts +42 -9
  50. package/backcompat/voices-wrapper.d.ts.map +1 -1
  51. package/backcompat/voices-wrapper.js +67 -4
  52. package/backcompat/voices-wrapper.js.map +1 -1
  53. package/backcompat/voices-wrapper.mjs +64 -1
  54. package/backcompat/voices-wrapper.mjs.map +1 -1
  55. package/client.d.mts +10 -12
  56. package/client.d.mts.map +1 -1
  57. package/client.d.ts +10 -12
  58. package/client.d.ts.map +1 -1
  59. package/client.js +26 -14
  60. package/client.js.map +1 -1
  61. package/client.mjs +26 -14
  62. package/client.mjs.map +1 -1
  63. package/internal/parse.d.mts.map +1 -1
  64. package/internal/parse.d.ts.map +1 -1
  65. package/internal/parse.js +5 -0
  66. package/internal/parse.js.map +1 -1
  67. package/internal/parse.mjs +5 -0
  68. package/internal/parse.mjs.map +1 -1
  69. package/internal/tslib.js +17 -17
  70. package/internal/utils/query.d.mts +2 -0
  71. package/internal/utils/query.d.mts.map +1 -0
  72. package/internal/utils/query.d.ts +2 -0
  73. package/internal/utils/query.d.ts.map +1 -0
  74. package/internal/utils/query.js +10 -0
  75. package/internal/utils/query.js.map +1 -0
  76. package/internal/utils/query.mjs +6 -0
  77. package/internal/utils/query.mjs.map +1 -0
  78. package/internal/utils.d.mts +1 -0
  79. package/internal/utils.d.ts +1 -0
  80. package/internal/utils.js +1 -0
  81. package/internal/utils.js.map +1 -1
  82. package/internal/utils.mjs +1 -0
  83. package/package.json +10 -11
  84. package/resources/index.d.mts +1 -2
  85. package/resources/index.d.mts.map +1 -1
  86. package/resources/index.d.ts +1 -2
  87. package/resources/index.d.ts.map +1 -1
  88. package/resources/index.js +1 -3
  89. package/resources/index.js.map +1 -1
  90. package/resources/index.mjs +0 -1
  91. package/resources/index.mjs.map +1 -1
  92. package/resources/tts/index.d.mts +3 -1
  93. package/resources/tts/index.d.mts.map +1 -1
  94. package/resources/tts/index.d.ts +3 -1
  95. package/resources/tts/index.d.ts.map +1 -1
  96. package/resources/tts/index.js +6 -1
  97. package/resources/tts/index.js.map +1 -1
  98. package/resources/tts/index.mjs +2 -0
  99. package/resources/tts/index.mjs.map +1 -1
  100. package/resources/tts/internal-base.d.mts +6 -1
  101. package/resources/tts/internal-base.d.mts.map +1 -1
  102. package/resources/tts/internal-base.d.ts +6 -1
  103. package/resources/tts/internal-base.d.ts.map +1 -1
  104. package/resources/tts/internal-base.js +9 -1
  105. package/resources/tts/internal-base.js.map +1 -1
  106. package/resources/tts/internal-base.mjs +7 -0
  107. package/resources/tts/internal-base.mjs.map +1 -1
  108. package/resources/tts/tts.d.mts +129 -11
  109. package/resources/tts/tts.d.mts.map +1 -1
  110. package/resources/tts/tts.d.ts +129 -11
  111. package/resources/tts/tts.d.ts.map +1 -1
  112. package/resources/tts/tts.js +39 -0
  113. package/resources/tts/tts.js.map +1 -1
  114. package/resources/tts/tts.mjs +39 -0
  115. package/resources/tts/tts.mjs.map +1 -1
  116. package/resources/tts/ws.d.mts +123 -4
  117. package/resources/tts/ws.d.mts.map +1 -1
  118. package/resources/tts/ws.d.ts +123 -4
  119. package/resources/tts/ws.d.ts.map +1 -1
  120. package/resources/tts/ws.js +360 -15
  121. package/resources/tts/ws.js.map +1 -1
  122. package/resources/tts/ws.mjs +359 -14
  123. package/resources/tts/ws.mjs.map +1 -1
  124. package/resources/voice-changer.d.mts +6 -6
  125. package/resources/voice-changer.d.mts.map +1 -1
  126. package/resources/voice-changer.d.ts +6 -6
  127. package/resources/voice-changer.d.ts.map +1 -1
  128. package/resources/voice-changer.js +6 -1
  129. package/resources/voice-changer.js.map +1 -1
  130. package/resources/voice-changer.mjs +6 -1
  131. package/resources/voice-changer.mjs.map +1 -1
  132. package/resources/voices.d.mts +1 -1
  133. package/resources/voices.d.mts.map +1 -1
  134. package/resources/voices.d.ts +1 -1
  135. package/resources/voices.d.ts.map +1 -1
  136. package/src/backcompat/errors.ts +16 -44
  137. package/src/backcompat/index.ts +78 -34
  138. package/src/backcompat/tts-wrapper.ts +409 -303
  139. package/src/backcompat/types.ts +13 -13
  140. package/src/backcompat/utils.ts +34 -0
  141. package/src/backcompat/voice-changer-wrapper.ts +59 -56
  142. package/src/backcompat/voices-wrapper.ts +238 -150
  143. package/src/client.ts +45 -29
  144. package/src/internal/parse.ts +6 -0
  145. package/src/internal/utils/query.ts +7 -0
  146. package/src/internal/utils.ts +1 -0
  147. package/src/resources/index.ts +3 -1
  148. package/src/resources/tts/index.ts +6 -0
  149. package/src/resources/tts/internal-base.ts +12 -1
  150. package/src/resources/tts/tts.ts +187 -13
  151. package/src/resources/tts/ws.ts +428 -16
  152. package/src/resources/voice-changer.ts +12 -7
  153. package/src/resources/voices.ts +2 -1
  154. package/src/version.ts +1 -1
  155. package/version.d.mts +1 -1
  156. package/version.d.mts.map +1 -1
  157. package/version.d.ts +1 -1
  158. package/version.d.ts.map +1 -1
  159. package/version.js +1 -1
  160. package/version.js.map +1 -1
  161. package/version.mjs +1 -1
  162. package/version.mjs.map +1 -1
  163. package/resources/infill.d.mts +0 -71
  164. package/resources/infill.d.mts.map +0 -1
  165. package/resources/infill.d.ts +0 -71
  166. package/resources/infill.d.ts.map +0 -1
  167. package/resources/infill.js +0 -35
  168. package/resources/infill.js.map +0 -1
  169. package/resources/infill.mjs +0 -31
  170. package/resources/infill.mjs.map +0 -1
  171. package/src/resources/infill.ts +0 -100
package/CHANGELOG.md CHANGED
@@ -1,5 +1,139 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.0 (2026-03-02)
4
+
5
+ Full Changelog: [v3.0.0-b17...v3.0.0](https://github.com/cartesia-ai/cartesia-js/compare/v3.0.0-b17...v3.0.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** add flush_id to chunks response and binary response to voice changer ([1d98580](https://github.com/cartesia-ai/cartesia-js/commit/1d98580ffe61be7a86d28bdf1ee5bb1d50df7382))
10
+ * **api:** group infill output_format ([ac4ded7](https://github.com/cartesia-ai/cartesia-js/commit/ac4ded743720fedbc4517c9c94ed75e79bb2f18b))
11
+ * **api:** infill output_format ([c3d3dac](https://github.com/cartesia-ai/cartesia-js/commit/c3d3dac2d3756038b2d199a75c204413c23a19d1))
12
+ * **api:** infill response ([b9cbaa2](https://github.com/cartesia-ai/cartesia-js/commit/b9cbaa27c220db26462aee7c80692df89edeb8fe))
13
+ * **api:** inline websocketresponse type definitions ([c5cbfbf](https://github.com/cartesia-ai/cartesia-js/commit/c5cbfbfeca17b0f799d791a9ba32c8d2fd18cda8))
14
+ * **api:** move infill and websocket_connect ([a987ebd](https://github.com/cartesia-ai/cartesia-js/commit/a987ebdddc35712a26bbad443672ee45a78b4afc))
15
+ * **api:** update headline example ([715db7e](https://github.com/cartesia-ai/cartesia-js/commit/715db7e02534a0e2254da61fc7342b240e7f251e))
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **client:** avoid memory leak with abort signals ([fb63460](https://github.com/cartesia-ai/cartesia-js/commit/fb63460d3701ac1684f5385f7d882f5e71747f14))
21
+ * **client:** avoid removing abort listener too early ([b89ee81](https://github.com/cartesia-ai/cartesia-js/commit/b89ee81caf0ae443eeac9898fb807c34545eb70b))
22
+ * **docs/contributing:** correct pnpm link command ([d5830ae](https://github.com/cartesia-ai/cartesia-js/commit/d5830aed6fd927265bfdbbe875aed7093e0f24cc))
23
+ * **internal:** skip tests that depend on mock server ([e55b44f](https://github.com/cartesia-ai/cartesia-js/commit/e55b44f8402a4f59f59e4780e06300260c9b8170))
24
+
25
+
26
+ ### Chores
27
+
28
+ * **client:** do not parse responses with empty content-length ([ed0b69e](https://github.com/cartesia-ai/cartesia-js/commit/ed0b69e1c1d6d7854bccfb2d65ef273cc9564d93))
29
+ * **client:** restructure abort controller binding ([e969433](https://github.com/cartesia-ai/cartesia-js/commit/e9694332f28915c81908a09bffc1d877befb848f))
30
+ * **internal/client:** fix form-urlencoded requests ([80aceb7](https://github.com/cartesia-ai/cartesia-js/commit/80aceb72e17b1c6989e2ea9e53b83d29cdfe766e))
31
+ * **internal:** avoid type checking errors with ts-reset ([3eb6f15](https://github.com/cartesia-ai/cartesia-js/commit/3eb6f15cb8faa30ab5b759599a0bf74243851a5b))
32
+ * **internal:** fix pagination internals not accepting option promises ([822f34f](https://github.com/cartesia-ai/cartesia-js/commit/822f34fab79bd7274e15fe383798696e9ae3930b))
33
+ * **internal:** move stringifyQuery implementation to internal function ([ec23288](https://github.com/cartesia-ai/cartesia-js/commit/ec23288564c1586c22e64581ff4d77763a00a268))
34
+ * **internal:** remove mock server code ([2fe0e85](https://github.com/cartesia-ai/cartesia-js/commit/2fe0e85f5884a797b9bbbe80013e30f17f6ca5cb))
35
+ * **internal:** upgrade pnpm ([948fa2d](https://github.com/cartesia-ai/cartesia-js/commit/948fa2dbdc13671eda76493bbac27976fb70649b))
36
+ * **internal:** upgrade pnpm version ([9cc6aa2](https://github.com/cartesia-ai/cartesia-js/commit/9cc6aa2b033369cea8ade26c92bca06c3f6d4a79))
37
+ * update mock server docs ([4f1e1c6](https://github.com/cartesia-ai/cartesia-js/commit/4f1e1c6f34149aa4a65d4d562e32d19f8c247ce9))
38
+
39
+ ## 3.0.0-b17 (2026-01-30)
40
+
41
+ Full Changelog: [v3.0.0-b16...v3.0.0-b17](https://github.com/cartesia-ai/cartesia-js/compare/v3.0.0-b16...v3.0.0-b17)
42
+
43
+ ### Features
44
+
45
+ * **api:** update api version ([e98298c](https://github.com/cartesia-ai/cartesia-js/commit/e98298c56b49f1bf1a8e494edfaafd78cc5ebd4c))
46
+
47
+ ## 3.0.0-b16 (2026-01-29)
48
+
49
+ Full Changelog: [v3.0.0-b15...v3.0.0-b16](https://github.com/cartesia-ai/cartesia-js/compare/v3.0.0-b15...v3.0.0-b16)
50
+
51
+ ### Features
52
+
53
+ * **api:** add jsr key to npm target ([5afbf2e](https://github.com/cartesia-ai/cartesia-js/commit/5afbf2e0bad2551e2dbaa0be31553f98fdeb9724))
54
+ * **api:** update js target ([a39e957](https://github.com/cartesia-ai/cartesia-js/commit/a39e9571aa58fb6e1bbddeb523ce83527293a58b))
55
+
56
+ ## 3.0.0-b15 (2026-01-29)
57
+
58
+ Full Changelog: [v3.0.0-b14...v3.0.0-b15](https://github.com/cartesia-ai/cartesia-js/compare/v3.0.0-b14...v3.0.0-b15)
59
+
60
+ ### Features
61
+
62
+ * **api:** add release environment ([501864c](https://github.com/cartesia-ai/cartesia-js/commit/501864ca051ad7197b54bbb8c08039bb883ff4fd))
63
+ * **api:** update release environment ([c148860](https://github.com/cartesia-ai/cartesia-js/commit/c148860eea503d0720b08e7d187272625491d918))
64
+ * ws context helpers ([d1898fb](https://github.com/cartesia-ai/cartesia-js/commit/d1898fbe768daeb527282a4e7bcc53d4e4f7af51))
65
+
66
+
67
+ ### Bug Fixes
68
+
69
+ * bytes returns arraybuffer ([#26](https://github.com/cartesia-ai/cartesia-js/issues/26)) ([229ea0f](https://github.com/cartesia-ai/cartesia-js/commit/229ea0f08c21d9a5fb56be8fac2a044368a33c34))
70
+ * export correct client ([#21](https://github.com/cartesia-ai/cartesia-js/issues/21)) ([e8456dd](https://github.com/cartesia-ai/cartesia-js/commit/e8456dd39a91f55cb27cd038cef0dbcd1b1acf3e))
71
+ * include message in `TimeoutError` for `.fernignore` clients. ([#41](https://github.com/cartesia-ai/cartesia-js/issues/41)) ([d50a5b9](https://github.com/cartesia-ai/cartesia-js/commit/d50a5b9a30a3c7001572d60314a6a3bb752ac28f))
72
+ * upgrade qs from 6.11.2 to 6.13.0 ([#24](https://github.com/cartesia-ai/cartesia-js/issues/24)) ([fddd4ac](https://github.com/cartesia-ai/cartesia-js/commit/fddd4acef6bd20d3859712b25f8774c6d04c2031))
73
+
74
+
75
+ ### Chores
76
+
77
+ * downgrade emittery for cjs compatiblity ([#23](https://github.com/cartesia-ai/cartesia-js/issues/23)) ([015d941](https://github.com/cartesia-ai/cartesia-js/commit/015d9414cff876e44adf776cecca73bc081c2b48))
78
+ * export `WebPlayer` ([#31](https://github.com/cartesia-ai/cartesia-js/issues/31)) ([e31186e](https://github.com/cartesia-ai/cartesia-js/commit/e31186e75fbb22c5a79d82ddea5b160f3dd05e04))
79
+ * fix compile ([#64](https://github.com/cartesia-ai/cartesia-js/issues/64)) ([1de7fd0](https://github.com/cartesia-ai/cartesia-js/commit/1de7fd0b7891e54a13a78699516e610886578681))
80
+ * **internal:** codegen related update ([e44abc2](https://github.com/cartesia-ai/cartesia-js/commit/e44abc24b5c18735c74f1a9345b6f9d312aad338))
81
+ * remove `ci.yml` branch ([#22](https://github.com/cartesia-ai/cartesia-js/issues/22)) ([6d2201a](https://github.com/cartesia-ai/cartesia-js/commit/6d2201a7d13172768b5d17c2e8dc5ebfd3d9bcd2))
82
+ * remove fernignore on ArrayBuffer ([#55](https://github.com/cartesia-ai/cartesia-js/issues/55)) ([b10bbc7](https://github.com/cartesia-ai/cartesia-js/commit/b10bbc75335089004b38f4b547d92d789f15275c))
83
+ * remove ignored `README.md` ([#56](https://github.com/cartesia-ai/cartesia-js/issues/56)) ([ee6d2dd](https://github.com/cartesia-ai/cartesia-js/commit/ee6d2dd17b0e392189e553affdc411fcde42d5ed))
84
+ * remove STT .fernignore ([#65](https://github.com/cartesia-ai/cartesia-js/issues/65)) ([3c0ce3e](https://github.com/cartesia-ai/cartesia-js/commit/3c0ce3e0449166e3e7dc766eeeb90a991e12e401))
85
+ * sync repo ([1ad7016](https://github.com/cartesia-ai/cartesia-js/commit/1ad7016dc4222eb858389a0eed7dcd0558713346))
86
+ * update `apiKeyHeader` to `apiKey` ([#20](https://github.com/cartesia-ai/cartesia-js/issues/20)) ([0f54d2e](https://github.com/cartesia-ai/cartesia-js/commit/0f54d2ee812cd080c8722a55a157b63a37f885d5))
87
+ * update README ([#58](https://github.com/cartesia-ai/cartesia-js/issues/58)) ([c24f0a6](https://github.com/cartesia-ai/cartesia-js/commit/c24f0a6bfb43647723e322215ffc59f3b307b700))
88
+ * Update README.md ([#32](https://github.com/cartesia-ai/cartesia-js/issues/32)) ([8d36b88](https://github.com/cartesia-ai/cartesia-js/commit/8d36b88f76a56b470e57d16190f127d915e934e9))
89
+ * update SDK settings ([e2be8ea](https://github.com/cartesia-ai/cartesia-js/commit/e2be8ea4b2dbc3891029efa3f40bec512622f78d))
90
+
91
+ ## 3.0.0-b14 (2026-01-23)
92
+
93
+ Full Changelog: [v3.0.0-b13...v3.0.0-b14](https://github.com/cartesia-ai/cartesia-js-internal/compare/v3.0.0-b13...v3.0.0-b14)
94
+
95
+ ## 3.0.0-b13 (2026-01-21)
96
+
97
+ Full Changelog: [v3.0.0-b12...v3.0.0-b13](https://github.com/cartesia-ai/cartesia-js-internal/compare/v3.0.0-b12...v3.0.0-b13)
98
+
99
+ ### Features
100
+
101
+ * **api:** remove -> delete ([04c4d03](https://github.com/cartesia-ai/cartesia-js-internal/commit/04c4d03a3e3525ad0e8c72a6372602319cdedb56))
102
+ * wrapper remove -> delete ([e856bda](https://github.com/cartesia-ai/cartesia-js-internal/commit/e856bda9d6bfb07c6df08839087de24380b336be))
103
+
104
+ ## 3.0.0-b12 (2026-01-21)
105
+
106
+ Full Changelog: [v3.0.0-b11...v3.0.0-b12](https://github.com/cartesia-ai/cartesia-js-internal/compare/v3.0.0-b11...v3.0.0-b12)
107
+
108
+ ### Features
109
+
110
+ * **api:** delete -> remove ([d51a281](https://github.com/cartesia-ai/cartesia-js-internal/commit/d51a2812bb7e5be98d1aa4248e90acc3a4aae0d2))
111
+ * update backcompat voices helpers ([ca4cc6a](https://github.com/cartesia-ai/cartesia-js-internal/commit/ca4cc6a98c2f9165689916e22afd784f56671948))
112
+
113
+ ## 3.0.0-b11 (2026-01-20)
114
+
115
+ Full Changelog: [v3.0.0-b10...v3.0.0-b11](https://github.com/cartesia-ai/cartesia-js-internal/compare/v3.0.0-b10...v3.0.0-b11)
116
+
117
+ ### Features
118
+
119
+ * **api:** binary response types ([5bdf3e3](https://github.com/cartesia-ai/cartesia-js-internal/commit/5bdf3e3be2867099b8187c186745a509991df91e))
120
+
121
+ ## 3.0.0-b10 (2026-01-20)
122
+
123
+ Full Changelog: [v3.0.0-b9...v3.0.0-b10](https://github.com/cartesia-ai/cartesia-js-internal/compare/v3.0.0-b9...v3.0.0-b10)
124
+
125
+ ### Features
126
+
127
+ * **api:** voice changer response ([5ca129b](https://github.com/cartesia-ai/cartesia-js-internal/commit/5ca129b1dfa59043560c7866a2cdd87fb03b42bf))
128
+
129
+ ## 3.0.0-b9 (2026-01-16)
130
+
131
+ Full Changelog: [v3.0.0-b8...v3.0.0-b9](https://github.com/cartesia-ai/cartesia-js-internal/compare/v3.0.0-b8...v3.0.0-b9)
132
+
133
+ ### Features
134
+
135
+ * refine backcompat layer with strict Node stream return types ([0fc86b8](https://github.com/cartesia-ai/cartesia-js-internal/commit/0fc86b840a7b94fa6017aa454225ef6ee3a31d5f))
136
+
3
137
  ## 3.0.0-b8 (2026-01-16)
4
138
 
5
139
  Full Changelog: [v3.0.0-b7...v3.0.0-b8](https://github.com/cartesia-ai/cartesia-js-internal/compare/v3.0.0-b7...v3.0.0-b8)
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  [![NPM version](<https://img.shields.io/npm/v/@cartesia/cartesia-js.svg?label=npm%20(stable)>)](https://npmjs.org/package/@cartesia/cartesia-js) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@cartesia/cartesia-js)
4
4
 
5
+ > **Note:** This README is for the 3.x beta. For the stable 2.x series, see the [`branch-2.x`](https://github.com/cartesia-ai/cartesia-js/tree/branch-2.x) branch.
6
+
5
7
  This library provides convenient access to the Cartesia REST API from server-side TypeScript or JavaScript.
6
8
 
7
9
  The full API of this library can be found in [api.md](api.md).
@@ -23,13 +25,22 @@ The full API of this library can be found in [api.md](api.md).
23
25
  import Cartesia from '@cartesia/cartesia-js';
24
26
 
25
27
  const client = new Cartesia({
26
- apiKey: 'My API Key',
28
+ token: 'My Token',
27
29
  });
28
30
 
29
- const page = await client.voices.list();
30
- const voice = page.data[0];
31
+ const response = await client.tts.generate({
32
+ model_id: 'sonic-3',
33
+ output_format: {
34
+ container: 'wav',
35
+ encoding: 'pcm_f32le',
36
+ sample_rate: 44100,
37
+ },
38
+ transcript: "I have to say that I'd rather stay awake when I'm asleep.",
39
+ voice: { mode: 'id', id: 'e07c00bc-4134-4eae-9ea4-1a55fb45746b' },
40
+ });
31
41
 
32
- console.log(voice.id);
42
+ const content = await response.blob();
43
+ console.log(content);
33
44
  ```
34
45
 
35
46
  ### Request & Response types
@@ -185,7 +196,7 @@ while (page.hasNextPage()) {
185
196
 
186
197
  ## Default Headers
187
198
 
188
- We automatically send the `cartesia-version` header set to `2025-04-16`.
199
+ We automatically send the `cartesia-version` header set to `2025-11-04`.
189
200
 
190
201
  If you need to, you can override it by setting default headers on a per-request basis.
191
202
 
@@ -300,7 +311,7 @@ parameter. This library doesn't validate at runtime that the request matches the
300
311
  send will be sent as-is.
301
312
 
302
313
  ```ts
303
- client.voices.list({
314
+ client.tts.generate({
304
315
  // ...
305
316
  // @ts-expect-error baz is not yet public
306
317
  baz: 'undocumented option',
@@ -410,7 +421,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
410
421
 
411
422
  We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
412
423
 
413
- We are keen for your feedback; please open an [issue](https://www.github.com/cartesia-ai/cartesia-js-internal/issues) with questions, bugs, or suggestions.
424
+ We are keen for your feedback; please open an [issue](https://www.github.com/cartesia-ai/cartesia-js/issues) with questions, bugs, or suggestions.
414
425
 
415
426
  ## Requirements
416
427
 
@@ -2,7 +2,7 @@
2
2
  export declare class CartesiaClientError extends Error {
3
3
  readonly statusCode?: number;
4
4
  readonly body?: unknown;
5
- constructor({ message, statusCode, body, }: {
5
+ constructor({ message, statusCode, body }: {
6
6
  message?: string;
7
7
  statusCode?: number;
8
8
  body?: unknown;
@@ -12,5 +12,4 @@ export declare class CartesiaClientError extends Error {
12
12
  export declare class CartesiaTimeoutError extends Error {
13
13
  constructor(message: string);
14
14
  }
15
- export declare function wrap<T>(promise: Promise<T>): Promise<T>;
16
15
  //# sourceMappingURL=errors.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.mts","sourceRoot":"","sources":["../src/backcompat/errors.ts"],"names":[],"mappings":"AAEA,kGAAkG;AAClG,qBAAa,mBAAoB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;gBAEZ,EACX,OAAO,EACP,UAAU,EACV,IAAI,GACJ,EAAE;QACF,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,IAAI,CAAC,EAAE,OAAO,CAAC;KACf;CAUD;AAED,iEAAiE;AACjE,qBAAa,oBAAqB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM;CAI3B;AAED,wBAAsB,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAgB7D"}
1
+ {"version":3,"file":"errors.d.mts","sourceRoot":"","sources":["../src/backcompat/errors.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;gBAEZ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE;CAUrG;AAED,iEAAiE;AACjE,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM;CAI5B"}
@@ -2,7 +2,7 @@
2
2
  export declare class CartesiaClientError extends Error {
3
3
  readonly statusCode?: number;
4
4
  readonly body?: unknown;
5
- constructor({ message, statusCode, body, }: {
5
+ constructor({ message, statusCode, body }: {
6
6
  message?: string;
7
7
  statusCode?: number;
8
8
  body?: unknown;
@@ -12,5 +12,4 @@ export declare class CartesiaClientError extends Error {
12
12
  export declare class CartesiaTimeoutError extends Error {
13
13
  constructor(message: string);
14
14
  }
15
- export declare function wrap<T>(promise: Promise<T>): Promise<T>;
16
15
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/backcompat/errors.ts"],"names":[],"mappings":"AAEA,kGAAkG;AAClG,qBAAa,mBAAoB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;gBAEZ,EACX,OAAO,EACP,UAAU,EACV,IAAI,GACJ,EAAE;QACF,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,IAAI,CAAC,EAAE,OAAO,CAAC;KACf;CAUD;AAED,iEAAiE;AACjE,qBAAa,oBAAqB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM;CAI3B;AAED,wBAAsB,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAgB7D"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/backcompat/errors.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;gBAEZ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE;CAUrG;AAED,iEAAiE;AACjE,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM;CAI5B"}
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CartesiaTimeoutError = exports.CartesiaClientError = void 0;
4
- exports.wrap = wrap;
5
- const error_1 = require("../core/error.js");
6
4
  /** @deprecated Use {@link CartesiaError} or specialized error classes from core/error instead. */
7
5
  class CartesiaClientError extends Error {
8
- constructor({ message, statusCode, body, }) {
6
+ constructor({ message, statusCode, body }) {
9
7
  super(message);
10
8
  Object.setPrototypeOf(this, CartesiaClientError.prototype);
11
9
  if (statusCode != null) {
@@ -25,22 +23,4 @@ class CartesiaTimeoutError extends Error {
25
23
  }
26
24
  }
27
25
  exports.CartesiaTimeoutError = CartesiaTimeoutError;
28
- async function wrap(promise) {
29
- try {
30
- return await promise;
31
- }
32
- catch (e) {
33
- if (e instanceof error_1.APIConnectionTimeoutError) {
34
- throw new CartesiaTimeoutError(e.message);
35
- }
36
- if (e instanceof error_1.APIError) {
37
- throw new CartesiaClientError({
38
- message: e.message,
39
- statusCode: e.status,
40
- body: e.error,
41
- });
42
- }
43
- throw e;
44
- }
45
- }
46
26
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/backcompat/errors.ts"],"names":[],"mappings":";;;AAmCA,oBAgBC;AAnDD,4CAAoE;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AA,kGAAkG;AAClG,MAAa,mBAAoB,SAAQ,KAAK;IAI5C,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAA6D;QAClG,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;QAC3D,IAAI,UAAU,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC/B,CAAC;QACD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,CAAC;IACH,CAAC;CACF;AAdD,kDAcC;AAED,iEAAiE;AACjE,MAAa,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAC9D,CAAC;CACF;AALD,oDAKC"}
@@ -1,7 +1,6 @@
1
- import { APIConnectionTimeoutError, APIError } from "../core/error.mjs";
2
1
  /** @deprecated Use {@link CartesiaError} or specialized error classes from core/error instead. */
3
2
  export class CartesiaClientError extends Error {
4
- constructor({ message, statusCode, body, }) {
3
+ constructor({ message, statusCode, body }) {
5
4
  super(message);
6
5
  Object.setPrototypeOf(this, CartesiaClientError.prototype);
7
6
  if (statusCode != null) {
@@ -19,22 +18,4 @@ export class CartesiaTimeoutError extends Error {
19
18
  Object.setPrototypeOf(this, CartesiaTimeoutError.prototype);
20
19
  }
21
20
  }
22
- export async function wrap(promise) {
23
- try {
24
- return await promise;
25
- }
26
- catch (e) {
27
- if (e instanceof APIConnectionTimeoutError) {
28
- throw new CartesiaTimeoutError(e.message);
29
- }
30
- if (e instanceof APIError) {
31
- throw new CartesiaClientError({
32
- message: e.message,
33
- statusCode: e.status,
34
- body: e.error,
35
- });
36
- }
37
- throw e;
38
- }
39
- }
40
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,CAAC,CAAC;QACJ,CAAC;QACD,MAAM,CAAC,CAAC;IACT,CAAC;AACF,CAAC"}
1
+ {"version":3,"file":"errors.mjs","sourceRoot":"","sources":["../src/backcompat/errors.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAI5C,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAA6D;QAClG,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;QAC3D,IAAI,UAAU,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC/B,CAAC;QACD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,CAAC;IACH,CAAC;CACF;AAED,iEAAiE;AACjE,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAC9D,CAAC;CACF"}
@@ -19,4 +19,5 @@ export * from "./voices-wrapper.mjs";
19
19
  export * from "./voice-changer-wrapper.mjs";
20
20
  export * from "./types.mjs";
21
21
  export * from "./errors.mjs";
22
+ export * from "./utils.mjs";
22
23
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/backcompat/index.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;OACd,EAAE,aAAa,EAAE;OACjB,EAAE,mBAAmB,EAAE;OACvB,KAAK,EAAE,qBAAqB,EAAE;AAErC;;;;GAIG;AACH,qBAAa,cAAc;IAC1B,OAAO,CAAC,MAAM,CAAW;IAClB,GAAG,EAAE,UAAU,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,mBAAmB,CAAC;gBAE7B,OAAO,GAAE,qBAA0B;CAkB/C"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/backcompat/index.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;OACd,EAAE,aAAa,EAAE;OACjB,EAAE,mBAAmB,EAAE;OAEvB,KAAK,EAAE,qBAAqB,EAAY;AAuC/C;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAW;IAClB,GAAG,EAAE,UAAU,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,mBAAmB,CAAC;gBAE7B,OAAO,GAAE,qBAA0B;CAuBhD"}
@@ -19,4 +19,5 @@ export * from "./voices-wrapper.js";
19
19
  export * from "./voice-changer-wrapper.js";
20
20
  export * from "./types.js";
21
21
  export * from "./errors.js";
22
+ export * from "./utils.js";
22
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/backcompat/index.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;OACd,EAAE,aAAa,EAAE;OACjB,EAAE,mBAAmB,EAAE;OACvB,KAAK,EAAE,qBAAqB,EAAE;AAErC;;;;GAIG;AACH,qBAAa,cAAc;IAC1B,OAAO,CAAC,MAAM,CAAW;IAClB,GAAG,EAAE,UAAU,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,mBAAmB,CAAC;gBAE7B,OAAO,GAAE,qBAA0B;CAkB/C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/backcompat/index.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;OACd,EAAE,aAAa,EAAE;OACjB,EAAE,mBAAmB,EAAE;OAEvB,KAAK,EAAE,qBAAqB,EAAY;AAuC/C;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAW;IAClB,GAAG,EAAE,UAAU,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,mBAAmB,CAAC;gBAE7B,OAAO,GAAE,qBAA0B;CAuBhD"}
@@ -6,6 +6,38 @@ const client_1 = require("../client.js");
6
6
  const tts_wrapper_1 = require("./tts-wrapper.js");
7
7
  const voices_wrapper_1 = require("./voices-wrapper.js");
8
8
  const voice_changer_wrapper_1 = require("./voice-changer-wrapper.js");
9
+ const headers_1 = require("../internal/headers.js");
10
+ async function resolveSupplier(supplier) {
11
+ if (typeof supplier === 'function') {
12
+ return supplier();
13
+ }
14
+ return supplier;
15
+ }
16
+ class DynamicCartesia extends client_1.Cartesia {
17
+ constructor(options) {
18
+ super(options);
19
+ this.apiKeySupplier = options.apiKeySupplier;
20
+ }
21
+ validateHeaders(_headers) {
22
+ // Skip validation if we have a dynamic API key supplier
23
+ // The key will be resolved and added in authHeaders
24
+ if (this.apiKeySupplier) {
25
+ return;
26
+ }
27
+ super.validateHeaders(_headers);
28
+ }
29
+ async authHeaders(opts) {
30
+ // If we have a dynamic supplier, resolve it and return the auth header
31
+ if (this.apiKeySupplier) {
32
+ const key = await resolveSupplier(this.apiKeySupplier);
33
+ if (key) {
34
+ return (0, headers_1.buildHeaders)([{ Authorization: `Bearer ${key}` }]);
35
+ }
36
+ }
37
+ // Otherwise, fall back to default behavior
38
+ return super.authHeaders(opts);
39
+ }
40
+ }
9
41
  /**
10
42
  * @deprecated Use the {@link Cartesia} class directly instead.
11
43
  *
@@ -14,8 +46,14 @@ const voice_changer_wrapper_1 = require("./voice-changer-wrapper.js");
14
46
  class CartesiaClient {
15
47
  constructor(options = {}) {
16
48
  const newOptions = {};
49
+ let apiKeySupplier;
17
50
  if (options.apiKey) {
18
- newOptions.apiKey = options.apiKey;
51
+ if (typeof options.apiKey === 'function') {
52
+ apiKeySupplier = options.apiKey;
53
+ }
54
+ else {
55
+ newOptions.apiKey = options.apiKey;
56
+ }
19
57
  }
20
58
  if (options.baseUrl) {
21
59
  newOptions.baseURL = options.baseUrl;
@@ -23,7 +61,7 @@ class CartesiaClient {
23
61
  else if (options.environment) {
24
62
  newOptions.baseURL = options.environment;
25
63
  }
26
- this.client = new client_1.Cartesia(newOptions);
64
+ this.client = new DynamicCartesia({ ...newOptions, apiKeySupplier });
27
65
  this.tts = new tts_wrapper_1.TTSWrapper(this.client);
28
66
  this.voices = new voices_wrapper_1.VoicesWrapper(this.client);
29
67
  this.voiceChanger = new voice_changer_wrapper_1.VoiceChangerWrapper(this.client);
@@ -35,4 +73,5 @@ tslib_1.__exportStar(require("./voices-wrapper.js"), exports);
35
73
  tslib_1.__exportStar(require("./voice-changer-wrapper.js"), exports);
36
74
  tslib_1.__exportStar(require("./types.js"), exports);
37
75
  tslib_1.__exportStar(require("./errors.js"), exports);
76
+ tslib_1.__exportStar(require("./utils.js"), exports);
38
77
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/backcompat/index.ts"],"names":[],"mappings":";;;;AAAA,yCAAyD;AACzD,kDAA2C;AAC3C,wDAAiD;AACjD,sEAA8D;AAG9D;;;;GAIG;AACH,MAAa,cAAc;IAM1B,YAAY,UAAiC,EAAE;QAC9C,MAAM,UAAU,GAAkB,EAAE,CAAC;QAErC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACpB,UAAU,CAAC,MAAM,GAAG,OAAO,CAAC,MAAa,CAAC;QAC3C,CAAC;QAED,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACrB,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC,OAAc,CAAC;QAC7C,CAAC;aAAM,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;YAChC,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC,WAAkB,CAAC;QACjD,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,IAAI,iBAAQ,CAAC,UAAU,CAAC,CAAC;QACvC,IAA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@ import { Cartesia } from "../client.mjs";
2
2
  import { TTSWrapper } from "./tts-wrapper.mjs";
3
3
  import { VoicesWrapper } from "./voices-wrapper.mjs";
4
4
  import { VoiceChangerWrapper } from "./voice-changer-wrapper.mjs";
5
+ import { buildHeaders } from "../internal/headers.mjs";
6
+ async function resolveSupplier(supplier) {
7
+ if (typeof supplier === 'function') {
8
+ return supplier();
9
+ }
10
+ return supplier;
11
+ }
12
+ class DynamicCartesia extends Cartesia {
13
+ constructor(options) {
14
+ super(options);
15
+ this.apiKeySupplier = options.apiKeySupplier;
16
+ }
17
+ validateHeaders(_headers) {
18
+ // Skip validation if we have a dynamic API key supplier
19
+ // The key will be resolved and added in authHeaders
20
+ if (this.apiKeySupplier) {
21
+ return;
22
+ }
23
+ super.validateHeaders(_headers);
24
+ }
25
+ async authHeaders(opts) {
26
+ // If we have a dynamic supplier, resolve it and return the auth header
27
+ if (this.apiKeySupplier) {
28
+ const key = await resolveSupplier(this.apiKeySupplier);
29
+ if (key) {
30
+ return buildHeaders([{ Authorization: `Bearer ${key}` }]);
31
+ }
32
+ }
33
+ // Otherwise, fall back to default behavior
34
+ return super.authHeaders(opts);
35
+ }
36
+ }
5
37
  /**
6
38
  * @deprecated Use the {@link Cartesia} class directly instead.
7
39
  *
@@ -10,8 +42,14 @@ import { VoiceChangerWrapper } from "./voice-changer-wrapper.mjs";
10
42
  export class CartesiaClient {
11
43
  constructor(options = {}) {
12
44
  const newOptions = {};
45
+ let apiKeySupplier;
13
46
  if (options.apiKey) {
14
- newOptions.apiKey = options.apiKey;
47
+ if (typeof options.apiKey === 'function') {
48
+ apiKeySupplier = options.apiKey;
49
+ }
50
+ else {
51
+ newOptions.apiKey = options.apiKey;
52
+ }
15
53
  }
16
54
  if (options.baseUrl) {
17
55
  newOptions.baseURL = options.baseUrl;
@@ -19,7 +57,7 @@ export class CartesiaClient {
19
57
  else if (options.environment) {
20
58
  newOptions.baseURL = options.environment;
21
59
  }
22
- this.client = new Cartesia(newOptions);
60
+ this.client = new DynamicCartesia({ ...newOptions, apiKeySupplier });
23
61
  this.tts = new TTSWrapper(this.client);
24
62
  this.voices = new VoicesWrapper(this.client);
25
63
  this.voiceChanger = new VoiceChangerWrapper(this.client);
@@ -30,4 +68,5 @@ export * from "./voices-wrapper.mjs";
30
68
  export * from "./voice-changer-wrapper.mjs";
31
69
  export * from "./types.mjs";
32
70
  export * from "./errors.mjs";
71
+ export * from "./utils.mjs";
33
72
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/backcompat/index.ts"],"names":[],"mappings":"OAAO,EAAE,QAAQ,EAAsB;OAChC,EAAE,UAAU,EAAE;OACd,EAAE,aAAa,EAAE;OACjB,EAAE,mBAAmB,EAAE;AAG9B;;;;GAIG;AACH,MAAM,OAAO,cAAc;IAM1B,YAAY,UAAiC,EAAE;QAC9C,MAAM,UAAU,GAAkB,EAAE,CAAC;QAErC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACpB,UAAU,CAAC,MAAM,GAAG,OAAO,CAAC,MAAa,CAAC;QAC3C,CAAC;QAED,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACrB,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC,OAAc,CAAC;QAC7C,CAAC;aAAM,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;YAChC,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC,WAAkB,CAAC;QACjD,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC;QACvC,IAAI,CAAC,GAAG,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7C,IAAI,CAAC,YAAY,GAAG,IAAI,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1D,CAA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AC;QAE7D,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACnB,IAAI,OAAO,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;gBACzC,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;YAClC,CAAC;iBAAM,CAAC;gBACN,UAAU,CAAC,MAAM,GAAG,OAAO,CAAC,MAAgB,CAAC;YAC/C,CAAC;QACH,CAAC;QAED,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC,OAAiB,CAAC;QACjD,CAAC;aAAM,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;YAC/B,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC,WAAqB,CAAC;QACrD,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,IAAI,eAAe,CAAC,EAAE,GAAG,UAAU,EAAE,cAAc,EAAE,CAAC,CAAC;QACrE,IAAI,CAAC,GAAG,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7C,IAAI,CAAC,YAAY,GAAG,IAAI,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3D,CAAC;CACF"}
@@ -1,15 +1,16 @@
1
1
  import { Cartesia } from "../client.mjs";
2
2
  import { BackCompatRequestOptions } from "./types.mjs";
3
+ import { Readable } from 'stream';
3
4
  export interface BackCompatWebSocketOptions {
4
- container?: "raw" | "wav" | "mp3";
5
- encoding?: "pcm_f32le" | "pcm_s16le" | "pcm_alaw" | "pcm_mulaw";
5
+ container?: 'raw' | 'wav' | 'mp3';
6
+ encoding?: 'pcm_f32le' | 'pcm_s16le' | 'pcm_alaw' | 'pcm_mulaw';
6
7
  sampleRate: number;
7
8
  }
8
9
  export type BackCompatTtsRequestVoiceSpecifier = {
9
- mode: "id";
10
+ mode: 'id';
10
11
  id: string;
11
12
  } | {
12
- mode: "embedding";
13
+ mode: 'embedding';
13
14
  embedding: number[];
14
15
  };
15
16
  export interface BackCompatGenerationConfig {
@@ -23,8 +24,8 @@ export interface BackCompatWebSocketTtsRequest {
23
24
  voice: BackCompatTtsRequestVoiceSpecifier;
24
25
  generationConfig?: BackCompatGenerationConfig;
25
26
  outputFormat?: {
26
- container?: "raw" | "wav" | "mp3";
27
- encoding?: "pcm_f32le" | "pcm_s16le" | "pcm_alaw" | "pcm_mulaw";
27
+ container?: 'raw' | 'wav' | 'mp3';
28
+ encoding?: 'pcm_f32le' | 'pcm_s16le' | 'pcm_alaw' | 'pcm_mulaw';
28
29
  sampleRate?: number;
29
30
  bitRate?: number;
30
31
  };
@@ -34,6 +35,22 @@ export interface BackCompatWebSocketTtsRequest {
34
35
  addTimestamps?: boolean;
35
36
  addPhonemeTimestamps?: boolean;
36
37
  }
38
+ export interface BackCompatTtsRequest {
39
+ modelId: string;
40
+ transcript: string;
41
+ voice: BackCompatTtsRequestVoiceSpecifier;
42
+ language?: string;
43
+ outputFormat: {
44
+ container: 'raw' | 'wav' | 'mp3';
45
+ encoding?: 'pcm_f32le' | 'pcm_s16le' | 'pcm_alaw' | 'pcm_mulaw';
46
+ sampleRate: number;
47
+ bitRate?: number;
48
+ };
49
+ generationConfig?: BackCompatGenerationConfig;
50
+ duration?: number;
51
+ speed?: 'slow' | 'normal' | 'fast';
52
+ pronunciationDictId?: string;
53
+ }
37
54
  declare class AudioSource {
38
55
  private buffers;
39
56
  private waiter;
@@ -56,14 +73,37 @@ export declare class WebSocketWrapper {
56
73
  }>;
57
74
  disconnect(): void;
58
75
  }
76
+ export interface BackCompatTtsGenerateOptions {
77
+ modelId?: string;
78
+ outputFormat?: {
79
+ container: 'raw' | 'wav' | 'mp3';
80
+ encoding?: 'pcm_f32le' | 'pcm_s16le' | 'pcm_alaw' | 'pcm_mulaw';
81
+ sampleRate: number;
82
+ bitRate?: number;
83
+ };
84
+ language?: string;
85
+ generationConfig?: BackCompatGenerationConfig;
86
+ speed?: 'slow' | 'normal' | 'fast';
87
+ pronunciationDictId?: string;
88
+ }
59
89
  /** @deprecated Use the new SDK's tts methods on the {@link Cartesia} instance instead. */
60
90
  export declare class TTSWrapper {
61
91
  private client;
62
92
  constructor(client: Cartesia);
63
93
  /** @deprecated Use {@link Cartesia.tts.websocket} instead. */
64
94
  websocket(config: BackCompatWebSocketOptions): WebSocketWrapper;
65
- /** @deprecated Use {@link Cartesia.tts.synthesizeBytes} instead. */
66
- bytes(request: any, requestOptions?: BackCompatRequestOptions): Promise<unknown>;
95
+ /**
96
+ * Generate speech from text.
97
+ * @param transcript The text to convert to speech
98
+ * @param voiceId The voice ID to use
99
+ * @param options Generation options
100
+ * @param signal Optional abort signal
101
+ * @param _source Optional source identifier (e.g., "playground_tts") - for tracking purposes
102
+ * @deprecated Use {@link Cartesia.tts.generate} instead.
103
+ */
104
+ generate(transcript: string, voiceId: string, options?: BackCompatTtsGenerateOptions, signal?: AbortSignal, _source?: string): Promise<Readable>;
105
+ /** @deprecated Use {@link Cartesia.tts.generate} instead. */
106
+ bytes(request: BackCompatTtsRequest, requestOptions?: BackCompatRequestOptions): Promise<Readable>;
67
107
  }
68
108
  export {};
69
109
  //# sourceMappingURL=tts-wrapper.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tts-wrapper.d.mts","sourceRoot":"","sources":["../src/backcompat/tts-wrapper.ts"],"names":[],"mappings":"OACO,EAAE,QAAQ,EAAE;OAEZ,EAAE,wBAAwB,EAAE;AAInC,MAAM,WAAW,0BAA0B;IAC1C,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;IAClC,QAAQ,CAAC,EAAE,WAAW,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,CAAC;IAChE,UAAU,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,kCAAkC,GAC3C;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,EAAE,EAAE,MAA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