@sogni-ai/sogni-client 3.0.0 → 3.1.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 CHANGED
@@ -1,3 +1,18 @@
1
+ # [3.1.0](https://github.com/Sogni-AI/sogni-client/compare/v3.0.1...v3.1.0) (2025-08-07)
2
+
3
+
4
+ ### Features
5
+
6
+ * Expose `premiumCredit` Spark amount in account balance ([57e568c](https://github.com/Sogni-AI/sogni-client/commit/57e568cdff0bb29ce61489dab6280f735f497bb8))
7
+
8
+ ## [3.0.1](https://github.com/Sogni-AI/sogni-client/compare/v3.0.0...v3.0.1) (2025-07-15)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Bring back package-lock.json ([28d21e1](https://github.com/Sogni-AI/sogni-client/commit/28d21e192c15fca5b76254572d6fcbd1e8140b29))
14
+ * Update README.md ([3348834](https://github.com/Sogni-AI/sogni-client/commit/3348834163d438ce99c3dfa9d466649544e9b777))
15
+
1
16
  # [3.0.0](https://github.com/Sogni-AI/sogni-client/compare/v2.0.4...v3.0.0) (2025-07-15)
2
17
 
3
18
 
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 $tSOGNI balance.
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
- Your account is tied to a [Base](https://www.base.org/) Wallet that is created during signup. The current network is [Base Sepolia](https://chainlist.org/chain/84532) and will be [Base Mainnet](https://chainlist.org/chain/8453) after mainnet launch.
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 at roughly 1 $tSOGNI token per render.
25
- - `relaxed` - this network runs on Apple Mac devices and is optimized for cost. It is cheaper than `fast` network at roughly 0.5 $tSOGNI token per render.
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 stored for 24 hours. After this period images will be auto-deleted.
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, 'fast' or 'relaxed'. This parameter allow to override default network type for this project.
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`
@@ -19,7 +19,8 @@ function getDefaults() {
19
19
  credit: '0',
20
20
  debit: '0',
21
21
  net: '0',
22
- settled: '0'
22
+ settled: '0',
23
+ premiumCredit: '0'
23
24
  }
24
25
  },
25
26
  walletAddress: undefined,
@@ -1 +1 @@
1
- {"version":3,"file":"CurrentAccount.js","sourceRoot":"","sources":["../../src/Account/CurrentAccount.ts"],"names":[],"mappings":";;;;;AAAA,mEAA2C;AAyB3C,SAAS,WAAW;IAClB,OAAO;QACL,aAAa,EAAE,cAAc;QAC7B,OAAO,EAAE,IAAI;QACb,OAAO,EAAE;YACP,KAAK,EAAE;gBACL,MAAM,EAAE,GAAG;gBACX,KAAK,EAAE,GAAG;gBACV,GAAG,EAAE,GAAG;gBACR,OAAO,EAAE,GAAG;aACb;YACD,KAAK,EAAE;gBACL,MAAM,EAAE,GAAG;gBACX,KAAK,EAAE,GAAG;gBACV,GAAG,EAAE,GAAG;gBACR,OAAO,EAAE,GAAG;aACb;SACF;QACD,aAAa,EAAE,SAAS;QACxB,QAAQ,EAAE,SAAS;QACnB,KAAK,EAAE,SAAS;QAChB,YAAY,EAAE,SAAS;KACxB,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,cAAe,SAAQ,oBAAuB;IAClD,YAAY,IAAkB;QAC5B,KAAK,CAAC,IAAI,IAAI,WAAW,EAAE,CAAC,CAAC;IAC/B,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAC9B,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;IAClC,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC;IACjC,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;IAC3B,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;IAC3B,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC;IACjC,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;IAC5B,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;IACzB,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;IAChC,CAAC;CACF;AAED,kBAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"CurrentAccount.js","sourceRoot":"","sources":["../../src/Account/CurrentAccount.ts"],"names":[],"mappings":";;;;;AAAA,mEAA2C;AAyB3C,SAA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C;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;IAChC,CAAC;CACF;AAED,kBAAe,cAAc,CAAC"}
@@ -30,8 +30,17 @@ export interface BalanceData {
30
30
  */
31
31
  unclaimed?: string;
32
32
  }
33
- export type Balances = Record<TokenType, BalanceData>;
34
- export type FullBalances = Record<TokenType, Required<BalanceData>>;
33
+ export interface SparkBalanceData extends BalanceData {
34
+ premiumCredit: string;
35
+ }
36
+ export interface Balances {
37
+ sogni: BalanceData;
38
+ spark: SparkBalanceData;
39
+ }
40
+ export interface FullBalances {
41
+ sogni: Required<BalanceData>;
42
+ spark: Required<SparkBalanceData>;
43
+ }
35
44
  export interface TxHistoryParams {
36
45
  status: 'completed';
37
46
  address: string;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.0.0",
6
+ "version": "3.1.0",
7
7
  "description": "Sogni Supernet Client",
8
8
  "main": "dist/index.js",
9
9
  "types": "dist/index.d.ts",
@@ -38,7 +38,8 @@ function getDefaults(): AccountData {
38
38
  credit: '0',
39
39
  debit: '0',
40
40
  net: '0',
41
- settled: '0'
41
+ settled: '0',
42
+ premiumCredit: '0'
42
43
  }
43
44
  },
44
45
  walletAddress: undefined,
@@ -36,9 +36,19 @@ export interface BalanceData {
36
36
  unclaimed?: string;
37
37
  }
38
38
 
39
- export type Balances = Record<TokenType, BalanceData>;
39
+ export interface SparkBalanceData extends BalanceData {
40
+ premiumCredit: string;
41
+ }
42
+
43
+ export interface Balances {
44
+ sogni: BalanceData;
45
+ spark: SparkBalanceData;
46
+ }
40
47
 
41
- export type FullBalances = Record<TokenType, Required<BalanceData>>;
48
+ export interface FullBalances {
49
+ sogni: Required<BalanceData>;
50
+ spark: Required<SparkBalanceData>;
51
+ }
42
52
 
43
53
  export interface TxHistoryParams {
44
54
  status: 'completed';