@sogni-ai/sogni-client 3.0.0 → 3.0.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.
- package/CHANGELOG.md +8 -0
- package/README.md +20 -17
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [3.0.1](https://github.com/Sogni-AI/sogni-client/compare/v3.0.0...v3.0.1) (2025-07-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* Bring back package-lock.json ([28d21e1](https://github.com/Sogni-AI/sogni-client/commit/28d21e192c15fca5b76254572d6fcbd1e8140b29))
|
|
7
|
+
* Update README.md ([3348834](https://github.com/Sogni-AI/sogni-client/commit/3348834163d438ce99c3dfa9d466649544e9b777))
|
|
8
|
+
|
|
1
9
|
# [3.0.0](https://github.com/Sogni-AI/sogni-client/compare/v2.0.4...v3.0.0) (2025-07-15)
|
|
2
10
|
|
|
3
11
|
|
package/README.md
CHANGED
|
@@ -14,27 +14,29 @@ or
|
|
|
14
14
|
yarn add @sogni-ai/sogni-client
|
|
15
15
|
```
|
|
16
16
|
## Core concepts
|
|
17
|
-
In order to use Sogni Supernet you need an active Sogni account (in the form of a username and password) with a positive
|
|
17
|
+
In order to use Sogni Supernet, you need an active Sogni account (in the form of a username and password) with a positive SOGNI or Spark token balance.
|
|
18
18
|
You can create a free account in our [Web App](https://app.sogni.ai) or [Mac App](https://www.sogni.ai/studio) which will give you tokens just for signing up and confirming your email. You can get daily bonus tokens by claiming them (under rewards) each 24-hours.
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Spark tokens can be purchased with a credit card in a Mac or Web app.
|
|
21
|
+
|
|
22
|
+
Your account is tied to a [Base](https://www.base.org/) Wallet that is created during signup.
|
|
21
23
|
|
|
22
24
|
### Supernet Types
|
|
23
25
|
There are 2 worker network types available:
|
|
24
|
-
- `fast` - this network runs on high-end GPUs and is optimized for speed. It is more expensive than `relaxed` network
|
|
25
|
-
- `relaxed` - this network runs on Apple Mac devices and is optimized for cost. It is cheaper than `fast` network
|
|
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.
|
|
26
28
|
|
|
27
|
-
In both options the more complex your query is (the more steps) the higher the cost in tokens.
|
|
29
|
+
In both options, the more complex your query is (the more steps), the higher the cost in tokens.
|
|
28
30
|
|
|
29
31
|
### Inference definitions: Projects and Jobs
|
|
30
32
|
One request for image generation is called a **Project**. Project can generate one or more images.
|
|
31
33
|
Each image is represented by a **Job**.
|
|
32
34
|
|
|
33
35
|
When you send a project to Supernet, it will be processed by one or more workers. The resulting images will be encrypted and
|
|
34
|
-
uploaded to Sogni servers where it will be
|
|
36
|
+
uploaded to Sogni servers where it will be stored for 24 hours. After this period images will be auto-deleted.
|
|
35
37
|
|
|
36
38
|
## Client initialization
|
|
37
|
-
To initialize client you need to provide `appId`, and account credentials.
|
|
39
|
+
To initialize a client, you need to provide `appId`, and account credentials.
|
|
38
40
|
|
|
39
41
|
```javascript
|
|
40
42
|
import { SogniClient } from '@sogni-ai/sogni-client';
|
|
@@ -62,7 +64,7 @@ const models = await client.projects.waitForModels();
|
|
|
62
64
|
|
|
63
65
|
## Usage
|
|
64
66
|
After calling `login` method, the client will establish a WebSocket connection to Sogni Supernet. Within a short period of time the
|
|
65
|
-
client will receive current balance and list of available models. After this you can start using the client to generate images.
|
|
67
|
+
client will receive the current balance and list of available models. After this you can start using the client to generate images.
|
|
66
68
|
|
|
67
69
|
### Creating project
|
|
68
70
|
```javascript
|
|
@@ -85,9 +87,9 @@ const project = await client.projects.create({
|
|
|
85
87
|
**Note:** Full project parameter list can be found in [ProjectParams](https://sdk-docs.sogni.ai/interfaces/ProjectParams.html) docs.
|
|
86
88
|
|
|
87
89
|
### Getting project status and results
|
|
88
|
-
In general there are 2 ways to work with API:
|
|
90
|
+
In general, there are 2 ways to work with API:
|
|
89
91
|
1. Using promises or `async/await` syntax.
|
|
90
|
-
2. Listening events on `Project` and `Job` class instances.
|
|
92
|
+
2. Listening to events on `Project` and `Job` class instances.
|
|
91
93
|
|
|
92
94
|
#### Using promises
|
|
93
95
|
```javascript
|
|
@@ -153,12 +155,13 @@ project.on('failed', async (errorData) => {
|
|
|
153
155
|
```
|
|
154
156
|
|
|
155
157
|
### Project parameters
|
|
156
|
-
Here is full list of project parameters that you can use:
|
|
158
|
+
Here is a full list of project parameters that you can use:
|
|
157
159
|
- `modelId` - ID of the model to use for image generation.
|
|
158
|
-
- `positivePrompt` - text prompt that describes what you want to see in the image. Can be empty string.
|
|
159
|
-
- `negativePrompt` - text prompt that describes what you don't want to see in the image. Can be empty string.
|
|
160
|
-
- `stylePrompt` - text prompt that describes the style of the image. Can be empty string.
|
|
160
|
+
- `positivePrompt` - text prompt that describes what you want to see in the image. Can be an empty string.
|
|
161
|
+
- `negativePrompt` - text prompt that describes what you don't want to see in the image. Can be an empty string.
|
|
162
|
+
- `stylePrompt` - text prompt that describes the style of the image. Can be an empty string.
|
|
161
163
|
- `numberOfImages` - number of images to generate.
|
|
164
|
+
- `tokenType` - select token type to pay for render. Can be either `sogni` or `spark`.
|
|
162
165
|
- `sizePreset` - optionally pass the ID of a size preset to use. If not passed, the default output is a square at
|
|
163
166
|
either 512x512, 768x768 or 1024x1024 (SDXL and Flux) based on the default resolution of the selected model.
|
|
164
167
|
See **Detecting available output presets** section below for available presets for your model. The token cost and
|
|
@@ -174,7 +177,7 @@ quality images and more details but varies by model, prompt, guidance, and desir
|
|
|
174
177
|
models 20-40 steps is ideal with 20 being 2x faster to render than 40. For Flux 4 steps is optimal. Lightning,
|
|
175
178
|
Turbo and LCM models are designed for quality output in as little as 1 step. ([More info](https://docs.sogni.ai/learn/basics/inference-steps)).
|
|
176
179
|
- `guidance` - guidance scale. For most Stable Diffusion models, optimal value is 7.5 ([More info](https://docs.sogni.ai/learn/basics/guidance-scale)).
|
|
177
|
-
- `network` - network type to use,
|
|
180
|
+
- `network` - network type to use, `fast` or `relaxed`. This parameter allows to override default network type for this project.
|
|
178
181
|
- `disableNSFWFilter` - disable NSFW filter for this project. NSFW filter is enabled by default and workers won't upload resulting images if they are detected as NSFW.
|
|
179
182
|
- `seed` - uint32 number to use as seed. If not provided, random seed will be used. If `numberOfImages` is greater than 1, provided seed will be user only for one of them. ([More info](https://docs.sogni.ai/learn/basics/generation-seed)).
|
|
180
183
|
- `numberOfPreviews` - number of preview images to generate. If not provided, no preview images will be generated.
|
|
@@ -187,7 +190,7 @@ Turbo and LCM models are designed for quality output in as little as 1 step. ([M
|
|
|
187
190
|
TypeScript type definitions for project parameters can be found in [ProjectParams](https://sdk-docs.sogni.ai/interfaces/ProjectParams.html) docs.
|
|
188
191
|
|
|
189
192
|
### Detecting available output presets
|
|
190
|
-
You can get list of available output presets for a specific network and model using `client.projects.getOutputPresets` method.
|
|
193
|
+
You can get a list of available output presets for a specific network and model using `client.projects.getOutputPresets` method.
|
|
191
194
|
```javascript
|
|
192
195
|
const presets = await client.projects.getSizePresets('fast', 'flux1-schnell-fp8');
|
|
193
196
|
console.log('Available output presets:', presets);
|
|
@@ -283,7 +286,7 @@ Sample response:
|
|
|
283
286
|
ControlNet is a neural network that controls image generation in Stable Diffusion by adding extra conditions. See more
|
|
284
287
|
info and usage samples in [ControlNets](https://docs.sogni.ai/learn/basics/controlnet) docs for Sogni Studio.
|
|
285
288
|
|
|
286
|
-
To use ControlNet in your project you need to provide `controlNet` object with the following properties:
|
|
289
|
+
To use ControlNet in your project, you need to provide `controlNet` object with the following properties:
|
|
287
290
|
- `name` - name of the ControlNet to use. Currently supported:
|
|
288
291
|
- `canny`
|
|
289
292
|
- `depth`
|