@sogni-ai/sogni-client 4.0.0 → 4.0.2

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 (130) hide show
  1. package/CHANGELOG.md +374 -0
  2. package/CLAUDE.md +240 -0
  3. package/README.md +186 -50
  4. package/dist/Account/index.d.ts +7 -4
  5. package/dist/Account/index.js +45 -20
  6. package/dist/Account/index.js.map +1 -1
  7. package/dist/Account/types.d.ts +6 -1
  8. package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/index.js +2 -2
  9. package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/index.js.map +1 -1
  10. package/dist/ApiClient/WebSocketClient/events.d.ts +55 -0
  11. package/dist/ApiClient/WebSocketClient/messages.d.ts +2 -0
  12. package/dist/ApiClient/index.d.ts +1 -1
  13. package/dist/ApiClient/index.js +10 -2
  14. package/dist/ApiClient/index.js.map +1 -1
  15. package/dist/Chat/ChatStream.d.ts +52 -0
  16. package/dist/Chat/ChatStream.js +179 -0
  17. package/dist/Chat/ChatStream.js.map +1 -0
  18. package/dist/Chat/ChatTools.d.ts +66 -0
  19. package/dist/Chat/ChatTools.js +322 -0
  20. package/dist/Chat/ChatTools.js.map +1 -0
  21. package/dist/Chat/index.d.ts +126 -0
  22. package/dist/Chat/index.js +366 -0
  23. package/dist/Chat/index.js.map +1 -0
  24. package/dist/Chat/tools.d.ts +75 -0
  25. package/dist/Chat/tools.js +256 -0
  26. package/dist/Chat/tools.js.map +1 -0
  27. package/dist/Chat/types.d.ts +258 -0
  28. package/dist/Chat/types.js +3 -0
  29. package/dist/Chat/types.js.map +1 -0
  30. package/dist/Projects/Job.d.ts +10 -2
  31. package/dist/Projects/Job.js +45 -26
  32. package/dist/Projects/Job.js.map +1 -1
  33. package/dist/Projects/Project.d.ts +1 -1
  34. package/dist/Projects/createJobRequestMessage.d.ts +2 -1
  35. package/dist/Projects/createJobRequestMessage.js +134 -35
  36. package/dist/Projects/createJobRequestMessage.js.map +1 -1
  37. package/dist/Projects/index.d.ts +24 -4
  38. package/dist/Projects/index.js +138 -32
  39. package/dist/Projects/index.js.map +1 -1
  40. package/dist/Projects/types/ComfySamplerParams.d.ts +0 -28
  41. package/dist/Projects/types/ComfySamplerParams.js +0 -34
  42. package/dist/Projects/types/ComfySamplerParams.js.map +1 -1
  43. package/dist/Projects/types/ControlNetParams.d.ts +34 -0
  44. package/dist/Projects/types/ModelOptions.d.ts +50 -0
  45. package/dist/Projects/types/ModelOptions.js +88 -0
  46. package/dist/Projects/types/ModelOptions.js.map +1 -0
  47. package/dist/Projects/types/ModelTiersRaw.d.ts +88 -0
  48. package/dist/Projects/types/ModelTiersRaw.js +19 -0
  49. package/dist/Projects/types/ModelTiersRaw.js.map +1 -0
  50. package/dist/Projects/types/index.d.ts +208 -52
  51. package/dist/Projects/types/index.js +4 -9
  52. package/dist/Projects/types/index.js.map +1 -1
  53. package/dist/Projects/utils/index.d.ts +73 -0
  54. package/dist/Projects/utils/index.js +208 -0
  55. package/dist/Projects/utils/index.js.map +1 -0
  56. package/dist/Projects/utils/samplers.d.ts +6 -0
  57. package/dist/Projects/utils/samplers.js +39 -0
  58. package/dist/Projects/utils/samplers.js.map +1 -0
  59. package/dist/Projects/utils/scheduler.d.ts +6 -0
  60. package/dist/Projects/utils/scheduler.js +30 -0
  61. package/dist/Projects/utils/scheduler.js.map +1 -0
  62. package/dist/index.d.ts +24 -7
  63. package/dist/index.js +23 -8
  64. package/dist/index.js.map +1 -1
  65. package/dist/lib/AuthManager/ApiKeyAuthManager.d.ts +14 -0
  66. package/dist/lib/AuthManager/ApiKeyAuthManager.js +63 -0
  67. package/dist/lib/AuthManager/ApiKeyAuthManager.js.map +1 -0
  68. package/dist/lib/AuthManager/index.d.ts +3 -2
  69. package/dist/lib/AuthManager/index.js +3 -1
  70. package/dist/lib/AuthManager/index.js.map +1 -1
  71. package/dist/lib/DataEntity.js +2 -2
  72. package/dist/lib/DataEntity.js.map +1 -1
  73. package/dist/lib/EIP712Helper.d.ts +1 -1
  74. package/dist/lib/EIP712Helper.js +0 -18
  75. package/dist/lib/EIP712Helper.js.map +1 -1
  76. package/dist/lib/{utils.js → utils/index.js} +1 -1
  77. package/dist/lib/utils/index.js.map +1 -0
  78. package/dist/lib/validation.d.ts +17 -12
  79. package/dist/lib/validation.js +48 -66
  80. package/dist/lib/validation.js.map +1 -1
  81. package/llms-full.txt +1351 -0
  82. package/llms.txt +502 -0
  83. package/package.json +24 -5
  84. package/src/Account/index.ts +55 -19
  85. package/src/Account/types.ts +6 -1
  86. package/src/ApiClient/WebSocketClient/BrowserWebSocketClient/index.ts +3 -3
  87. package/src/ApiClient/WebSocketClient/events.ts +59 -0
  88. package/src/ApiClient/WebSocketClient/messages.ts +2 -0
  89. package/src/ApiClient/index.ts +9 -3
  90. package/src/Chat/ChatStream.ts +188 -0
  91. package/src/Chat/ChatTools.ts +343 -0
  92. package/src/Chat/index.ts +451 -0
  93. package/src/Chat/tools.ts +275 -0
  94. package/src/Chat/types.ts +282 -0
  95. package/src/Projects/Job.ts +49 -10
  96. package/src/Projects/createJobRequestMessage.ts +196 -43
  97. package/src/Projects/index.ts +166 -35
  98. package/src/Projects/types/ComfySamplerParams.ts +0 -34
  99. package/src/Projects/types/ControlNetParams.ts +37 -0
  100. package/src/Projects/types/ModelOptions.ts +141 -0
  101. package/src/Projects/types/ModelTiersRaw.ts +112 -0
  102. package/src/Projects/types/index.ts +221 -60
  103. package/src/Projects/utils/index.ts +216 -0
  104. package/src/Projects/utils/samplers.ts +36 -0
  105. package/src/Projects/utils/scheduler.ts +27 -0
  106. package/src/index.ts +91 -32
  107. package/src/lib/AuthManager/ApiKeyAuthManager.ts +55 -0
  108. package/src/lib/AuthManager/index.ts +3 -2
  109. package/src/lib/DataEntity.ts +1 -1
  110. package/src/lib/EIP712Helper.ts +1 -19
  111. package/src/lib/validation.ts +56 -80
  112. package/dist/Projects/types/ComfySchedulerParams.d.ts +0 -17
  113. package/dist/Projects/types/ComfySchedulerParams.js +0 -23
  114. package/dist/Projects/types/ComfySchedulerParams.js.map +0 -1
  115. package/dist/Projects/types/ForgeSamplerParams.d.ts +0 -27
  116. package/dist/Projects/types/ForgeSamplerParams.js +0 -39
  117. package/dist/Projects/types/ForgeSamplerParams.js.map +0 -1
  118. package/dist/Projects/types/ForgeSchedulerParams.d.ts +0 -17
  119. package/dist/Projects/types/ForgeSchedulerParams.js +0 -28
  120. package/dist/Projects/types/ForgeSchedulerParams.js.map +0 -1
  121. package/dist/Projects/utils.d.ts +0 -20
  122. package/dist/Projects/utils.js +0 -82
  123. package/dist/Projects/utils.js.map +0 -1
  124. package/dist/lib/utils.js.map +0 -1
  125. package/src/Projects/types/ComfySchedulerParams.ts +0 -21
  126. package/src/Projects/types/ForgeSamplerParams.ts +0 -37
  127. package/src/Projects/types/ForgeSchedulerParams.ts +0 -26
  128. package/src/Projects/utils.ts +0 -77
  129. /package/dist/lib/{utils.d.ts → utils/index.d.ts} +0 -0
  130. /package/src/lib/{utils.ts → utils/index.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,370 @@
1
+ ## [4.0.2](https://github.com/Sogni-AI/sogni-client/compare/v4.0.1...v4.0.2) (2026-03-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Incorrect video project estimation for non-Wan models ([8ffc93a](https://github.com/Sogni-AI/sogni-client/commit/8ffc93ab727ed38e50dc56c96a603cd75a9021bb))
7
+
8
+ ## [4.0.1](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0...v4.0.1) (2026-03-02)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Minor doc update ([5b240fa](https://github.com/Sogni-AI/sogni-client/commit/5b240fa43632f8cb024ab98a222ef3b00f186511))
14
+
15
+ # [4.0.0](https://github.com/Sogni-AI/sogni-client/compare/v3.3.1...v4.0.0) (2026-03-02)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * Accept raw samplers and schedulers for backward compatibility ([8c04552](https://github.com/Sogni-AI/sogni-client/commit/8c04552667fe054e9a330a3aab8fd776060a0ed6))
21
+ * Add 'Discrete Flow Sampler (SD3)' to sampler alias ([460b3c2](https://github.com/Sogni-AI/sogni-client/commit/460b3c21c516b1f395041ff588f06f793480cdb1))
22
+ * Add `AudioProjectParams` to exports in `index.ts` ([bdbbca7](https://github.com/Sogni-AI/sogni-client/commit/bdbbca7dfe5dde5dd3e379a8209db1b1c41eaaa4))
23
+ * add cost estimation, tokenType billing, and worker tracking to Chat API ([8c1059e](https://github.com/Sogni-AI/sogni-client/commit/8c1059ee2bb43505d1e77abc3bccdce73910cb38))
24
+ * Add ForgeSampler, ComfySampler, ForgeScheduler, and ComfyScheduler to exports ([ad24b32](https://github.com/Sogni-AI/sogni-client/commit/ad24b326904f7ad67f43c34a0b758ce64e84a8f1))
25
+ * Add LTX-2 video model detection support ([7a312d5](https://github.com/Sogni-AI/sogni-client/commit/7a312d560f4169c2593719cefb4b4abf0878bf9b))
26
+ * Add numberOfMedia parameter to video project estimation request ([b762e61](https://github.com/Sogni-AI/sogni-client/commit/b762e6130c94a1aa192047c9b14f54dc1acb0191))
27
+ * Add sample parameters for Flux ([8e25924](https://github.com/Sogni-AI/sogni-client/commit/8e25924476a1faf1ac432a6490b4d52ac0cf4898))
28
+ * Allow 20 seconds duration videos for LTX-2 ([d7ad669](https://github.com/Sogni-AI/sogni-client/commit/d7ad669fd56c0f64f9a8f2a0fa4b4dbe5c4a9683))
29
+ * allow i2v workflow to use either referenceImage or referenceImageEnd ([b9f08ef](https://github.com/Sogni-AI/sogni-client/commit/b9f08efa91e92f58280b923c5815c9b6645c5452))
30
+ * allow optional referenceImage for v2v pose control ([183b324](https://github.com/Sogni-AI/sogni-client/commit/183b324c0e1c74f27041c46e666771a95102061c))
31
+ * Avoid double initialization for WSCoordinator.ts ([1b7e973](https://github.com/Sogni-AI/sogni-client/commit/1b7e973cebd6b35667fa248656127b60125dd4f9))
32
+ * Better socket coordinator implementation. Handle socket disconnection properly ([2a1a922](https://github.com/Sogni-AI/sogni-client/commit/2a1a922a0dd41446c1dcf6ffeaccfe54556af5bb))
33
+ * Code cleanup ([7b482dd](https://github.com/Sogni-AI/sogni-client/commit/7b482dd5c0667b3ad57e0fec75811f8bf5a14bee))
34
+ * Comfy / Video jobs leverage jobETA for lastUpdate to ensure jobs do not have a client-side timeout prematurely ([db5e2a6](https://github.com/Sogni-AI/sogni-client/commit/db5e2a62256ccb0f704a50fdf7e1e0556e2aecaa))
35
+ * Connect socket if client tries to send the message ([b5fa7bc](https://github.com/Sogni-AI/sogni-client/commit/b5fa7bc9599f30ff575521e76d76d42f031769fc))
36
+ * Correct video frame calculation for WAN vs LTX-2 models ([9127498](https://github.com/Sogni-AI/sogni-client/commit/9127498935e68f352850871ed9f4115234df9e0d))
37
+ * Fix cost estimation call ([920981c](https://github.com/Sogni-AI/sogni-client/commit/920981c86a3b1217c8dc6437e0fcdc26f50fe4ec))
38
+ * fix for passing video s2v audioStart and audioDuration. Fix for broken animate-replace in examples due to default sam2 coordinates ([7b525cd](https://github.com/Sogni-AI/sogni-client/commit/7b525cd50d60ec8b3884db80ee39dca25e1aca97))
39
+ * Fix project estimation. Export supported samplers and schedulers list ([502d4d1](https://github.com/Sogni-AI/sogni-client/commit/502d4d19529883b5272466a122720f2c6fd01e2e))
40
+ * Fix TypeScript error ([30ff62a](https://github.com/Sogni-AI/sogni-client/commit/30ff62ad5ccb3624bf8a26b70f65b4c0daa9c6ff))
41
+ * Handle logout errors gracefully and log warnings for 401 responses ([ba9b2ac](https://github.com/Sogni-AI/sogni-client/commit/ba9b2acc990e684fb59d7ba17e23dc7a3bebadf4))
42
+ * Hide samplers that are not well tested ([0522bed](https://github.com/Sogni-AI/sogni-client/commit/0522bed6cfad5f8bc9c37d65c30b63b31aa0168a))
43
+ * Improve error logging for failed job result URL generation ([e69ae09](https://github.com/Sogni-AI/sogni-client/commit/e69ae0970fc995adcdf4625246eb029c45cb5ea4))
44
+ * Initialization bug ([42b4e26](https://github.com/Sogni-AI/sogni-client/commit/42b4e26dad8f634eb6c17d172081d6c3d03a3d41))
45
+ * Lora schema update, LTX-2 video new default props ([bf1593f](https://github.com/Sogni-AI/sogni-client/commit/bf1593fa6c819aef6565bc096ba55e166bb8cc52))
46
+ * make negativePrompt and stylePrompt optional ([5e422c3](https://github.com/Sogni-AI/sogni-client/commit/5e422c3d310df2f87edee3ad19df1ed57efff088))
47
+ * Make shared socket connection optional ([7ee2311](https://github.com/Sogni-AI/sogni-client/commit/7ee2311354071bbcc3087cad0a8c321cea28cd25))
48
+ * Move type definitions to dependencies from devDependencies ([95b5201](https://github.com/Sogni-AI/sogni-client/commit/95b520191593913bd0b74cd8cf41241eac16dd8e))
49
+ * Optimize lodash imports ([86479d0](https://github.com/Sogni-AI/sogni-client/commit/86479d0713bbb361811c98445b0c330cdc49bcc2))
50
+ * Pass error iin message ack ([7b73d87](https://github.com/Sogni-AI/sogni-client/commit/7b73d87fdd27634b75fe5aa0bbba43415d6e7dce))
51
+ * Prevent potential memory leak in Project.waitForCompletion ([010a1de](https://github.com/Sogni-AI/sogni-client/commit/010a1decd1f5168275c34f95ccdb7ca8092ac3e5))
52
+ * refactor Video controlnet schema to match existing image controlnet schema ([b9e01f5](https://github.com/Sogni-AI/sogni-client/commit/b9e01f5c21449259e47f45b16eb4f7e65fdf7c51))
53
+ * Replace frames with duration in project cost estimation ([b6c576e](https://github.com/Sogni-AI/sogni-client/commit/b6c576e70b66d2604441e1bd8e013fa435c0c099))
54
+ * res_multistep support in SupportedComfySamplers to fix support for z-image. /examples script enhancements ([332e7b1](https://github.com/Sogni-AI/sogni-client/commit/332e7b1280272e05c7d897de22edea61482f5b7c))
55
+ * Update docs ([d486f44](https://github.com/Sogni-AI/sogni-client/commit/d486f448f3d55098449ba676dd77148c6a7104c4))
56
+ * Update docs ([7f28fe7](https://github.com/Sogni-AI/sogni-client/commit/7f28fe7f651937f244a3b5f56a92aac5d3b637a5))
57
+ * update duration default to null for LLM tool call passthrough ([881f6ad](https://github.com/Sogni-AI/sogni-client/commit/881f6ad9254095937a12964d3554896c656b695c))
58
+ * Update lodash types to 4.17.23 ([336e382](https://github.com/Sogni-AI/sogni-client/commit/336e382d9f85aecfa69ae11e21b80758c8c08575))
59
+ * very long running video progress jobs aborting prematurely ([8860ae8](https://github.com/Sogni-AI/sogni-client/commit/8860ae87bfb8104a64585c3107f6d4da1c3b4615))
60
+ * videoStart release ([d9dd123](https://github.com/Sogni-AI/sogni-client/commit/d9dd1234c75e5166a94ef2aa7a705f6679c3d3ec))
61
+ * wan sample scripts for s2v and animate should all support custom prompts ([5a2dbf9](https://github.com/Sogni-AI/sogni-client/commit/5a2dbf963c8ff411dece0dec87b52117a0baea23))
62
+
63
+
64
+ ### Features
65
+
66
+ * Add ability to query balance for Etherlink wallet ([60ef11b](https://github.com/Sogni-AI/sogni-client/commit/60ef11beec443837a044e24c11014bef8f804275))
67
+ * Add ACE-Step 1.5 audio generation documentation ([c02c80b](https://github.com/Sogni-AI/sogni-client/commit/c02c80be31067c6b929fea85bec1898cd26aff3a))
68
+ * add API key authentication support ([b7c1187](https://github.com/Sogni-AI/sogni-client/commit/b7c11879315e311afa6a668423de0e848e41c2fc))
69
+ * Add audio cost estimation API and image download content type support ([784ccca](https://github.com/Sogni-AI/sogni-client/commit/784ccca38c8b4031415ba18158dbdda53dbb0ed2))
70
+ * Add audio generation support and LTX-2 ia2v/a2v/v2v workflows ([7d1f2dc](https://github.com/Sogni-AI/sogni-client/commit/7d1f2dcd4cac6c8750b46d88f04fb87077d379a6))
71
+ * add ChatToolsApi with auto tool execution and think parameter ([2e79672](https://github.com/Sogni-AI/sogni-client/commit/2e79672c1596e022c84582ae5ae6805a3d7698ff))
72
+ * Add credential management system for video examples ([e7fc1ab](https://github.com/Sogni-AI/sogni-client/commit/e7fc1abf85d32995c64c48a5f861cb3f99a4793b))
73
+ * Add img2img support for Qwen Image 2512 models and improve workflows ([46324fd](https://github.com/Sogni-AI/sogni-client/commit/46324fde6043cd241bc41ee40e480a7064664575))
74
+ * add LLM model info, cost breakdown, and enhanced job state tracking to Chat API ([b27d743](https://github.com/Sogni-AI/sogni-client/commit/b27d74307a270724635f438d734e2663fafbe8b9))
75
+ * add LLM tool calling support with Sogni platform tools ([df9ceac](https://github.com/Sogni-AI/sogni-client/commit/df9ceac4f49c2ab7079e17198bdeb3b716e4f469))
76
+ * add LTX-2 video-to-video ControlNet workflow support ([2dc2169](https://github.com/Sogni-AI/sogni-client/commit/2dc2169190e2adfb94a452eecfe209105dba95dd))
77
+ * Add project and job ETA properties ([66024cc](https://github.com/Sogni-AI/sogni-client/commit/66024cc26dac51bbd45dc5b4d7e68c5963f8c178))
78
+ * Add rememberMe parameter for login and signup API to allow long lived cookie-based session ([e0c1395](https://github.com/Sogni-AI/sogni-client/commit/e0c13957c3ff8d548e40453f9c57d72390fdd9d7))
79
+ * Add support for token and cookie authentication with updated AuthManager and REST client enhancements ([a5a2bd2](https://github.com/Sogni-AI/sogni-client/commit/a5a2bd2f005ea298e07773f0954b99ea2c43bc5d))
80
+ * add support for up to 6 context images for Flux.2 Dev ([3096fe6](https://github.com/Sogni-AI/sogni-client/commit/3096fe62f155939e7a044a07f7696066e9f1e6d7))
81
+ * add support for up to 6 contextImage for flux.2 [dev], add example script starting-image option for z-image and image size cap to ~4mp for new image models ([57c902c](https://github.com/Sogni-AI/sogni-client/commit/57c902c1b5d29c702a13ce58759af21f5e815eb4))
82
+ * Add support for video duration options with validation and deprecate frames property ([fa11d79](https://github.com/Sogni-AI/sogni-client/commit/fa11d7905ef249a2e75a6d96c8a2bedda24005df))
83
+ * add trimEndFrame parameter for video stitching ([985d13b](https://github.com/Sogni-AI/sogni-client/commit/985d13bad9576b01388d1e58450cec8d585d9134))
84
+ * Add video project cost estimation ([33c7533](https://github.com/Sogni-AI/sogni-client/commit/33c7533b90bfe7c23c465b38867d184b00561112))
85
+ * Add VideoProjectParams optional teacacheThreshold support ([7a68d4c](https://github.com/Sogni-AI/sogni-client/commit/7a68d4ccc8db8fa1ed410452321468d434927bd1))
86
+ * Enhance video example scripts with improved UX ([6a70c26](https://github.com/Sogni-AI/sogni-client/commit/6a70c26e2b30b5be7bcae88171bbd3956bbe91af))
87
+ * ensure video model passed with and height are at least 480 ([d0156aa](https://github.com/Sogni-AI/sogni-client/commit/d0156aa84785f98c60ee09e7c733e62940eb0b9e))
88
+ * example script workflow enhancements ([94d14e4](https://github.com/Sogni-AI/sogni-client/commit/94d14e42a121976b1090fe797734f2f76e57da02))
89
+ * Expose array of projects that SogniClient instance is tracking currently ([38b6c0e](https://github.com/Sogni-AI/sogni-client/commit/38b6c0ec7ab3e6f621e42f9e512ede98f4b3a9da))
90
+ * Expose project cost in both Spark Points and Sogni tokens when estimating ([9d5f556](https://github.com/Sogni-AI/sogni-client/commit/9d5f556154013ae15e49e93e9941533e730502c5))
91
+ * final round of doc / example enhancements with new steps support for Wan video models ([95d5dfb](https://github.com/Sogni-AI/sogni-client/commit/95d5dfb61d5ed2878c04cd6cf7a0d75d9d0754e1))
92
+ * include credentials in REST API wrapper ([5ccdbab](https://github.com/Sogni-AI/sogni-client/commit/5ccdbabd66f9ad6fb1cb07682c3b8975ceb45fca))
93
+ * LTX-2 variable FPS 1-60 with improved UX flow ([8cf63fd](https://github.com/Sogni-AI/sogni-client/commit/8cf63fd790e7890baaeffb861e618c641bcaf7c7))
94
+ * Make logout synchronous. That is important for cookie auth ([5c39cd1](https://github.com/Sogni-AI/sogni-client/commit/5c39cd1589b25fe95eb77ace716f78d9933b303d))
95
+ * Official support for LLM Tool Calling & Sogni Platform Tools, doc updates ([c6614d3](https://github.com/Sogni-AI/sogni-client/commit/c6614d325fb6c126f14d81ccc7e71fe236b2a8b1))
96
+ * Refactor sampler and scheduler handling; remove legacy definitions and centralize validation ([29b0905](https://github.com/Sogni-AI/sogni-client/commit/29b09056ba578e577d557754bae05bbb1671af00))
97
+ * sam2Coordinates option for Animate Replace workflow ([9275249](https://github.com/Sogni-AI/sogni-client/commit/9275249370fe1bb34732dece0e2c814c35d56dcf))
98
+ * Support Etherlink ([57eaee3](https://github.com/Sogni-AI/sogni-client/commit/57eaee39c18efd26732f9ce735a42b414bf34e87))
99
+ * Support Qwen, Z Image and Flux 2 models ([fd3acb7](https://github.com/Sogni-AI/sogni-client/commit/fd3acb7bdce5d7c81750e58fb79d14cf4f5f0b2f))
100
+ * Update schedulers and samplers options. ([7971cdc](https://github.com/Sogni-AI/sogni-client/commit/7971cdc7b1114840196fdada5adbf22cf867053e))
101
+ * Video support added ([e00e1e7](https://github.com/Sogni-AI/sogni-client/commit/e00e1e7879962047a6950013d53aa83748a66021))
102
+ * When using cookies auth in browser environment allow sharing one socket connection between multiple tabs ([794d6e1](https://github.com/Sogni-AI/sogni-client/commit/794d6e18d960c8758094f09b2bc516b8b08175d0))
103
+
104
+
105
+ ### BREAKING CHANGES
106
+
107
+ * Account balance data format changed, instead of `unclaimed`, now it will be `relaxedUnclaimed` and `fastUnclaimed`
108
+ * Enums and type definitions for sampler and scheduler params are removed
109
+
110
+ Now scheduler and sampler params are strings. `const modelOptions = await sogni.projects.getModelOptions(modelId)` can be used to pull options for each model.
111
+ * `SupportedSamplers` and `SupportedSchedulers` removed
112
+ `SupportedSamplers` and `SupportedSchedulers` are replaced with `SupportedComfySchedulers`, `SupportedComfySamplers`, `SupportedForgeSchedulers`, `SupportedForgeSamplers`
113
+
114
+ * fix: Prettier formatting
115
+ * Project creation parameters changed
116
+ - `type` is required when calling `sogni.projects.create(params)`, valid values are `image` and `video`. See code examples below.
117
+ - `numberOfImages` renamed to `numberOfMedia`
118
+ - `hasResultImage` in `Job` class is now `hasResultMedia`
119
+ - `Job` and `Project` classes now have `type` property that can be `image` or `video`
120
+ * `scheduler` and `timeStepSpacing` options renamed
121
+
122
+ - `scheduler` option renamed to `sampler`
123
+ - `timeStepSpacing` is now `scheduler`
124
+ - Options are now referenced by short aliases
125
+ * Various changes in ApiClient, AuthManager and CurrentAccount.
126
+
127
+ Most notable:
128
+ 1. `client.apiClient.authenticate` replaced with `client.setTokens`
129
+ 2. Added `client.checkAuth` to check if client is authenticated when using cookie authentication
130
+ 3. Added `authType` to `SogniClient.createInstance` to switch between token and cookie authentication
131
+ 4. Removed `token` and `refreshToken` keys from `client.account.currentAccount`
132
+ 5. Added `email` to `client.account.currentAccount`
133
+ 6. Added `client.account.me()` method to refresh current account data
134
+
135
+ # [4.0.0-alpha.74](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.73...v4.0.0-alpha.74) (2026-03-02)
136
+
137
+
138
+ ### Bug Fixes
139
+
140
+ * Update docs ([e12a18b](https://github.com/Sogni-AI/sogni-client/commit/e12a18bf6c9353010be0c28132cd639d8bebb257))
141
+
142
+ # [4.0.0-alpha.73](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.72...v4.0.0-alpha.73) (2026-03-02)
143
+
144
+
145
+ ### Bug Fixes
146
+
147
+ * update duration default to null for LLM tool call passthrough ([881f6ad](https://github.com/Sogni-AI/sogni-client/commit/881f6ad9254095937a12964d3554896c656b695c))
148
+
149
+ # [4.0.0-alpha.72](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.71...v4.0.0-alpha.72) (2026-03-02)
150
+
151
+
152
+ ### Features
153
+
154
+ * add ChatToolsApi with auto tool execution and think parameter ([2e79672](https://github.com/Sogni-AI/sogni-client/commit/2e79672c1596e022c84582ae5ae6805a3d7698ff))
155
+
156
+ # [4.0.0-alpha.71](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.70...v4.0.0-alpha.71) (2026-02-27)
157
+
158
+
159
+ ### Features
160
+
161
+ * Official support for LLM Tool Calling & Sogni Platform Tools, doc updates ([c6614d3](https://github.com/Sogni-AI/sogni-client/commit/c6614d325fb6c126f14d81ccc7e71fe236b2a8b1))
162
+
163
+ # [4.0.0-alpha.70](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.69...v4.0.0-alpha.70) (2026-02-27)
164
+
165
+
166
+ ### Features
167
+
168
+ * add LLM tool calling support with Sogni platform tools ([df9ceac](https://github.com/Sogni-AI/sogni-client/commit/df9ceac4f49c2ab7079e17198bdeb3b716e4f469))
169
+
170
+ # [4.0.0-alpha.69](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.68...v4.0.0-alpha.69) (2026-02-26)
171
+
172
+
173
+ ### Features
174
+
175
+ * add LLM model info, cost breakdown, and enhanced job state tracking to Chat API ([b27d743](https://github.com/Sogni-AI/sogni-client/commit/b27d74307a270724635f438d734e2663fafbe8b9))
176
+
177
+ # [4.0.0-alpha.68](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.67...v4.0.0-alpha.68) (2026-02-24)
178
+
179
+
180
+ ### Bug Fixes
181
+
182
+ * add cost estimation, tokenType billing, and worker tracking to Chat API ([8c1059e](https://github.com/Sogni-AI/sogni-client/commit/8c1059ee2bb43505d1e77abc3bccdce73910cb38))
183
+
184
+ # [4.0.0-alpha.67](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.66...v4.0.0-alpha.67) (2026-02-24)
185
+
186
+
187
+ ### Features
188
+
189
+ * add API key authentication support ([b7c1187](https://github.com/Sogni-AI/sogni-client/commit/b7c11879315e311afa6a668423de0e848e41c2fc))
190
+
191
+ # [4.0.0-alpha.66](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.65...v4.0.0-alpha.66) (2026-02-20)
192
+
193
+
194
+ ### Bug Fixes
195
+
196
+ * Allow 20 seconds duration videos for LTX-2 ([d7ad669](https://github.com/Sogni-AI/sogni-client/commit/d7ad669fd56c0f64f9a8f2a0fa4b4dbe5c4a9683))
197
+
198
+ # [4.0.0-alpha.65](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.64...v4.0.0-alpha.65) (2026-02-17)
199
+
200
+
201
+ ### Bug Fixes
202
+
203
+ * Add `AudioProjectParams` to exports in `index.ts` ([bdbbca7](https://github.com/Sogni-AI/sogni-client/commit/bdbbca7dfe5dde5dd3e379a8209db1b1c41eaaa4))
204
+
205
+ # [4.0.0-alpha.64](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.63...v4.0.0-alpha.64) (2026-02-17)
206
+
207
+
208
+ ### Features
209
+
210
+ * Add ACE-Step 1.5 audio generation documentation ([c02c80b](https://github.com/Sogni-AI/sogni-client/commit/c02c80be31067c6b929fea85bec1898cd26aff3a))
211
+
212
+ # [4.0.0-alpha.63](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.62...v4.0.0-alpha.63) (2026-02-16)
213
+
214
+
215
+ ### Features
216
+
217
+ * Add audio cost estimation API and image download content type support ([784ccca](https://github.com/Sogni-AI/sogni-client/commit/784ccca38c8b4031415ba18158dbdda53dbb0ed2))
218
+ * Add audio generation support and LTX-2 ia2v/a2v/v2v workflows ([7d1f2dc](https://github.com/Sogni-AI/sogni-client/commit/7d1f2dcd4cac6c8750b46d88f04fb87077d379a6))
219
+
220
+ # [4.0.0-alpha.62](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.61...v4.0.0-alpha.62) (2026-02-12)
221
+
222
+
223
+ ### Features
224
+
225
+ * sam2Coordinates option for Animate Replace workflow ([9275249](https://github.com/Sogni-AI/sogni-client/commit/9275249370fe1bb34732dece0e2c814c35d56dcf))
226
+
227
+ # [4.0.0-alpha.61](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.60...v4.0.0-alpha.61) (2026-02-03)
228
+
229
+
230
+ ### Bug Fixes
231
+
232
+ * Correct video frame calculation for WAN vs LTX-2 models ([9127498](https://github.com/Sogni-AI/sogni-client/commit/9127498935e68f352850871ed9f4115234df9e0d))
233
+
234
+ # [4.0.0-alpha.60](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.59...v4.0.0-alpha.60) (2026-02-02)
235
+
236
+
237
+ ### Bug Fixes
238
+
239
+ * Update lodash types to 4.17.23 ([336e382](https://github.com/Sogni-AI/sogni-client/commit/336e382d9f85aecfa69ae11e21b80758c8c08575))
240
+
241
+ # [4.0.0-alpha.59](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.58...v4.0.0-alpha.59) (2026-02-02)
242
+
243
+
244
+ ### Bug Fixes
245
+
246
+ * Optimize lodash imports ([86479d0](https://github.com/Sogni-AI/sogni-client/commit/86479d0713bbb361811c98445b0c330cdc49bcc2))
247
+
248
+ # [4.0.0-alpha.58](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.57...v4.0.0-alpha.58) (2026-01-29)
249
+
250
+
251
+ ### Bug Fixes
252
+
253
+ * refactor Video controlnet schema to match existing image controlnet schema ([b9e01f5](https://github.com/Sogni-AI/sogni-client/commit/b9e01f5c21449259e47f45b16eb4f7e65fdf7c51))
254
+
255
+ # [4.0.0-alpha.57](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.56...v4.0.0-alpha.57) (2026-01-28)
256
+
257
+
258
+ ### Bug Fixes
259
+
260
+ * allow optional referenceImage for v2v pose control ([183b324](https://github.com/Sogni-AI/sogni-client/commit/183b324c0e1c74f27041c46e666771a95102061c))
261
+
262
+ # [4.0.0-alpha.56](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.55...v4.0.0-alpha.56) (2026-01-28)
263
+
264
+
265
+ ### Features
266
+
267
+ * add LTX-2 video-to-video ControlNet workflow support ([2dc2169](https://github.com/Sogni-AI/sogni-client/commit/2dc2169190e2adfb94a452eecfe209105dba95dd))
268
+
269
+ # [4.0.0-alpha.55](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.54...v4.0.0-alpha.55) (2026-01-27)
270
+
271
+
272
+ ### Features
273
+
274
+ * LTX-2 variable FPS 1-60 with improved UX flow ([8cf63fd](https://github.com/Sogni-AI/sogni-client/commit/8cf63fd790e7890baaeffb861e618c641bcaf7c7))
275
+
276
+ # [4.0.0-alpha.54](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.53...v4.0.0-alpha.54) (2026-01-26)
277
+
278
+
279
+ ### Bug Fixes
280
+
281
+ * make negativePrompt and stylePrompt optional ([5e422c3](https://github.com/Sogni-AI/sogni-client/commit/5e422c3d310df2f87edee3ad19df1ed57efff088))
282
+
283
+
284
+ ### Features
285
+
286
+ * add trimEndFrame parameter for video stitching ([985d13b](https://github.com/Sogni-AI/sogni-client/commit/985d13bad9576b01388d1e58450cec8d585d9134))
287
+
288
+ # [4.0.0-alpha.53](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.52...v4.0.0-alpha.53) (2026-01-25)
289
+
290
+
291
+ ### Features
292
+
293
+ * Support Etherlink ([57eaee3](https://github.com/Sogni-AI/sogni-client/commit/57eaee39c18efd26732f9ce735a42b414bf34e87))
294
+
295
+
296
+ ### BREAKING CHANGES
297
+
298
+ * Account balance data format changed, instead of `unclaimed`, now it will be `relaxedUnclaimed` and `fastUnclaimed`
299
+
300
+ # [4.0.0-alpha.52](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.51...v4.0.0-alpha.52) (2026-01-22)
301
+
302
+
303
+ ### Bug Fixes
304
+
305
+ * Lora schema update, LTX-2 video new default props ([bf1593f](https://github.com/Sogni-AI/sogni-client/commit/bf1593fa6c819aef6565bc096ba55e166bb8cc52))
306
+
307
+ # [4.0.0-alpha.51](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.50...v4.0.0-alpha.51) (2026-01-20)
308
+
309
+
310
+ ### Bug Fixes
311
+
312
+ * Add LTX-2 video model detection support ([7a312d5](https://github.com/Sogni-AI/sogni-client/commit/7a312d560f4169c2593719cefb4b4abf0878bf9b))
313
+
314
+
315
+ ### Features
316
+
317
+ * Add img2img support for Qwen Image 2512 models and improve workflows ([46324fd](https://github.com/Sogni-AI/sogni-client/commit/46324fde6043cd241bc41ee40e480a7064664575))
318
+
319
+ # [4.0.0-alpha.50](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.49...v4.0.0-alpha.50) (2026-01-16)
320
+
321
+
322
+ ### Bug Fixes
323
+
324
+ * Handle logout errors gracefully and log warnings for 401 responses ([ba9b2ac](https://github.com/Sogni-AI/sogni-client/commit/ba9b2acc990e684fb59d7ba17e23dc7a3bebadf4))
325
+
326
+ # [4.0.0-alpha.49](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.48...v4.0.0-alpha.49) (2026-01-12)
327
+
328
+
329
+ ### Bug Fixes
330
+
331
+ * Improve error logging for failed job result URL generation ([e69ae09](https://github.com/Sogni-AI/sogni-client/commit/e69ae0970fc995adcdf4625246eb029c45cb5ea4))
332
+
333
+ # [4.0.0-alpha.48](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.47...v4.0.0-alpha.48) (2026-01-12)
334
+
335
+
336
+ ### Bug Fixes
337
+
338
+ * Add 'Discrete Flow Sampler (SD3)' to sampler alias ([460b3c2](https://github.com/Sogni-AI/sogni-client/commit/460b3c21c516b1f395041ff588f06f793480cdb1))
339
+
340
+ # [4.0.0-alpha.47](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.46...v4.0.0-alpha.47) (2026-01-10)
341
+
342
+
343
+ ### Features
344
+
345
+ * add support for up to 6 context images for Flux.2 Dev ([3096fe6](https://github.com/Sogni-AI/sogni-client/commit/3096fe62f155939e7a044a07f7696066e9f1e6d7))
346
+
347
+ # [4.0.0-alpha.46](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.45...v4.0.0-alpha.46) (2026-01-09)
348
+
349
+
350
+ ### Features
351
+
352
+ * Refactor sampler and scheduler handling; remove legacy definitions and centralize validation ([29b0905](https://github.com/Sogni-AI/sogni-client/commit/29b09056ba578e577d557754bae05bbb1671af00))
353
+
354
+
355
+ ### BREAKING CHANGES
356
+
357
+ * Enums and type definitions for sampler and scheduler params are removed
358
+
359
+ Now scheduler and sampler params are strings. `const modelOptions = await sogni.projects.getModelOptions(modelId)` can be used to pull options for each model.
360
+
361
+ # [4.0.0-alpha.45](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.44...v4.0.0-alpha.45) (2026-01-09)
362
+
363
+
364
+ ### Features
365
+
366
+ * add support for up to 6 contextImage for flux.2 [dev], add example script starting-image option for z-image and image size cap to ~4mp for new image models ([57c902c](https://github.com/Sogni-AI/sogni-client/commit/57c902c1b5d29c702a13ce58759af21f5e815eb4))
367
+
1
368
  # [4.0.0-alpha.44](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.43...v4.0.0-alpha.44) (2026-01-08)
2
369
 
3
370
 
@@ -358,6 +725,13 @@ Most notable:
358
725
 
359
726
  * include credentials in REST API wrapper ([5ccdbab](https://github.com/Sogni-AI/sogni-client/commit/5ccdbabd66f9ad6fb1cb07682c3b8975ceb45fca))
360
727
 
728
+ ## [3.3.1](https://github.com/Sogni-AI/sogni-client/compare/v3.3.0...v3.3.1) (2025-10-09)
729
+
730
+
731
+ ### Bug Fixes
732
+
733
+ * Update docs ([e12a18b](https://github.com/Sogni-AI/sogni-client/commit/e12a18bf6c9353010be0c28132cd639d8bebb257))
734
+
361
735
  # [3.3.0](https://github.com/Sogni-AI/sogni-client/compare/v3.2.0...v3.3.0) (2025-08-26)
362
736
 
363
737
 
package/CLAUDE.md ADDED
@@ -0,0 +1,240 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## LLM Documentation Resources
6
+
7
+ For AI coding assistants working with this SDK, the following resources are available:
8
+
9
+ - **`llms.txt`** - Indexed quick reference with code examples
10
+ - **`llms-full.txt`** - Comprehensive documentation (~25KB) with complete API reference
11
+ - **`dist/index.d.ts`** - TypeScript type definitions (after build)
12
+ - **API Docs**: https://sdk-docs.sogni.ai
13
+
14
+ When helping users with Sogni SDK tasks, consult `llms-full.txt` for complete parameter references, especially for video generation where WAN 2.2 and LTX-2 models have different behaviors.
15
+
16
+ ## Overview
17
+
18
+ This is the **Sogni SDK for JavaScript/Node.js** - a TypeScript client library for the Sogni Supernet, a DePIN protocol for creative AI inference. The SDK supports image generation (Stable Diffusion, Flux, etc.) and video generation (WAN 2.2 and LTX-2 models) via WebSocket communication.
19
+
20
+ ## Build & Development Commands
21
+
22
+ ```bash
23
+ # Build the project (compiles TypeScript to dist/)
24
+ npm run build
25
+
26
+ # Watch mode for development
27
+ npm run watch
28
+
29
+ # Format code with Prettier
30
+ npm run prettier:fix
31
+
32
+ # Check formatting
33
+ npm run prettier
34
+
35
+ # Generate API documentation
36
+ npm run docs
37
+ ```
38
+
39
+ ## Architecture
40
+
41
+ ### Entry Point & Main Classes
42
+
43
+ **SogniClient** (`src/index.ts`) - Main entry point, created via `SogniClient.createInstance()`:
44
+ - `account: AccountApi` - Authentication, balance, rewards
45
+ - `projects: ProjectsApi` - Create/track AI generation jobs
46
+ - `stats: StatsApi` - Leaderboard data
47
+ - `apiClient: ApiClient` - Internal REST + WebSocket communication
48
+
49
+ ### Core Entity Hierarchy
50
+
51
+ **DataEntity** (`src/lib/DataEntity.ts`) - Base class for reactive entities with event emission:
52
+ - `Project` (`src/Projects/Project.ts`) - Represents an image/video generation request
53
+ - `Job` (`src/Projects/Job.ts`) - Individual generation task within a project
54
+
55
+ ### Communication Layer
56
+
57
+ **ApiClient** (`src/ApiClient/index.ts`) orchestrates:
58
+ - `RestClient` (`src/lib/RestClient.ts`) - HTTP requests with auth
59
+ - `WebSocketClient` (`src/ApiClient/WebSocketClient/`) - Real-time events
60
+ - `AuthManager` (`src/lib/AuthManager/`) - Token or cookie-based authentication
61
+
62
+ ### Module Structure
63
+
64
+ ```
65
+ src/
66
+ ├── index.ts # SogniClient + public exports
67
+ ├── ApiClient/ # REST + WebSocket communication
68
+ │ └── WebSocketClient/ # Real-time protocol (includes browser multi-tab support)
69
+ ├── Projects/ # Project/Job management
70
+ │ ├── types/ # ProjectParams, RawProject, events
71
+ │ └── utils/ # Samplers, schedulers
72
+ ├── Account/ # User auth & balance (CurrentAccount entity)
73
+ ├── Stats/ # Leaderboard API
74
+ ├── lib/ # Shared utilities
75
+ │ ├── AuthManager/ # Token/Cookie auth strategies
76
+ │ ├── DataEntity.ts # Base reactive entity
77
+ │ ├── TypedEventEmitter.ts
78
+ │ └── RestClient.ts
79
+ └── types/ # Global types (ErrorData, token)
80
+ ```
81
+
82
+ ### Key Patterns
83
+
84
+ - **Event-driven architecture**: TypedEventEmitter for reactive updates throughout
85
+ - **Strategy pattern**: AuthManager with swappable TokenAuthManager/CookieAuthManager
86
+ - **Factory pattern**: `SogniClient.createInstance()` for initialization
87
+ - **Observer pattern**: Project/Job emit 'updated', 'completed', 'failed' events
88
+
89
+ ### Data Flow
90
+
91
+ 1. User calls `sogni.projects.create()` → Project entity created → 'jobRequest' sent via WebSocket
92
+ 2. Server sends `jobState`, `jobProgress`, `jobResult` events → Updates Project/Job entities
93
+ 3. Entities emit events → User code receives 'progress', 'completed', 'failed'
94
+
95
+ ### Network Types
96
+
97
+ - `fast` - High-end GPUs, faster but more expensive. Required for video generation.
98
+ - `relaxed` - Mac devices, cheaper. Image generation only.
99
+
100
+ ## Video Model Architecture
101
+
102
+ The SDK supports two families of video models with **fundamentally different FPS and frame count behavior**.
103
+
104
+ ### Standard Behavior (LTX-2 and future models)
105
+
106
+ **LTX-2 Models (`ltx2-*`)** represent the standard behavior going forward:
107
+ - **Generate at the actual specified FPS** (1-60 fps range)
108
+ - No post-render interpolation - fps directly affects generation
109
+ - **Frame calculation**: `duration * fps + 1`
110
+ - **Frame step constraint**: Frame count must follow pattern `1 + n*8` (i.e., 1, 9, 17, 25, 33, ...)
111
+ - Example: 5 seconds at 24fps = 121 frames (snapped to 1 + 15*8 = 121)
112
+
113
+ ### Legacy Behavior (WAN 2.2 only)
114
+
115
+ **WAN 2.2 Models (`wan_v2.2-*`)** are the outlier with legacy behavior:
116
+ - **Always generate at 16fps internally**, regardless of the user's fps setting
117
+ - The `fps` parameter (16 or 32) controls **post-render frame interpolation only**
118
+ - `fps=16`: No interpolation, output matches generation (16fps)
119
+ - `fps=32`: Frames are doubled via interpolation after generation
120
+ - **Frame calculation**: `duration * 16 + 1` (always uses 16, ignores fps)
121
+ - Example: 5 seconds at 32fps = 81 frames generated → interpolated to 161 output frames
122
+
123
+ ### Key Files
124
+ - `src/Projects/utils/index.ts` - `isWanModel()`, `isLtx2Model()`, `calculateVideoFrames()`
125
+ - `src/Projects/createJobRequestMessage.ts` - Uses `calculateVideoFrames()` for duration→frames conversion
126
+ - `src/Projects/types/index.ts` - `VideoProjectParams` interface with detailed documentation
127
+
128
+ ## Git Safety Rules
129
+
130
+ **CRITICAL: Before running ANY destructive git command (`git reset --hard`, `git checkout .`, `git clean`, etc.):**
131
+
132
+ 1. **ALWAYS run `git status` first** to check for uncommitted changes
133
+ 2. **ALWAYS run `git stash` to preserve uncommitted work** before reset operations
134
+ 3. After the operation, offer to `git stash pop` to restore the changes
135
+
136
+ Uncommitted working directory changes are NOT recoverable after `git reset --hard`. Never assume the working directory is clean.
137
+
138
+ ## Commit Message Conventions
139
+
140
+ This repository uses **conventional commits** for semantic versioning of the npm package:
141
+
142
+ - **`feat:`** - New features. Triggers a **minor** version bump (e.g., 4.0.0 → 4.1.0)
143
+ - **`fix:`** - Bug fixes. Triggers a **patch** version bump (e.g., 4.0.0 → 4.0.1)
144
+ - **`chore:`** - Maintenance tasks, documentation, examples. **No version bump** - won't publish a new SDK version
145
+
146
+ **Examples:**
147
+ ```
148
+ feat: Add support for new video model
149
+ fix: Correct frame calculation for LTX-2 models
150
+ chore: Update example scripts for video generation
151
+ ```
152
+
153
+ **Important:** Changes that only affect the `/examples` folder should typically use `chore:` since they don't affect the published SDK package.
154
+
155
+ ## Common Tasks Quick Reference
156
+
157
+ ### Generate an Image
158
+ ```javascript
159
+ const project = await sogni.projects.create({
160
+ type: 'image',
161
+ modelId: 'flux1-schnell-fp8',
162
+ positivePrompt: 'Your prompt here',
163
+ numberOfMedia: 1,
164
+ steps: 4,
165
+ guidance: 1
166
+ });
167
+ const urls = await project.waitForCompletion();
168
+ ```
169
+
170
+ ### Generate a Video (WAN 2.2)
171
+ ```javascript
172
+ const project = await sogni.projects.create({
173
+ type: 'video',
174
+ network: 'fast', // Required for video
175
+ modelId: 'wan_v2.2-14b-fp8_t2v_lightx2v',
176
+ positivePrompt: 'Your prompt here',
177
+ numberOfMedia: 1,
178
+ duration: 5, // seconds
179
+ fps: 16
180
+ });
181
+ const urls = await project.waitForCompletion();
182
+ ```
183
+
184
+ ### Generate Music (ACE-Step 1.5)
185
+ ```javascript
186
+ const project = await sogni.projects.create({
187
+ type: 'audio',
188
+ modelId: 'ace_step_1.5_turbo', // or 'ace_step_1.5_sft'
189
+ positivePrompt: 'Upbeat electronic dance music with synth leads',
190
+ numberOfMedia: 1,
191
+ duration: 30, // 10-600 seconds
192
+ bpm: 128, // 30-300
193
+ keyscale: 'C major',
194
+ timesignature: '4', // 4/4 time
195
+ steps: 8,
196
+ outputFormat: 'mp3'
197
+ });
198
+ const urls = await project.waitForCompletion();
199
+ ```
200
+
201
+ ### Audio Model Variants
202
+ | Model ID | Name | Description |
203
+ |----------|------|-------------|
204
+ | `ace_step_1.5_turbo` | Fast & Catchy | Quick generation, best quality sound |
205
+ | `ace_step_1.5_sft` | More Control | More accurate lyrics, less stable |
206
+
207
+ ### Video Workflow Asset Requirements
208
+ | Workflow | Model Pattern | Required Assets |
209
+ |----------|---------------|-----------------|
210
+ | Text-to-Video | `*_t2v*` | None |
211
+ | Image-to-Video | `*_i2v*` | `referenceImage` (and/or `referenceImageEnd`) |
212
+ | Video-to-Video | `*_v2v*` (LTX-2 only) | `referenceVideo` + `controlNet` |
213
+ | Sound-to-Video | `*_s2v*` (WAN only) | `referenceImage` + `referenceAudio` |
214
+ | Image+Audio-to-Video | `*_ia2v*` (LTX-2 only) | `referenceImage` + `referenceAudio` |
215
+ | Audio-to-Video | `*_a2v*` (LTX-2 only) | `referenceAudio` |
216
+ | Animate-Move | `*_animate-move*` | `referenceImage` + `referenceVideo` |
217
+ | Animate-Replace | `*_animate-replace*` | `referenceImage` + `referenceVideo` |
218
+
219
+ ## LLM Chat — Thinking Models & Tool Calling
220
+
221
+ ### Model Capabilities via `sogni.chat.waitForModels()`
222
+
223
+ The SDK receives `LLMModelInfo` per model including `maxContextLength`, `maxOutputTokens` (min/max/default), and parameter constraints. Use these to configure `max_tokens` and display limits to users.
224
+
225
+ **Caution**: `maxContextLength` from the server may not reflect the actual per-request limit on the worker (see sogni-socket and sogni-llm-nvidia CLAUDE.md for the llama-server `--parallel` slot division issue).
226
+
227
+ ### Thinking Models (Qwen3/3.5) — `reasoning_content` Split
228
+
229
+ Qwen3/3.5 models generate thinking output in a separate `reasoning_content` field (OpenAI-compatible). The LLM worker wraps this in `<think>` tags inside `content` for the SDK, or strips it when `/no_think` is in the messages. **However**, the SDK's `ChatCompletionChunk` type has NO `reasoning_content` field — only `content` and `tool_calls`.
230
+
231
+ **The problem**: Even with `think: false` (which appends `/no_think`), the model still generates thinking tokens internally, consuming output budget. If the context window is tight, the model exhausts its output tokens on thinking before producing content or tool calls → `finishReason=length` with empty content and no tool calls.
232
+
233
+ **The solution for structured output**: Use **tool calling** (`tools` + `tool_choice: 'required'`). Tool call arguments are always forwarded by the worker regardless of thinking mode. The `workflow_text_chat_sogni_tools.mjs` example uses this pattern for all composition pipelines (video/image/audio prompt engineering).
234
+
235
+ ### Composition Pipeline Architecture
236
+
237
+ The example's composition pipelines (composeVideo, composeImage, composeSong) use:
238
+ 1. **Tool calling as the primary output mechanism** — `tool_choice: 'required'` with a structured tool schema
239
+ 2. **Trimmed system prompts** — Creative guidance only; structural/format info is in the tool schema (reduces input tokens for tight context windows)
240
+ 3. **Model info from `waitForModels()`** — `maxOutputTokens.default` for `max_tokens`