@sogni-ai/sogni-client 4.0.0-alpha.8 → 4.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.
- package/CHANGELOG.md +275 -0
- package/README.md +263 -31
- package/dist/Account/index.d.ts +18 -16
- package/dist/Account/index.js +31 -20
- package/dist/Account/index.js.map +1 -1
- package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/ChannelCoordinator.d.ts +66 -0
- package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/ChannelCoordinator.js +332 -0
- package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/ChannelCoordinator.js.map +1 -0
- package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/index.d.ts +28 -0
- package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/index.js +203 -0
- package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/index.js.map +1 -0
- package/dist/ApiClient/WebSocketClient/events.d.ts +12 -0
- package/dist/ApiClient/WebSocketClient/index.d.ts +2 -2
- package/dist/ApiClient/WebSocketClient/index.js +13 -3
- package/dist/ApiClient/WebSocketClient/index.js.map +1 -1
- package/dist/ApiClient/WebSocketClient/types.d.ts +13 -0
- package/dist/ApiClient/index.d.ts +4 -4
- package/dist/ApiClient/index.js +23 -4
- package/dist/ApiClient/index.js.map +1 -1
- package/dist/Projects/Job.d.ts +44 -4
- package/dist/Projects/Job.js +83 -16
- package/dist/Projects/Job.js.map +1 -1
- package/dist/Projects/Project.d.ts +18 -0
- package/dist/Projects/Project.js +38 -10
- package/dist/Projects/Project.js.map +1 -1
- package/dist/Projects/createJobRequestMessage.js +170 -13
- package/dist/Projects/createJobRequestMessage.js.map +1 -1
- package/dist/Projects/index.d.ts +112 -11
- package/dist/Projects/index.js +473 -45
- package/dist/Projects/index.js.map +1 -1
- package/dist/Projects/types/ComfySamplerParams.d.ts +28 -0
- package/dist/Projects/types/ComfySamplerParams.js +36 -0
- package/dist/Projects/types/ComfySamplerParams.js.map +1 -0
- package/dist/Projects/types/ComfySchedulerParams.d.ts +17 -0
- package/dist/Projects/types/ComfySchedulerParams.js +23 -0
- package/dist/Projects/types/ComfySchedulerParams.js.map +1 -0
- package/dist/Projects/types/EstimationResponse.d.ts +2 -0
- package/dist/Projects/types/ForgeSamplerParams.d.ts +27 -0
- package/dist/Projects/types/ForgeSamplerParams.js +39 -0
- package/dist/Projects/types/ForgeSamplerParams.js.map +1 -0
- package/dist/Projects/types/ForgeSchedulerParams.d.ts +17 -0
- package/dist/Projects/types/ForgeSchedulerParams.js +28 -0
- package/dist/Projects/types/ForgeSchedulerParams.js.map +1 -0
- package/dist/Projects/types/events.d.ts +5 -1
- package/dist/Projects/types/index.d.ts +205 -38
- package/dist/Projects/types/index.js +17 -0
- package/dist/Projects/types/index.js.map +1 -1
- package/dist/Projects/utils.d.ts +19 -1
- package/dist/Projects/utils.js +68 -0
- package/dist/Projects/utils.js.map +1 -1
- package/dist/index.d.ts +12 -4
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/lib/AuthManager/TokenAuthManager.js +0 -2
- package/dist/lib/AuthManager/TokenAuthManager.js.map +1 -1
- package/dist/lib/DataEntity.js +4 -2
- package/dist/lib/DataEntity.js.map +1 -1
- package/dist/lib/RestClient.js +15 -2
- package/dist/lib/RestClient.js.map +1 -1
- package/dist/lib/validation.d.ts +26 -2
- package/dist/lib/validation.js +95 -10
- package/dist/lib/validation.js.map +1 -1
- package/package.json +4 -4
- package/src/Account/index.ts +30 -19
- package/src/ApiClient/WebSocketClient/BrowserWebSocketClient/ChannelCoordinator.ts +426 -0
- package/src/ApiClient/WebSocketClient/BrowserWebSocketClient/index.ts +237 -0
- package/src/ApiClient/WebSocketClient/events.ts +14 -0
- package/src/ApiClient/WebSocketClient/index.ts +15 -5
- package/src/ApiClient/WebSocketClient/types.ts +16 -0
- package/src/ApiClient/index.ts +30 -8
- package/src/Projects/Job.ts +97 -16
- package/src/Projects/Project.ts +46 -13
- package/src/Projects/createJobRequestMessage.ts +222 -35
- package/src/Projects/index.ts +504 -49
- package/src/Projects/types/ComfySamplerParams.ts +34 -0
- package/src/Projects/types/ComfySchedulerParams.ts +21 -0
- package/src/Projects/types/EstimationResponse.ts +2 -0
- package/src/Projects/types/ForgeSamplerParams.ts +37 -0
- package/src/Projects/types/ForgeSchedulerParams.ts +26 -0
- package/src/Projects/types/events.ts +6 -0
- package/src/Projects/types/index.ts +243 -39
- package/src/Projects/utils.ts +66 -1
- package/src/index.ts +60 -8
- package/src/lib/AuthManager/TokenAuthManager.ts +0 -2
- package/src/lib/DataEntity.ts +4 -2
- package/src/lib/RestClient.ts +16 -2
- package/src/lib/validation.ts +111 -14
- package/dist/Projects/types/SamplerParams.d.ts +0 -15
- package/dist/Projects/types/SamplerParams.js +0 -21
- package/dist/Projects/types/SamplerParams.js.map +0 -1
- package/dist/Projects/types/SchedulerParams.d.ts +0 -13
- package/dist/Projects/types/SchedulerParams.js +0 -19
- package/dist/Projects/types/SchedulerParams.js.map +0 -1
- package/src/Projects/types/SamplerParams.ts +0 -19
- package/src/Projects/types/SchedulerParams.ts +0 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,278 @@
|
|
|
1
|
+
# [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
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* videoStart release ([d9dd123](https://github.com/Sogni-AI/sogni-client/commit/d9dd1234c75e5166a94ef2aa7a705f6679c3d3ec))
|
|
7
|
+
|
|
8
|
+
# [4.0.0-alpha.43](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.42...v4.0.0-alpha.43) (2026-01-07)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* very long running video progress jobs aborting prematurely ([8860ae8](https://github.com/Sogni-AI/sogni-client/commit/8860ae87bfb8104a64585c3107f6d4da1c3b4615))
|
|
14
|
+
|
|
15
|
+
# [4.0.0-alpha.42](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.41...v4.0.0-alpha.42) (2026-01-07)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* 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))
|
|
21
|
+
|
|
22
|
+
# [4.0.0-alpha.41](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.40...v4.0.0-alpha.41) (2026-01-06)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* example script workflow enhancements ([94d14e4](https://github.com/Sogni-AI/sogni-client/commit/94d14e42a121976b1090fe797734f2f76e57da02))
|
|
28
|
+
|
|
29
|
+
# [4.0.0-alpha.40](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.39...v4.0.0-alpha.40) (2026-01-06)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* res_multistep support in SupportedComfySamplers to fix support for z-image. /examples script enhancements ([332e7b1](https://github.com/Sogni-AI/sogni-client/commit/332e7b1280272e05c7d897de22edea61482f5b7c))
|
|
35
|
+
|
|
36
|
+
# [4.0.0-alpha.39](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.38...v4.0.0-alpha.39) (2026-01-05)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* Add ForgeSampler, ComfySampler, ForgeScheduler, and ComfyScheduler to exports ([ad24b32](https://github.com/Sogni-AI/sogni-client/commit/ad24b326904f7ad67f43c34a0b758ce64e84a8f1))
|
|
42
|
+
|
|
43
|
+
# [4.0.0-alpha.38](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.37...v4.0.0-alpha.38) (2026-01-05)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Features
|
|
47
|
+
|
|
48
|
+
* Support Qwen, Z Image and Flux 2 models ([fd3acb7](https://github.com/Sogni-AI/sogni-client/commit/fd3acb7bdce5d7c81750e58fb79d14cf4f5f0b2f))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### BREAKING CHANGES
|
|
52
|
+
|
|
53
|
+
* `SupportedSamplers` and `SupportedSchedulers` removed
|
|
54
|
+
`SupportedSamplers` and `SupportedSchedulers` are replaced with `SupportedComfySchedulers`, `SupportedComfySamplers`, `SupportedForgeSchedulers`, `SupportedForgeSamplers`
|
|
55
|
+
|
|
56
|
+
* fix: Prettier formatting
|
|
57
|
+
|
|
58
|
+
# [4.0.0-alpha.37](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.36...v4.0.0-alpha.37) (2026-01-05)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
### Bug Fixes
|
|
62
|
+
|
|
63
|
+
* Replace frames with duration in project cost estimation ([b6c576e](https://github.com/Sogni-AI/sogni-client/commit/b6c576e70b66d2604441e1bd8e013fa435c0c099))
|
|
64
|
+
|
|
65
|
+
# [4.0.0-alpha.36](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.35...v4.0.0-alpha.36) (2026-01-05)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Features
|
|
69
|
+
|
|
70
|
+
* Add support for video duration options with validation and deprecate frames property ([fa11d79](https://github.com/Sogni-AI/sogni-client/commit/fa11d7905ef249a2e75a6d96c8a2bedda24005df))
|
|
71
|
+
|
|
72
|
+
# [4.0.0-alpha.35](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.34...v4.0.0-alpha.35) (2025-12-31)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
### Bug Fixes
|
|
76
|
+
|
|
77
|
+
* allow i2v workflow to use either referenceImage or referenceImageEnd ([b9f08ef](https://github.com/Sogni-AI/sogni-client/commit/b9f08efa91e92f58280b923c5815c9b6645c5452))
|
|
78
|
+
|
|
79
|
+
# [4.0.0-alpha.34](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.33...v4.0.0-alpha.34) (2025-12-30)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
### Features
|
|
83
|
+
|
|
84
|
+
* Add VideoProjectParams optional teacacheThreshold support ([7a68d4c](https://github.com/Sogni-AI/sogni-client/commit/7a68d4ccc8db8fa1ed410452321468d434927bd1))
|
|
85
|
+
|
|
86
|
+
# [4.0.0-alpha.33](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.32...v4.0.0-alpha.33) (2025-12-19)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
### Bug Fixes
|
|
90
|
+
|
|
91
|
+
* Add numberOfMedia parameter to video project estimation request ([b762e61](https://github.com/Sogni-AI/sogni-client/commit/b762e6130c94a1aa192047c9b14f54dc1acb0191))
|
|
92
|
+
|
|
93
|
+
# [4.0.0-alpha.32](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.31...v4.0.0-alpha.32) (2025-12-18)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
### Bug Fixes
|
|
97
|
+
|
|
98
|
+
* Prevent potential memory leak in Project.waitForCompletion ([010a1de](https://github.com/Sogni-AI/sogni-client/commit/010a1decd1f5168275c34f95ccdb7ca8092ac3e5))
|
|
99
|
+
|
|
100
|
+
# [4.0.0-alpha.31](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.30...v4.0.0-alpha.31) (2025-12-17)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
### Features
|
|
104
|
+
|
|
105
|
+
* Add project and job ETA properties ([66024cc](https://github.com/Sogni-AI/sogni-client/commit/66024cc26dac51bbd45dc5b4d7e68c5963f8c178))
|
|
106
|
+
|
|
107
|
+
# [4.0.0-alpha.30](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.29...v4.0.0-alpha.30) (2025-12-17)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
### Features
|
|
111
|
+
|
|
112
|
+
* Add video project cost estimation ([33c7533](https://github.com/Sogni-AI/sogni-client/commit/33c7533b90bfe7c23c465b38867d184b00561112))
|
|
113
|
+
|
|
114
|
+
# [4.0.0-alpha.29](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.28...v4.0.0-alpha.29) (2025-12-16)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
### Bug Fixes
|
|
118
|
+
|
|
119
|
+
* wan sample scripts for s2v and animate should all support custom prompts ([5a2dbf9](https://github.com/Sogni-AI/sogni-client/commit/5a2dbf963c8ff411dece0dec87b52117a0baea23))
|
|
120
|
+
|
|
121
|
+
# [4.0.0-alpha.28](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.27...v4.0.0-alpha.28) (2025-12-15)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
### Features
|
|
125
|
+
|
|
126
|
+
* Expose array of projects that SogniClient instance is tracking currently ([38b6c0e](https://github.com/Sogni-AI/sogni-client/commit/38b6c0ec7ab3e6f621e42f9e512ede98f4b3a9da))
|
|
127
|
+
|
|
128
|
+
# [4.0.0-alpha.27](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.26...v4.0.0-alpha.27) (2025-12-12)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
### Features
|
|
132
|
+
|
|
133
|
+
* Add ability to query balance for Etherlink wallet ([60ef11b](https://github.com/Sogni-AI/sogni-client/commit/60ef11beec443837a044e24c11014bef8f804275))
|
|
134
|
+
|
|
135
|
+
# [4.0.0-alpha.26](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.25...v4.0.0-alpha.26) (2025-12-12)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
### Bug Fixes
|
|
139
|
+
|
|
140
|
+
* 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))
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
### Features
|
|
144
|
+
|
|
145
|
+
* ensure video model passed with and height are at least 480 ([d0156aa](https://github.com/Sogni-AI/sogni-client/commit/d0156aa84785f98c60ee09e7c733e62940eb0b9e))
|
|
146
|
+
|
|
147
|
+
# [4.0.0-alpha.25](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.24...v4.0.0-alpha.25) (2025-12-11)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
### Bug Fixes
|
|
151
|
+
|
|
152
|
+
* Add sample parameters for Flux ([8e25924](https://github.com/Sogni-AI/sogni-client/commit/8e25924476a1faf1ac432a6490b4d52ac0cf4898))
|
|
153
|
+
|
|
154
|
+
# [4.0.0-alpha.24](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.23...v4.0.0-alpha.24) (2025-12-11)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
### Features
|
|
158
|
+
|
|
159
|
+
* final round of doc / example enhancements with new steps support for Wan video models ([95d5dfb](https://github.com/Sogni-AI/sogni-client/commit/95d5dfb61d5ed2878c04cd6cf7a0d75d9d0754e1))
|
|
160
|
+
|
|
161
|
+
# [4.0.0-alpha.23](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.22...v4.0.0-alpha.23) (2025-12-10)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
### Features
|
|
165
|
+
|
|
166
|
+
* Add credential management system for video examples ([e7fc1ab](https://github.com/Sogni-AI/sogni-client/commit/e7fc1abf85d32995c64c48a5f861cb3f99a4793b))
|
|
167
|
+
* Enhance video example scripts with improved UX ([6a70c26](https://github.com/Sogni-AI/sogni-client/commit/6a70c26e2b30b5be7bcae88171bbd3956bbe91af))
|
|
168
|
+
|
|
169
|
+
# [4.0.0-alpha.22](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.21...v4.0.0-alpha.22) (2025-12-10)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
### Features
|
|
173
|
+
|
|
174
|
+
* Video support added with Wan 2.2 14B FP8 models supporting five workflows: text-to-video (t2v), image-to-video (i2v), sound-to-video (s2v), animate-move, and animate-replace ([e00e1e7](https://github.com/Sogni-AI/sogni-client/commit/e00e1e7879962047a6950013d53aa83748a66021))
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
### BREAKING CHANGES
|
|
178
|
+
|
|
179
|
+
* Project creation parameters changed
|
|
180
|
+
- `type` is required when calling `sogni.projects.create(params)`, valid values are `image` and `video`. See code examples below.
|
|
181
|
+
- `numberOfImages` renamed to `numberOfMedia`
|
|
182
|
+
- `hasResultImage` in `Job` class is now `hasResultMedia`
|
|
183
|
+
- `Job` and `Project` classes now have `type` property that can be `image` or `video`
|
|
184
|
+
|
|
185
|
+
# [4.0.0-alpha.21](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.20...v4.0.0-alpha.21) (2025-12-04)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
### Bug Fixes
|
|
189
|
+
|
|
190
|
+
* Fix TypeScript error ([30ff62a](https://github.com/Sogni-AI/sogni-client/commit/30ff62ad5ccb3624bf8a26b70f65b4c0daa9c6ff))
|
|
191
|
+
|
|
192
|
+
# [4.0.0-alpha.20](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.19...v4.0.0-alpha.20) (2025-12-04)
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
### Bug Fixes
|
|
196
|
+
|
|
197
|
+
* Better socket coordinator implementation. Handle socket disconnection properly ([2a1a922](https://github.com/Sogni-AI/sogni-client/commit/2a1a922a0dd41446c1dcf6ffeaccfe54556af5bb))
|
|
198
|
+
|
|
199
|
+
# [4.0.0-alpha.19](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.18...v4.0.0-alpha.19) (2025-12-03)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
### Bug Fixes
|
|
203
|
+
|
|
204
|
+
* Connect socket if client tries to send the message ([b5fa7bc](https://github.com/Sogni-AI/sogni-client/commit/b5fa7bc9599f30ff575521e76d76d42f031769fc))
|
|
205
|
+
|
|
206
|
+
# [4.0.0-alpha.18](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.17...v4.0.0-alpha.18) (2025-12-02)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
### Bug Fixes
|
|
210
|
+
|
|
211
|
+
* Pass error iin message ack ([7b73d87](https://github.com/Sogni-AI/sogni-client/commit/7b73d87fdd27634b75fe5aa0bbba43415d6e7dce))
|
|
212
|
+
|
|
213
|
+
# [4.0.0-alpha.17](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.16...v4.0.0-alpha.17) (2025-12-02)
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
### Bug Fixes
|
|
217
|
+
|
|
218
|
+
* Initialization bug ([42b4e26](https://github.com/Sogni-AI/sogni-client/commit/42b4e26dad8f634eb6c17d172081d6c3d03a3d41))
|
|
219
|
+
|
|
220
|
+
# [4.0.0-alpha.16](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.15...v4.0.0-alpha.16) (2025-12-02)
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
### Bug Fixes
|
|
224
|
+
|
|
225
|
+
* Make shared socket connection optional ([7ee2311](https://github.com/Sogni-AI/sogni-client/commit/7ee2311354071bbcc3087cad0a8c321cea28cd25))
|
|
226
|
+
|
|
227
|
+
# [4.0.0-alpha.15](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.14...v4.0.0-alpha.15) (2025-12-02)
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
### Bug Fixes
|
|
231
|
+
|
|
232
|
+
* Avoid double initialization for WSCoordinator.ts ([1b7e973](https://github.com/Sogni-AI/sogni-client/commit/1b7e973cebd6b35667fa248656127b60125dd4f9))
|
|
233
|
+
|
|
234
|
+
# [4.0.0-alpha.14](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.13...v4.0.0-alpha.14) (2025-12-01)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
### Bug Fixes
|
|
238
|
+
|
|
239
|
+
* Move type definitions to dependencies from devDependencies ([95b5201](https://github.com/Sogni-AI/sogni-client/commit/95b520191593913bd0b74cd8cf41241eac16dd8e))
|
|
240
|
+
|
|
241
|
+
# [4.0.0-alpha.13](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.12...v4.0.0-alpha.13) (2025-12-01)
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
### Features
|
|
245
|
+
|
|
246
|
+
* 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))
|
|
247
|
+
|
|
248
|
+
# [4.0.0-alpha.12](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.11...v4.0.0-alpha.12) (2025-10-30)
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
### Features
|
|
252
|
+
|
|
253
|
+
* Expose project cost in both Spark Points and Sogni tokens when estimating ([9d5f556](https://github.com/Sogni-AI/sogni-client/commit/9d5f556154013ae15e49e93e9941533e730502c5))
|
|
254
|
+
|
|
255
|
+
# [4.0.0-alpha.11](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.10...v4.0.0-alpha.11) (2025-10-23)
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
### Bug Fixes
|
|
259
|
+
|
|
260
|
+
* Accept raw samplers and schedulers for backward compatibility ([8c04552](https://github.com/Sogni-AI/sogni-client/commit/8c04552667fe054e9a330a3aab8fd776060a0ed6))
|
|
261
|
+
|
|
262
|
+
# [4.0.0-alpha.10](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.9...v4.0.0-alpha.10) (2025-10-21)
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
### Bug Fixes
|
|
266
|
+
|
|
267
|
+
* Fix project estimation. Export supported samplers and schedulers list ([502d4d1](https://github.com/Sogni-AI/sogni-client/commit/502d4d19529883b5272466a122720f2c6fd01e2e))
|
|
268
|
+
|
|
269
|
+
# [4.0.0-alpha.9](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.8...v4.0.0-alpha.9) (2025-10-17)
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
### Bug Fixes
|
|
273
|
+
|
|
274
|
+
* Hide samplers that are not well tested ([0522bed](https://github.com/Sogni-AI/sogni-client/commit/0522bed6cfad5f8bc9c37d65c30b63b31aa0168a))
|
|
275
|
+
|
|
1
276
|
# [4.0.0-alpha.8](https://github.com/Sogni-AI/sogni-client/compare/v4.0.0-alpha.7...v4.0.0-alpha.8) (2025-10-17)
|
|
2
277
|
|
|
3
278
|
|
package/README.md
CHANGED
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
# Sogni SDK for JavaScript & Node.js
|
|
2
|
-
This library provides an easy way to interact with the [Sogni
|
|
2
|
+
This library provides an easy way to interact with the [Sogni Supernet](https://www.sogni.ai/supernet) - a DePIN protocol for creative AI inference. It is written in TypeScript and can be used
|
|
3
3
|
in both TypeScript and JavaScript projects such as backend Node.js and browser environments.
|
|
4
4
|
|
|
5
|
-
Behind the scenes this SDK uses WebSocket connection for communication between clients, server, and workers. It harnesses an event-based API to interact with Supernet to make things super efficient.
|
|
5
|
+
Behind the scenes this SDK uses a WebSocket connection for communication between clients, server, and workers. It harnesses an event-based API to interact with Supernet to make things super efficient.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
- 🎨 **Image Generation** - Create images with the latest frontier Open Source models like Stable Diffusion, Z-Image Turbo, and Flux
|
|
9
|
+
- 🎨 **Image Edit** - Modify, merge, restyle, and transform images using prompts and/or multiple reference images using powerful models like Qwen Image Edit.
|
|
10
|
+
- 🎬 **Video Generation** - Generate videos using **Wan 2.2 14B FP8** models with five workflow types:
|
|
11
|
+
- Text-to-Video (t2v) - Generate videos from text prompts
|
|
12
|
+
- Image-to-Video (i2v) - Animate static images
|
|
13
|
+
- Sound-to-Video (s2v) - Generate videos synchronized with audio
|
|
14
|
+
- Animate-Move - Transfer motion from reference video to image subject
|
|
15
|
+
- Animate-Replace - Replace subjects in videos while preserving motion
|
|
16
|
+
- ⚡ **Fast & Relaxed Networks** - Choose between high-speed GPU network or cost-effective Mac network
|
|
17
|
+
- 🔄 **Real-time Progress** - Event-based API with progress tracking and live updates
|
|
18
|
+
- 🎯 **Advanced Controls** - Fine-tune generation with samplers, schedulers, ControlNets, and more
|
|
19
|
+
## Migration notes
|
|
20
|
+
### v3.x.x to v4.x.x
|
|
21
|
+
Version 4 adds support for video generation, including the new **Wan 2.2 14B FP8** model family with five workflow types (text-to-video, image-to-video, sound-to-video, animate-move, and animate-replace). There are the following breaking changes:
|
|
22
|
+
- `type` is required when calling `sogni.projects.create(params)`, valid values are `image` and `video`. See code examples below.
|
|
23
|
+
- `numberOfImages` renamed to `numberOfMedia`
|
|
24
|
+
- `hasResultImage` in `Job` class is now `hasResultMedia`
|
|
25
|
+
- `Job` and `Project` classes now have `type` property that can be `image` or `video`
|
|
6
26
|
|
|
7
27
|
## Installation
|
|
8
28
|
Add library to your project using npm or yarn:
|
|
@@ -23,17 +43,17 @@ Your account is tied to a [Base](https://www.base.org/) Wallet that is created d
|
|
|
23
43
|
|
|
24
44
|
### Supernet Types
|
|
25
45
|
There are 2 worker network types available:
|
|
26
|
-
- `fast` - this network runs on high-end GPUs and is optimized for speed. It is more expensive than `relaxed` network.
|
|
27
|
-
- `relaxed` - this network runs on Apple Mac devices and is optimized for cost. It is cheaper than `fast` network.
|
|
46
|
+
- `fast` - this network runs on high-end GPUs and is optimized for speed. It is more expensive than `relaxed` network. **Required for video generation**.
|
|
47
|
+
- `relaxed` - this network runs on Apple Mac devices and is optimized for cost. It is cheaper than `fast` network. Supports image generation only.
|
|
28
48
|
|
|
29
49
|
In both options, the more complex your query is (the more steps), the higher the cost in tokens.
|
|
30
50
|
|
|
31
51
|
### Inference definitions: Projects and Jobs
|
|
32
|
-
One request for image generation is called a **Project**.
|
|
33
|
-
Each image is represented by a **Job**.
|
|
52
|
+
One request for image or video generation is called a **Project**. A project can generate one or more images or videos.
|
|
53
|
+
Each generated image or video is represented by a **Job**.
|
|
34
54
|
|
|
35
|
-
When you send a project to Supernet, it will be processed by one or more workers. The resulting
|
|
36
|
-
uploaded to Sogni servers where it will be stored for 24 hours. After this period
|
|
55
|
+
When you send a project to Supernet, it will be processed by one or more workers. The resulting media will be encrypted and
|
|
56
|
+
uploaded to Sogni servers where it will be stored for 24 hours. After this period, media files will be auto-deleted.
|
|
37
57
|
|
|
38
58
|
## Client initialization
|
|
39
59
|
To initialize a client, you need to provide `appId`, and account credentials.
|
|
@@ -49,13 +69,13 @@ const options = {
|
|
|
49
69
|
network: 'fast', // Network to use, 'fast' or 'relaxed'
|
|
50
70
|
}
|
|
51
71
|
|
|
52
|
-
const
|
|
72
|
+
const sogni = await SogniClient.createInstance(options);
|
|
53
73
|
// Login to Sogni account and establish WebSocket connection to Supernet
|
|
54
|
-
await
|
|
74
|
+
await sogni.account.login(USERNAME, PASSWORD);
|
|
55
75
|
// Now wait until list of available models is received.
|
|
56
76
|
// This step is only needed if you want to create project immediately.
|
|
57
|
-
const models = await
|
|
58
|
-
// You can get list of available models any time from `
|
|
77
|
+
const models = await sogni.projects.waitForModels();
|
|
78
|
+
// You can get list of available models any time from `sogni.projects.availableModels`
|
|
59
79
|
```
|
|
60
80
|
**Important Note:**
|
|
61
81
|
- This sample assume you are using ES modules, which allow `await` on the top level, if you are CommomJS you will need to wrap `await` calls in an async function.
|
|
@@ -64,16 +84,44 @@ const models = await client.projects.waitForModels();
|
|
|
64
84
|
|
|
65
85
|
## Usage
|
|
66
86
|
After calling `login` method, the client will establish a WebSocket connection to Sogni Supernet. Within a short period of time the
|
|
67
|
-
client will receive the current balance and list of available models. After this you can start using the client to generate images.
|
|
87
|
+
client will receive the current balance and list of available models. After this you can start using the client to generate images or videos.
|
|
68
88
|
|
|
69
|
-
|
|
89
|
+
It is advised to watch for `connected` and `disconnected` events on the client instance to be notified when the connection is established or lost:
|
|
90
|
+
```typescript
|
|
91
|
+
// Will be triggered when the client is connected to Supernet
|
|
92
|
+
sogni.client.on('connected', ({network}) => {
|
|
93
|
+
console.log('Connected to Supernet:', network);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// Will be triggered when websocket connection is lost or the client is disconnected from Supernet
|
|
97
|
+
sogni.client.on('disconnected', ({code, reason}) => {
|
|
98
|
+
console.log('Disconnected from Supernet:', code, reason);
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Image Generation
|
|
103
|
+
|
|
104
|
+
Sogni supports a wide range of models for image generation. You can find a list of available models in
|
|
105
|
+
`sogni.projects.availableModels` property during runtime or query it using `sogni.projects.getAvailableModels()` method.
|
|
106
|
+
|
|
107
|
+
For a start, you can try FLUX.1 \[schnell\] with the following parameters:
|
|
108
|
+
```javascript
|
|
109
|
+
const fluxDefaults = {
|
|
110
|
+
modelId: 'flux1-schnell-fp8',
|
|
111
|
+
steps: 4,
|
|
112
|
+
guidance: 1
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Creating an image project
|
|
70
117
|
```javascript
|
|
71
118
|
// Find model that has the most workers
|
|
72
|
-
const mostPopularModel =
|
|
119
|
+
const mostPopularModel = sogni.projects.availableModels.reduce((a, b) =>
|
|
73
120
|
a.workerCount > b.workerCount ? a : b
|
|
74
121
|
);
|
|
75
122
|
// Create a project using the most popular model
|
|
76
|
-
const project = await
|
|
123
|
+
const project = await sogni.projects.create({
|
|
124
|
+
type: 'image',
|
|
77
125
|
modelId: mostPopularModel.id,
|
|
78
126
|
positivePrompt: 'A cat wearing a hat',
|
|
79
127
|
negativePrompt:
|
|
@@ -81,7 +129,7 @@ const project = await client.projects.create({
|
|
|
81
129
|
stylePrompt: 'anime',
|
|
82
130
|
steps: 20,
|
|
83
131
|
guidance: 7.5,
|
|
84
|
-
|
|
132
|
+
numberOfMedia: 1,
|
|
85
133
|
outputFormat: 'jpg' // Can be 'png' or 'jpg', defaults to 'png'
|
|
86
134
|
});
|
|
87
135
|
```
|
|
@@ -94,7 +142,8 @@ In general, there are 2 ways to work with API:
|
|
|
94
142
|
|
|
95
143
|
#### Using promises
|
|
96
144
|
```javascript
|
|
97
|
-
const project = await
|
|
145
|
+
const project = await sogni.projects.create({
|
|
146
|
+
type: 'image',
|
|
98
147
|
modelId: mostPopularModel.id,
|
|
99
148
|
steps: 20,
|
|
100
149
|
guidance: 7.5,
|
|
@@ -102,7 +151,7 @@ const project = await client.projects.create({
|
|
|
102
151
|
negativePrompt:
|
|
103
152
|
'malformation, bad anatomy, bad hands, missing fingers, cropped, low quality, bad quality, jpeg artifacts, watermark',
|
|
104
153
|
stylePrompt: 'anime',
|
|
105
|
-
|
|
154
|
+
numberOfMedia: 4
|
|
106
155
|
});
|
|
107
156
|
|
|
108
157
|
project.on('progress', (progress) => {
|
|
@@ -117,7 +166,8 @@ console.log('Image URLs:', imageUrls);
|
|
|
117
166
|
|
|
118
167
|
#### Using events
|
|
119
168
|
```javascript
|
|
120
|
-
const project = await
|
|
169
|
+
const project = await sogni.projects.create({
|
|
170
|
+
type: 'image',
|
|
121
171
|
modelId: mostPopularModel.id,
|
|
122
172
|
steps: 20,
|
|
123
173
|
guidance: 7.5,
|
|
@@ -125,7 +175,7 @@ const project = await client.projects.create({
|
|
|
125
175
|
negativePrompt:
|
|
126
176
|
'malformation, bad anatomy, bad hands, missing fingers, cropped, low quality, bad quality, jpeg artifacts, watermark',
|
|
127
177
|
stylePrompt: 'anime',
|
|
128
|
-
|
|
178
|
+
numberOfMedia: 4
|
|
129
179
|
});
|
|
130
180
|
|
|
131
181
|
// Fired when one of project jobs completed, you can get the resultUrl from the job
|
|
@@ -192,9 +242,9 @@ Turbo and LCM models are designed for quality output in as little as 1 step. ([M
|
|
|
192
242
|
TypeScript type definitions for project parameters can be found in [ProjectParams](https://sdk-docs.sogni.ai/interfaces/ProjectParams.html) docs.
|
|
193
243
|
|
|
194
244
|
### Detecting available output presets
|
|
195
|
-
You can get a list of available output presets for a specific network and model using `
|
|
245
|
+
You can get a list of available output presets for a specific network and model using `sogni.projects.getOutputPresets` method.
|
|
196
246
|
```javascript
|
|
197
|
-
const presets = await
|
|
247
|
+
const presets = await sogni.projects.getSizePresets('fast', 'flux1-schnell-fp8');
|
|
198
248
|
console.log('Available output presets:', presets);
|
|
199
249
|
```
|
|
200
250
|
Sample response:
|
|
@@ -290,17 +340,14 @@ Available sampler options:
|
|
|
290
340
|
|
|
291
341
|
| Option | Description |
|
|
292
342
|
|-----------------|-------------------------------------|
|
|
293
|
-
| `dfs_sd3` | Discrete Flow
|
|
343
|
+
| `dfs_sd3` | Discrete Flow Sampler (SD3) |
|
|
294
344
|
| `dpm_pp` | DPM Solver Multistep (DPM-Solver++) |
|
|
295
345
|
| `dpm_pp_sde` | DPM++ SDE |
|
|
296
346
|
| `dpm_pp_2m` | DPM++ 2M |
|
|
297
|
-
| `dpm_pp_2m_sde` | DPM++ 2M SDE |
|
|
298
347
|
| `euler` | Euler |
|
|
299
348
|
| `euler_a` | Euler a |
|
|
300
|
-
| `heun` | Heun |
|
|
301
349
|
| `lcm` | LCM (Latent Consistency Model) |
|
|
302
350
|
| `pndm_plms` | PNDM (Pseudo-linear multi-step) |
|
|
303
|
-
| `uni_pc` | UniPC |
|
|
304
351
|
|
|
305
352
|
**IMPORTANT:** Sampler compatibility depends on model and network. See [Samplers and Schedulers](https://docs.sogni.ai/sogni-studio/advanced/samplers-and-schedulers) docs for more info.
|
|
306
353
|
|
|
@@ -356,10 +403,11 @@ To use ControlNet in your project, you need to provide `controlNet` object with
|
|
|
356
403
|
Example:
|
|
357
404
|
```javascript
|
|
358
405
|
const cnImage = fs.readFileSync('./cn.jpg');
|
|
359
|
-
const project = await
|
|
406
|
+
const project = await sogni.projects.create({
|
|
407
|
+
type: 'image',
|
|
360
408
|
network: 'fast',
|
|
361
409
|
modelId: 'coreml-cyberrealistic_v70_768',
|
|
362
|
-
|
|
410
|
+
numberOfMedia: 1,
|
|
363
411
|
positivePrompt: 'make men look older',
|
|
364
412
|
steps: 20,
|
|
365
413
|
guidance: 7.5,
|
|
@@ -400,5 +448,189 @@ export interface ControlNetParams {
|
|
|
400
448
|
```
|
|
401
449
|
|
|
402
450
|
|
|
403
|
-
##
|
|
404
|
-
|
|
451
|
+
## Video Generation with Wan 2.2 Models
|
|
452
|
+
|
|
453
|
+
The Sogni SDK supports advanced video generation workflows powered by **Wan 2.2 14B FP8** models. These models are available on the `fast` network and support various video generation workflows.
|
|
454
|
+
|
|
455
|
+
### Available Wan 2.2 Workflows
|
|
456
|
+
|
|
457
|
+
The Wan 2.2 model family supports five distinct video generation workflows:
|
|
458
|
+
|
|
459
|
+
1. **Text-to-Video (t2v)** - Generate videos from text prompts
|
|
460
|
+
2. **Image-to-Video (i2v)** - Animate a static image into a video (First and Last Frame supported)
|
|
461
|
+
3. **Sound-to-Video (s2v)** - Bring a character in an image to life with video and audio synchronization including lip syncing
|
|
462
|
+
4. **Animate-Move** - Transfer character motion and emotion from a reference video to a subject from an image into a new video
|
|
463
|
+
5. **Animate-Replace** - Replace a subject in a video while preserving motion
|
|
464
|
+
|
|
465
|
+
### Model Variants
|
|
466
|
+
|
|
467
|
+
Each workflow has two model variants optimized for different use cases:
|
|
468
|
+
|
|
469
|
+
- **Speed variant** (with `_lightx2v` suffix) - Faster inference (4-step), good quality
|
|
470
|
+
- **Quality variant** (without `_lightx2v`) - Slower inference, best quality
|
|
471
|
+
|
|
472
|
+
Example model IDs:
|
|
473
|
+
- `wan_v2.2-14b-fp8_t2v_lightx2v` (Text-to-Video, speed)
|
|
474
|
+
- `wan_v2.2-14b-fp8_t2v` (Text-to-Video, quality)
|
|
475
|
+
- `wan_v2.2-14b-fp8_i2v_lightx2v` (Image-to-Video, speed)
|
|
476
|
+
- `wan_v2.2-14b-fp8_i2v` (Image-to-Video, quality)
|
|
477
|
+
- `wan_v2.2-14b-fp8_s2v_lightx2v` (Sound-to-Video, speed)
|
|
478
|
+
- `wan_v2.2-14b-fp8_s2v` (Sound-to-Video, quality)
|
|
479
|
+
- `wan_v2.2-14b-fp8_animate-move_lightx2v` (Animate-Move, speed)
|
|
480
|
+
- `wan_v2.2-14b-fp8_animate-replace_lightx2v` (Animate-Replace, speed)
|
|
481
|
+
|
|
482
|
+
### Video Parameters
|
|
483
|
+
|
|
484
|
+
When creating video projects, you can specify:
|
|
485
|
+
|
|
486
|
+
- `fps` - Frames per second: 16 or 32 (default: 16)
|
|
487
|
+
- `frames` - Number of frames: 17-161 (default: 81, which is ~5 seconds at 16fps)
|
|
488
|
+
- `width` - Video width in pixels
|
|
489
|
+
- `height` - Video height in pixels
|
|
490
|
+
- `steps` - Increase inference steps to increase quality
|
|
491
|
+
- `seed` - Random seed for reproducibility
|
|
492
|
+
- `referenceImage` - Reference image for workflows that require it (i2v, s2v, animate-move, animate-replace)
|
|
493
|
+
- `referenceVideo` - Reference video for animate workflows (animate-move, animate-replace)
|
|
494
|
+
- `referenceAudio` - Reference audio for sound-to-video workflow
|
|
495
|
+
|
|
496
|
+
### Text-to-Video Example
|
|
497
|
+
|
|
498
|
+
```javascript
|
|
499
|
+
const project = await sogni.projects.create({
|
|
500
|
+
type: 'video',
|
|
501
|
+
network: 'fast',
|
|
502
|
+
modelId: 'wan_v2.2-14b-fp8_t2v_lightx2v',
|
|
503
|
+
positivePrompt: 'A serene ocean wave crashing on a beach at sunset',
|
|
504
|
+
fps: 16,
|
|
505
|
+
frames: 81,
|
|
506
|
+
width: 512,
|
|
507
|
+
height: 512
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
const videoUrls = await project.waitForCompletion();
|
|
511
|
+
console.log('Video URL:', videoUrls[0]);
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
### Image-to-Video Example
|
|
515
|
+
|
|
516
|
+
```javascript
|
|
517
|
+
const referenceImage = fs.readFileSync('./input-image.png');
|
|
518
|
+
|
|
519
|
+
const project = await sogni.projects.create({
|
|
520
|
+
type: 'video',
|
|
521
|
+
network: 'fast',
|
|
522
|
+
modelId: 'wan_v2.2-14b-fp8_i2v_lightx2v',
|
|
523
|
+
positivePrompt: 'camera zooms in slowly',
|
|
524
|
+
referenceImage: referenceImage,
|
|
525
|
+
fps: 16,
|
|
526
|
+
frames: 81
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
const videoUrls = await project.waitForCompletion();
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
### Sound-to-Video Example
|
|
533
|
+
|
|
534
|
+
```javascript
|
|
535
|
+
const referenceImage = fs.readFileSync('./image.jpg');
|
|
536
|
+
const referenceAudio = fs.readFileSync('./audio.m4a');
|
|
537
|
+
|
|
538
|
+
const project = await sogni.projects.create({
|
|
539
|
+
type: 'video',
|
|
540
|
+
network: 'fast',
|
|
541
|
+
modelId: 'wan_v2.2-14b-fp8_s2v_lightx2v',
|
|
542
|
+
referenceImage: referenceImage,
|
|
543
|
+
referenceAudio: referenceAudio,
|
|
544
|
+
fps: 16,
|
|
545
|
+
frames: 81
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
const videoUrls = await project.waitForCompletion();
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
### Animate-Move Example
|
|
552
|
+
|
|
553
|
+
Transfer motion from a reference video to a subject in an image:
|
|
554
|
+
|
|
555
|
+
```javascript
|
|
556
|
+
const referenceImage = fs.readFileSync('./subject.jpg');
|
|
557
|
+
const referenceVideo = fs.readFileSync('./motion-source.mp4');
|
|
558
|
+
|
|
559
|
+
const project = await sogni.projects.create({
|
|
560
|
+
type: 'video',
|
|
561
|
+
network: 'fast',
|
|
562
|
+
modelId: 'wan_v2.2-14b-fp8_animate-move_lightx2v',
|
|
563
|
+
referenceImage: referenceImage,
|
|
564
|
+
referenceVideo: referenceVideo,
|
|
565
|
+
fps: 16,
|
|
566
|
+
frames: 81
|
|
567
|
+
});
|
|
568
|
+
|
|
569
|
+
const videoUrls = await project.waitForCompletion();
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
### Animate-Replace Example
|
|
573
|
+
|
|
574
|
+
Replace a subject in a video while preserving the original motion:
|
|
575
|
+
|
|
576
|
+
```javascript
|
|
577
|
+
const referenceImage = fs.readFileSync('./new-subject.jpg');
|
|
578
|
+
const referenceVideo = fs.readFileSync('./original-video.mp4');
|
|
579
|
+
|
|
580
|
+
const project = await sogni.projects.create({
|
|
581
|
+
type: 'video',
|
|
582
|
+
network: 'fast',
|
|
583
|
+
modelId: 'wan_v2.2-14b-fp8_animate-replace_lightx2v',
|
|
584
|
+
referenceImage: referenceImage,
|
|
585
|
+
referenceVideo: referenceVideo,
|
|
586
|
+
fps: 16,
|
|
587
|
+
frames: 81
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
const videoUrls = await project.waitForCompletion();
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
## Code Examples
|
|
594
|
+
|
|
595
|
+
The [examples](https://github.com/Sogni-AI/sogni-client/tree/main/examples) directory contains working examples for all workflows:
|
|
596
|
+
|
|
597
|
+
### Image Workflow Examples
|
|
598
|
+
- **`workflow_text_to_image.mjs`** - Text-to-image generation with multiple model options
|
|
599
|
+
- **`workflow_image_edit.mjs`** - Reference-based image generation using context images
|
|
600
|
+
|
|
601
|
+
### Video Workflow Examples
|
|
602
|
+
- **`workflow_text_to_video.mjs`** - Text-to-video generation with WAN 2.2 models
|
|
603
|
+
- **`workflow_image_to_video.mjs`** - Animate static images into videos
|
|
604
|
+
- **`workflow_sound_to_video.mjs`** - Audio-synchronized video generation with lip-sync
|
|
605
|
+
- **`workflow_video_to_video.mjs`** - Motion transfer and character replacement (Animate-Move/Animate-Replace)
|
|
606
|
+
|
|
607
|
+
### Basic Examples
|
|
608
|
+
- **`promise_based.mjs`** - Image generation using promises/async-await
|
|
609
|
+
- **`event_driven.js`** - Image generation using event listeners
|
|
610
|
+
|
|
611
|
+
### Featured Models
|
|
612
|
+
|
|
613
|
+
The workflow examples showcase a few powerful open-source frontier models supported by Sogni Supernet:
|
|
614
|
+
|
|
615
|
+
| Model ID | Description | Use Case |
|
|
616
|
+
|----------|-------------|----------|
|
|
617
|
+
| `z_image_turbo_bf16` | **Z-Image Turbo** - Ultra-fast 4-step generation | Quick text-to-image prototyping and iteration |
|
|
618
|
+
| `qwen_image_edit_2511_fp8_lightning` | **Qwen Image Edit Lightning** - Fast 4-step editing | Rapid reference-based image generation |
|
|
619
|
+
| `qwen_image_edit_2511_fp8` | **Qwen Image Edit** - High quality 20-step editing | Professional image editing with context awareness |
|
|
620
|
+
| `wan_v2.2-14b-fp8_t2v_lightx2v` | **Wan 2.2 T2V** - Text-to-video | Generate videos from text prompts |
|
|
621
|
+
|
|
622
|
+
All workflow examples include:
|
|
623
|
+
- Interactive model and parameter selection
|
|
624
|
+
- Balance checking and cost confirmation
|
|
625
|
+
- Real-time progress tracking with ETA
|
|
626
|
+
- Error handling with detailed feedback
|
|
627
|
+
- Automatic file download and preview
|
|
628
|
+
|
|
629
|
+
Run any workflow example:
|
|
630
|
+
```bash
|
|
631
|
+
cd examples
|
|
632
|
+
npm install
|
|
633
|
+
node workflow_text_to_image.mjs
|
|
634
|
+
node workflow_image_edit.mjs
|
|
635
|
+
node workflow_text_to_video.mjs
|
|
636
|
+
```
|