@sogni-ai/sogni-client 5.50.1 → 5.51.1

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 (58) hide show
  1. package/AGENTS.md +2 -2
  2. package/CHANGELOG.md +14 -0
  3. package/README.md +63 -2
  4. package/dist/Chat/_hostedToolsManifest.generated.js +295 -7
  5. package/dist/Chat/_hostedToolsManifest.generated.js.map +1 -1
  6. package/dist/Chat/index.d.ts +17 -9
  7. package/dist/Chat/index.js +12 -7
  8. package/dist/Chat/index.js.map +1 -1
  9. package/dist/Chat/modelRouting.js +2 -3
  10. package/dist/Chat/modelRouting.js.map +1 -1
  11. package/dist/Chat/tools.d.ts +7 -1
  12. package/dist/Chat/tools.js +7 -1
  13. package/dist/Chat/tools.js.map +1 -1
  14. package/dist/Chat/types.d.ts +93 -8
  15. package/dist/CreativeWorkflows/types.d.ts +1 -1
  16. package/dist/Projects/PersonalLoras.d.ts +58 -0
  17. package/dist/Projects/PersonalLoras.js +62 -0
  18. package/dist/Projects/PersonalLoras.js.map +1 -0
  19. package/dist/Projects/index.d.ts +4 -0
  20. package/dist/Projects/index.js +15 -0
  21. package/dist/Projects/index.js.map +1 -1
  22. package/dist/Projects/types/LoraCatalog.d.ts +4 -0
  23. package/dist/Projects/utils/index.d.ts +1 -1
  24. package/dist/Projects/utils/index.js +1 -1
  25. package/dist/index.d.ts +3 -2
  26. package/dist/index.js.map +1 -1
  27. package/dist/version.d.ts +1 -1
  28. package/dist/version.js +1 -1
  29. package/dist-esm/Chat/_hostedToolsManifest.generated.js +295 -7
  30. package/dist-esm/Chat/_hostedToolsManifest.generated.js.map +1 -1
  31. package/dist-esm/Chat/index.js +12 -7
  32. package/dist-esm/Chat/index.js.map +1 -1
  33. package/dist-esm/Chat/modelRouting.js +2 -3
  34. package/dist-esm/Chat/modelRouting.js.map +1 -1
  35. package/dist-esm/Chat/tools.js +6 -0
  36. package/dist-esm/Chat/tools.js.map +1 -1
  37. package/dist-esm/Projects/PersonalLoras.js +59 -0
  38. package/dist-esm/Projects/PersonalLoras.js.map +1 -0
  39. package/dist-esm/Projects/index.js +15 -0
  40. package/dist-esm/Projects/index.js.map +1 -1
  41. package/dist-esm/Projects/utils/index.js +1 -1
  42. package/dist-esm/index.js.map +1 -1
  43. package/dist-esm/version.js +1 -1
  44. package/llms-full.txt +69 -3
  45. package/llms.txt +32 -0
  46. package/package.json +4 -2
  47. package/src/Chat/_hostedToolsManifest.generated.ts +295 -7
  48. package/src/Chat/index.ts +21 -10
  49. package/src/Chat/modelRouting.ts +2 -3
  50. package/src/Chat/tools.ts +9 -0
  51. package/src/Chat/types.ts +97 -8
  52. package/src/CreativeWorkflows/types.ts +4 -0
  53. package/src/Projects/PersonalLoras.ts +86 -0
  54. package/src/Projects/index.ts +19 -0
  55. package/src/Projects/types/LoraCatalog.ts +4 -0
  56. package/src/Projects/utils/index.ts +1 -1
  57. package/src/index.ts +11 -0
  58. package/src/version.ts +1 -1
package/AGENTS.md CHANGED
@@ -72,7 +72,7 @@ Public chat and workflow media rules:
72
72
 
73
73
  ## Overview
74
74
 
75
- 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, Z-Image / Z-Image Turbo, Krea 2 Turbo, Krea 2 Identity Edit, Chroma v.46 Flash / v.48 Detail / Chroma1-HD, Qwen image-edit models, GPT Image 2, plus community fine-tunes such as Dark Beast Z-Image Turbo v9, Dark Beast KREA 2, Dark Beast Krea 2 Identity Edit, and One Obsession v22), video generation (WAN 2.2, Wan 3, LTX-2.3, Seedance 2.0, HappyHorse 1.1, MiniMax H3, and MiniMax H3 Turbo), promptless video upscaling (FlashVSR v1.1), audio generation (ACE-Step 1.5), LLM chat with tool calling, hosted creative tools, durable creative workflows, replay records, and multimodal vision chat (Qwen3.6 35B VLM, default `qwen3.6-35b-a3b-gguf-iq4xs`). The model catalog is discovered dynamically at runtime (`sogni.projects.getAvailableModels()`); model ids listed here are illustrative.
75
+ 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, Z-Image / Z-Image Turbo, Krea 2 Turbo, Krea 2 Identity Edit, Chroma v.46 Flash / v.48 Detail / Chroma1-HD, Qwen image-edit models, GPT Image 2 and 2.5, plus community fine-tunes such as Dark Beast Z-Image Turbo v9, Dark Beast KREA 2, Dark Beast Krea 2 Identity Edit, and One Obsession v22), video generation (WAN 2.2, Wan 3, LTX-2.3, Seedance 2.0 and 2.5, HappyHorse 1.1, MiniMax H3, and MiniMax H3 Turbo), promptless video upscaling (FlashVSR v1.1), audio generation (ACE-Step 1.5), LLM chat with tool calling, hosted creative tools, durable creative workflows, replay records, and multimodal vision chat (Qwen3.6 35B VLM, default `qwen3.6-35b-a3b-gguf-iq4xs`). The model catalog is discovered dynamically at runtime (`sogni.projects.getAvailableModels()`); model ids listed here are illustrative.
76
76
 
77
77
  Choosing an image-edit model: pick by what the edit has to preserve, not by step count or quality tier. When a person or character must stay recognisable through the edit — style transfer, makeover, clothing or person swap, face swap, new pose or expression, character sheet — use Krea 2 Identity Edit (`krea2_identity_edit_v1_2`, or `dark_beast_krea2_identity_edit_v1_2` uncensored) with 1-2 context images. For general-purpose editing — photo transforms, in-image text, multi-person changes, combining up to 3 references — use a Qwen image-edit model. A higher-step general-purpose editor does not beat the identity model at a likeness task; it reinterprets the subject instead of preserving it. See `llms.txt` for parameters.
78
78
 
@@ -128,7 +128,7 @@ Generated artifacts:
128
128
  - `chat: ChatApi` - Unified chat namespace:
129
129
  - `chat.completions.create` - Socket-native synchronous chat
130
130
  - `chat.hosted.create` - Hosted synchronous chat via `/v1/chat/completions`
131
- - `chat.runs.{create, get, cancel, streamEvents}` - Durable hosted chat runs via `/v1/chat/runs` with SSE replay
131
+ - `chat.runs.{create, get, cancel, confirmCost, streamEvents}` - Durable hosted chat runs via `/v1/chat/runs` with SSE replay; `confirmCost` echoes `waiting.details.costApprovalPreview` as `acceptedCostPreview`
132
132
  - `chat.tools` - Tool helpers (build, parse, validate)
133
133
  - `workflows: CreativeWorkflowsApi` - Durable explicit creative workflows via `/v1/creative-agent/workflows`
134
134
  - `workflows.{start, list, get, events, streamEvents, resume, reseed, cancel}`
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [5.51.1](https://github.com/Sogni-AI/sogni-client/compare/v5.51.0...v5.51.1) (2026-09-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **chat:** send the accepted cost preview when confirming a chat run ([548fa9e](https://github.com/Sogni-AI/sogni-client/commit/548fa9e64b91e8d4c01bb7fe405bf0ea6d6a6e51))
7
+
8
+ # [5.51.0](https://github.com/Sogni-AI/sogni-client/compare/v5.50.1...v5.51.0) (2026-09-16)
9
+
10
+
11
+ ### Features
12
+
13
+ * **projects:** expose personal LoRAs and hosted media tools ([201d0e0](https://github.com/Sogni-AI/sogni-client/commit/201d0e051b10a50d523094cfe169a204b9105452))
14
+
1
15
  ## [5.50.1](https://github.com/Sogni-AI/sogni-client/compare/v5.50.0...v5.50.1) (2026-09-15)
2
16
 
3
17
 
package/README.md CHANGED
@@ -896,6 +896,36 @@ export interface ControlNetParams {
896
896
  }
897
897
  ```
898
898
 
899
+
900
+ ### Personal LoRA library
901
+
902
+ Use the same account/API key as Sogni Web. Importing and generating require an active Unlimited subscription; listing and removing owned entries remain available after expiry. The server checks ownership, readiness, content-filter requirements, compatible models, and quotas on every request.
903
+
904
+ ```typescript
905
+ const library = await sogni.projects.personalLoras.list();
906
+ // Choose modelId from library.models; obtain the user's permission to use the file.
907
+ const imported = await sogni.projects.personalLoras.import({
908
+ url: 'https://huggingface.co/author/repository/resolve/main/style.safetensors',
909
+ name: 'My style',
910
+ modelId: 'krea2_turbo_fp8_scaled',
911
+ rightsConfirmed: true,
912
+ });
913
+ const current = await sogni.projects.personalLoras.get(imported.id);
914
+ // Importing is asynchronous. Poll get() until ready, rejected, or revoked;
915
+ // queued, validating, and review are not usable yet. Surface reason/failureCode.
916
+ const { loras } = await sogni.projects.availableLoras({
917
+ modelId: 'krea2_turbo_fp8_scaled', includePersonal: true,
918
+ });
919
+ // Pass a ready row.loraId in project.loras and row.ui.default in loraStrengths.
920
+ // Respect its modelIds, requirements, and ui.nsfw content-filter requirement.
921
+ // Removal is explicit:
922
+ // await sogni.projects.personalLoras.remove(imported.id);
923
+ ```
924
+
925
+ `personalLoras.catalog({modelId})` returns ready private catalog rows. `getLora('personal-…')` also reads the authenticated catalog. Personal catalog responses are never placed in the shared public cache. `forceRefresh` controls the public catalog; personal entries are always fetched again. Standard and non-audio FastH3 Two-Stage modes expose their compatible adapters through `modelIds`; audio-guided H3 modes do not support LoRAs.
926
+
927
+ Hosted tools include `SogniTools.imageTo3d`, `SogniTools.removeBackground`, and `SogniTools.segmentImage`. Use `image_to_3d` with a front image and optional named `leftViewImageIndex`, `backViewImageIndex`, and `rightViewImageIndex`; its result has `mediaType: 'model'` and is a binary GLB. `generate_speech` supports `creativity` (0.1–2), `outputFormat` (`wav`, `mp3`, `flac`), and `seed`, alongside studio voices, reference-audio cloning, and voice design.
928
+
899
929
  ## Video Generation (WAN 2.2, Wan 3, LTX-2.3, Seedance & Happy Horse)
900
930
 
901
931
  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.
@@ -940,7 +970,7 @@ Example model IDs:
940
970
  - `ltx23-22b-fp8_v2v_distilled` (LTX-2.3 Video-to-Video ControlNet, fast)
941
971
  - `seedance-2-0` (Seedance 2.0 multimodal video, external API, 4K capable)
942
972
  - `seedance-2-0-mini` (Seedance 2.0 Mini multimodal video, external API, 720p cap)
943
- - `seedance-2-5` (Seedance 2.5 multimodal video, external API, 480p/720p only, 4-30s, first+last frame)
973
+ - `seedance-2-5` (Seedance 2.5 multimodal video, external API, 480p/720p/1080p, 4-30s, first+last frame)
944
974
  - `happyhorse-1.1-t2v` (Happy Horse 1.1 Text-to-Video, external API, image-only references)
945
975
  - `happyhorse-1.1-i2v` (Happy Horse 1.1 Image-to-Video, external API, one first-frame image)
946
976
  - `happyhorse-1.1-r2v` (Happy Horse 1.1 Reference-to-Video, external API, 1-9 reference images)
@@ -1318,6 +1348,37 @@ node examples/workflow_seedance_2_5_r2v.mjs "Edit @Video1" --task-type edit --vi
1318
1348
  node examples/workflow_seedance_2_5_r2v.mjs "Extend @Video1" --task-type extend --video https://cdn.example.com/source.mp4 --duration 8 --creative-agent --dry-run
1319
1349
  ```
1320
1350
 
1351
+ ### Durable Chat Runs and Cost Approval
1352
+
1353
+ `sogni.chat.runs` (`create`, `get`, `cancel`, `confirmCost`, `streamEvents`) wraps `/v1/chat/runs`, where the server drives the LLM and tool loop and the client can disconnect and reattach through SSE replay.
1354
+
1355
+ A run can pause before paid tool calls with `status: 'waiting_for_user'` and `waiting.reason: 'cost_approval_required'`. The pause carries the paused `toolCallId` and a `costApprovalPreview` (`totalEstimatedCapacityUnits`, `tokenType`, `validityUntil`, and an optional `perToolBreakdown`) in `run.waiting.details`, and in `event.payload.details` on the `run_waiting_for_user` event. Show that preview to the user, then pass it back unchanged as `acceptedCostPreview`:
1356
+
1357
+ ```javascript
1358
+ const run = await sogni.chat.runs.get(runId);
1359
+ const details = run.waiting?.details;
1360
+
1361
+ if (run.waiting?.reason === 'cost_approval_required' && details?.toolCallId) {
1362
+ const preview = details.costApprovalPreview;
1363
+ // askUserToApprove is your UI: show the preview and wait for the answer.
1364
+ const approved = preview ? await askUserToApprove(preview) : false;
1365
+
1366
+ if (approved) {
1367
+ await sogni.chat.runs.confirmCost(runId, {
1368
+ toolCallId: details.toolCallId,
1369
+ decision: 'confirm',
1370
+ acceptedCostPreview: preview,
1371
+ idempotencyKey: `confirm-${details.toolCallId}`
1372
+ });
1373
+ } else {
1374
+ // Declining needs no preview.
1375
+ await sogni.chat.runs.confirmCost(runId, { toolCallId: details.toolCallId, decision: 'cancel' });
1376
+ }
1377
+ }
1378
+ ```
1379
+
1380
+ The server rejects a confirm without `acceptedCostPreview` (HTTP 400), and one whose preview has expired or no longer matches (HTTP 409); read the run again and ask the user to approve the new preview. The SDK never fills in the preview for you. `idempotencyKey` is sent as the `Idempotency-Key` header, so reuse it for duplicate submissions of the same decision. A pause without `costApprovalPreview`, such as one caused by running out of credits, cannot be confirmed; cancel it instead.
1381
+
1321
1382
  ### Durable Creative Workflows (server-side)
1322
1383
 
1323
1384
  Long-running multi-step creative workflows can be persisted on the server and observed independently of the chat completion that started them. The SDK exposes these authenticated endpoints through `sogni.workflows`:
@@ -1532,7 +1593,7 @@ The workflow examples showcase a few powerful open-source frontier models suppor
1532
1593
  | `wan_v2.2-14b-fp8_t2v_lightx2v` | **Wan 2.2 T2V** - Text-to-video | Generate videos from text prompts |
1533
1594
  | `seedance-2-0` | **Seedance 2.0** - 4K external API multimodal video | Full Seedance 2.0 24fps video generation with optional image, video, and audio context |
1534
1595
  | `seedance-2-0-mini` | **Seedance 2.0 Mini** - 720p external API video | Fastest, lower-cost 24fps Seedance video generation |
1535
- | `seedance-2-5` | **Seedance 2.5** - 480p/720p external API video | Newest Seedance: 4-30s single-call clips, first+last frame conditioning, 30 image / 10 video / 10 audio refs |
1596
+ | `seedance-2-5` | **Seedance 2.5** - up to 1080p external API video | Newest Seedance: 4-30s single-call clips, first+last frame conditioning, 30 image / 10 video / 10 audio refs |
1536
1597
  | `dark_beast_z_image_turbo_v9_bf16` | **Dark Beast Z-Image Turbo v9** - Community (uncensored) | Uncensored, fast Z-Image fine-tune (2K output needs a 24GB+ VRAM worker) |
1537
1598
  | `dark_beast_krea2_fp8` | **Dark Beast KREA 2** - Community (uncensored) | Uncensored Krea 2 fine-tune (2K output needs a 24GB+ VRAM worker) |
1538
1599
  | `dark_beast_krea2_identity_edit_v1_2` | **Dark Beast Krea 2 Identity Edit** - Community | Uncensored identity-preserving Krea 2 edit LoRA with 1-2 reference images |