cloreai 4.0.1 → 4.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/README.md +13 -59
- package/dist/Cloreai.d.ts +3 -2
- package/dist/Cloreai.js +18 -7
- package/dist/CloreaiError.js +1 -1
- package/dist/constants.d.ts +0 -4
- package/dist/constants.js +0 -4
- package/dist/index.d.ts +0 -3
- package/dist/resources/cancelOrders.d.ts +1 -1
- package/dist/resources/createOrder.d.ts +6 -2
- package/dist/resources/marketplace.d.ts +6 -1
- package/dist/resources/myOrders.d.ts +8 -3
- package/dist/resources/myServers.d.ts +10 -2
- package/dist/resources/renterFees.d.ts +8 -0
- package/dist/resources/serverConfig.d.ts +24 -0
- package/dist/resources/setSpotPrice.d.ts +4 -9
- package/dist/types.d.ts +20 -26
- package/package.json +11 -8
- package/dist/Gigaspot.d.ts +0 -15
- package/dist/Gigaspot.js +0 -71
- package/dist/resources/createGigaspotOrders.d.ts +0 -15
- package/dist/resources/createGigaspotOrders.js +0 -1
- package/dist/resources/editGigaspotOrders.d.ts +0 -12
- package/dist/resources/editGigaspotOrders.js +0 -1
- package/dist/resources/getGigaspot.d.ts +0 -46
- package/dist/resources/getGigaspot.js +0 -1
package/README.md
CHANGED
|
@@ -9,12 +9,10 @@ Features:
|
|
|
9
9
|
[p-queue](https://github.com/sindresorhus/p-queue)
|
|
10
10
|
- Convenient error handling
|
|
11
11
|
- Full type safety
|
|
12
|
-
- Supports GigaSPOT
|
|
13
12
|
|
|
14
13
|
Official documentation: [clore.ai/api-docs](https://clore.ai/api-docs)
|
|
15
14
|
|
|
16
|
-
Official
|
|
17
|
-
[gigaspot-api-docs.clore.ai](https://gigaspot-api-docs.clore.ai)
|
|
15
|
+
Official changelog: [clore.ai/changelog](https://clore.ai/changelog)
|
|
18
16
|
|
|
19
17
|
## Installation
|
|
20
18
|
|
|
@@ -126,7 +124,15 @@ await cloreai.cancelOrder({
|
|
|
126
124
|
})
|
|
127
125
|
```
|
|
128
126
|
|
|
129
|
-
### 10.
|
|
127
|
+
### 10. cancelOrders
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
await cloreai.cancelOrders({
|
|
131
|
+
order_ids: [8383],
|
|
132
|
+
})
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 11. create_order
|
|
130
136
|
|
|
131
137
|
```typescript
|
|
132
138
|
await cloreai.createOrder({
|
|
@@ -139,74 +145,22 @@ await cloreai.createOrder({
|
|
|
139
145
|
jupyter_token: 'JUPYTER_TOKEN',
|
|
140
146
|
ssh_password: 'SSH_PASSWORD',
|
|
141
147
|
required_price: 50,
|
|
142
|
-
|
|
148
|
+
remember_passwords: true,
|
|
143
149
|
})
|
|
144
150
|
```
|
|
145
151
|
|
|
146
|
-
###
|
|
152
|
+
### 12. poh_balance
|
|
147
153
|
|
|
148
154
|
```typescript
|
|
149
155
|
const pohBalance = await cloreai.pohBalance()
|
|
150
156
|
```
|
|
151
157
|
|
|
152
|
-
###
|
|
158
|
+
### 13. renter_fees
|
|
153
159
|
|
|
154
160
|
```typescript
|
|
155
161
|
const renterFees = await cloreai.renterFees()
|
|
156
162
|
```
|
|
157
163
|
|
|
158
|
-
### GigaSPOT
|
|
159
|
-
|
|
160
|
-
#### getGigaspot
|
|
161
|
-
|
|
162
|
-
```typescript
|
|
163
|
-
const gigaspot = await cloreai.gigaspot.getGigaspot()
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
#### createGigaspotOrders
|
|
167
|
-
|
|
168
|
-
```typescript
|
|
169
|
-
import { gigaspotBaseImages } from 'cloreai'
|
|
170
|
-
|
|
171
|
-
await cloreai.gigaspot.createGigaspotOrders([
|
|
172
|
-
{
|
|
173
|
-
currency: 'CLORE-Blockchain',
|
|
174
|
-
image: gigaspotBaseImages.UBUNTU, // Use the base image constant
|
|
175
|
-
renting_server: 5941,
|
|
176
|
-
price: 50,
|
|
177
|
-
oc: [
|
|
178
|
-
{
|
|
179
|
-
pl: 150,
|
|
180
|
-
},
|
|
181
|
-
],
|
|
182
|
-
},
|
|
183
|
-
])
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
#### editGigaspotOrders
|
|
187
|
-
|
|
188
|
-
```typescript
|
|
189
|
-
await cloreai.gigaspot.editGigaspotOrders([
|
|
190
|
-
{
|
|
191
|
-
order_id: 58991,
|
|
192
|
-
price: 50,
|
|
193
|
-
oc: [
|
|
194
|
-
{
|
|
195
|
-
pl: 150,
|
|
196
|
-
},
|
|
197
|
-
],
|
|
198
|
-
},
|
|
199
|
-
])
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
#### cancelOrders
|
|
203
|
-
|
|
204
|
-
```typescript
|
|
205
|
-
await cloreai.gigaspot.cancelOrders({
|
|
206
|
-
order_ids: [8383],
|
|
207
|
-
})
|
|
208
|
-
```
|
|
209
|
-
|
|
210
164
|
## Fetch Options
|
|
211
165
|
|
|
212
166
|
All methods accept fetch options as the last parameter, for example:
|
package/dist/Cloreai.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import PQueue, { type Options as PQueueOptions, type Queue, type QueueAddOptions } from 'p-queue';
|
|
2
2
|
import type { CancelOrderRequestData, CancelOrderResponseData } from './resources/cancelOrder.ts';
|
|
3
|
+
import type { CancelOrdersRequestData, CancelOrdersResponseData } from './resources/cancelOrders.ts';
|
|
3
4
|
import type { CreateOrderRequestData, CreateOrderResponseData } from './resources/createOrder.ts';
|
|
4
5
|
import type { MarketplaceResponseData } from './resources/marketplace.ts';
|
|
5
6
|
import type { MyOrdersRequestParams, MyOrdersResponseData } from './resources/myOrders.ts';
|
|
@@ -11,7 +12,6 @@ import type { SetServerSettingsRequestData, SetServerSettingsResponseData } from
|
|
|
11
12
|
import type { SetSpotPriceRequestData, SetSpotPriceResponseData } from './resources/setSpotPrice.ts';
|
|
12
13
|
import type { SpotMarketplaceRequestParams, SpotMarketplaceResponseData } from './resources/spotMarketplace.ts';
|
|
13
14
|
import type { WalletsResponseData } from './resources/wallets.ts';
|
|
14
|
-
import Gigaspot from './Gigaspot.ts';
|
|
15
15
|
export interface Options {
|
|
16
16
|
baseURL?: string;
|
|
17
17
|
fetchOptions?: RequestInit;
|
|
@@ -22,12 +22,12 @@ export interface Options {
|
|
|
22
22
|
export type QueueOptions = PQueueOptions<Queue<() => Promise<unknown>, QueueAddOptions>, QueueAddOptions>;
|
|
23
23
|
declare class Cloreai {
|
|
24
24
|
#private;
|
|
25
|
+
apiKey: string;
|
|
25
26
|
baseURL: string;
|
|
26
27
|
fetchOptions: RequestInit;
|
|
27
28
|
fetch: typeof fetch;
|
|
28
29
|
queue: PQueue;
|
|
29
30
|
queueCreateOrder: PQueue;
|
|
30
|
-
gigaspot: Gigaspot;
|
|
31
31
|
constructor(apiKey: string, options?: Options);
|
|
32
32
|
wallets(init?: RequestInit): Promise<WalletsResponseData>;
|
|
33
33
|
myServers(init?: RequestInit): Promise<MyServersResponseData>;
|
|
@@ -38,6 +38,7 @@ declare class Cloreai {
|
|
|
38
38
|
setServerSettings(data: SetServerSettingsRequestData, init?: RequestInit): Promise<SetServerSettingsResponseData>;
|
|
39
39
|
setSpotPrice(data: SetSpotPriceRequestData, init?: RequestInit): Promise<SetSpotPriceResponseData>;
|
|
40
40
|
cancelOrder(data: CancelOrderRequestData, init?: RequestInit): Promise<CancelOrderResponseData>;
|
|
41
|
+
cancelOrders(data: CancelOrdersRequestData, init?: RequestInit): Promise<CancelOrdersResponseData>;
|
|
41
42
|
createOrder(data: CreateOrderRequestData, init?: RequestInit): Promise<CreateOrderResponseData>;
|
|
42
43
|
pohBalance(init?: RequestInit): Promise<PohBalanceResponseData>;
|
|
43
44
|
renterFees(init?: RequestInit): Promise<RenterFeesResponseData>;
|
package/dist/Cloreai.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import PQueue, {} from 'p-queue';
|
|
2
2
|
import { CloreaiError } from "./CloreaiError.js";
|
|
3
3
|
import { priorityLevels, RATE_LIMIT, RATE_LIMIT_CREATE_ORDER, statusCodes } from "./constants.js";
|
|
4
|
-
import Gigaspot from "./Gigaspot.js";
|
|
5
4
|
class Cloreai {
|
|
5
|
+
apiKey;
|
|
6
6
|
baseURL;
|
|
7
7
|
fetchOptions;
|
|
8
8
|
fetch;
|
|
9
9
|
queue;
|
|
10
10
|
queueCreateOrder;
|
|
11
|
-
gigaspot;
|
|
12
|
-
#apiKey;
|
|
13
11
|
constructor(apiKey, options = {}) {
|
|
12
|
+
this.apiKey = apiKey;
|
|
14
13
|
this.baseURL = options.baseURL ?? 'https://api.clore.ai/v1';
|
|
15
14
|
this.fetchOptions = options.fetchOptions ?? {};
|
|
16
15
|
this.fetch = options.fetch ?? fetch;
|
|
@@ -26,13 +25,11 @@ class Cloreai {
|
|
|
26
25
|
concurrency: 1,
|
|
27
26
|
...options.queueCreateOrderOptions,
|
|
28
27
|
});
|
|
29
|
-
this.gigaspot = new Gigaspot(this, this.#fetch.bind(this));
|
|
30
|
-
this.#apiKey = apiKey;
|
|
31
28
|
}
|
|
32
29
|
async #fetch(input, init = {}) {
|
|
33
30
|
const headers = new Headers({
|
|
34
31
|
'Content-Type': 'application/json',
|
|
35
|
-
'auth': this
|
|
32
|
+
'auth': this.apiKey,
|
|
36
33
|
});
|
|
37
34
|
for (const [key, value] of new Headers(this.fetchOptions.headers)) {
|
|
38
35
|
headers.set(key, value);
|
|
@@ -223,9 +220,23 @@ class Cloreai {
|
|
|
223
220
|
});
|
|
224
221
|
return await response.json();
|
|
225
222
|
}
|
|
223
|
+
async cancelOrders(data, init = {}) {
|
|
224
|
+
const url = new URL(this.baseURL + '/cancel_orders');
|
|
225
|
+
const response = await this.queue.add(async () => {
|
|
226
|
+
return await this.#fetch(url, {
|
|
227
|
+
...init,
|
|
228
|
+
method: 'POST',
|
|
229
|
+
body: JSON.stringify(data),
|
|
230
|
+
});
|
|
231
|
+
}, {
|
|
232
|
+
priority: priorityLevels.HIGH,
|
|
233
|
+
signal: init.signal ?? undefined,
|
|
234
|
+
});
|
|
235
|
+
return await response.json();
|
|
236
|
+
}
|
|
226
237
|
async createOrder(data, init = {}) {
|
|
227
238
|
const url = new URL(this.baseURL + '/create_order');
|
|
228
|
-
const response = await this.
|
|
239
|
+
const response = await this.queueCreateOrder.add(async () => {
|
|
229
240
|
return await this.#fetch(url, {
|
|
230
241
|
...init,
|
|
231
242
|
method: 'POST',
|
package/dist/CloreaiError.js
CHANGED
package/dist/constants.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
export declare const RATE_LIMIT = 1000;
|
|
2
2
|
export declare const RATE_LIMIT_CREATE_ORDER = 5000;
|
|
3
|
-
export declare const gigaspotBaseImages: Readonly<{
|
|
4
|
-
UBUNTU: "a3f9c4d7e5b088d8a0bff880";
|
|
5
|
-
HIVEOS: "c9a4e2f6b7d488d8f0bab0ff";
|
|
6
|
-
}>;
|
|
7
3
|
export declare const statusCodes: Readonly<{
|
|
8
4
|
NORMAL: 0;
|
|
9
5
|
DATABASE_ERROR: 1;
|
package/dist/constants.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
export const RATE_LIMIT = 1000;
|
|
2
2
|
export const RATE_LIMIT_CREATE_ORDER = 5000;
|
|
3
|
-
export const gigaspotBaseImages = Object.freeze({
|
|
4
|
-
UBUNTU: 'a3f9c4d7e5b088d8a0bff880',
|
|
5
|
-
HIVEOS: 'c9a4e2f6b7d488d8f0bab0ff',
|
|
6
|
-
});
|
|
7
3
|
export const statusCodes = Object.freeze({
|
|
8
4
|
NORMAL: 0,
|
|
9
5
|
DATABASE_ERROR: 1,
|
package/dist/index.d.ts
CHANGED
|
@@ -4,10 +4,7 @@ export * from './CloreaiError.ts';
|
|
|
4
4
|
export * from './constants.ts';
|
|
5
5
|
export type * from './resources/cancelOrder.ts';
|
|
6
6
|
export type * from './resources/cancelOrders.ts';
|
|
7
|
-
export type * from './resources/createGigaspotOrders.ts';
|
|
8
7
|
export type * from './resources/createOrder.ts';
|
|
9
|
-
export type * from './resources/editGigaspotOrders.ts';
|
|
10
|
-
export type * from './resources/getGigaspot.ts';
|
|
11
8
|
export type * from './resources/marketplace.ts';
|
|
12
9
|
export type * from './resources/myOrders.ts';
|
|
13
10
|
export type * from './resources/myServers.ts';
|
|
@@ -20,7 +20,11 @@ export interface CreateOrderBase {
|
|
|
20
20
|
command?: string;
|
|
21
21
|
required_price?: number;
|
|
22
22
|
autossh_entrypoint?: boolean;
|
|
23
|
-
|
|
23
|
+
remember_passwords?: boolean;
|
|
24
24
|
dockerhub_auth?: string;
|
|
25
|
+
gpu_count?: number;
|
|
26
|
+
gpu_indices?: number[];
|
|
27
|
+
}
|
|
28
|
+
export interface CreateOrderResponseData extends ResponseData {
|
|
29
|
+
min_price?: number;
|
|
25
30
|
}
|
|
26
|
-
export type CreateOrderResponseData = ResponseData;
|
|
@@ -10,11 +10,16 @@ export interface MarketplaceServer {
|
|
|
10
10
|
price: Price;
|
|
11
11
|
rented: boolean;
|
|
12
12
|
specs: Specs;
|
|
13
|
+
partial_gpu_rental: false | MarketplaceServerPartialGpuRental;
|
|
13
14
|
reliability: number;
|
|
14
15
|
allowed_coins: Currency[];
|
|
15
16
|
rating: Rating;
|
|
16
17
|
gpu_array: string[];
|
|
17
|
-
gigaspot?: boolean;
|
|
18
18
|
oc?: boolean;
|
|
19
19
|
cuda_version: string;
|
|
20
20
|
}
|
|
21
|
+
export interface MarketplaceServerPartialGpuRental {
|
|
22
|
+
total_gpus: number;
|
|
23
|
+
available_gpus: number;
|
|
24
|
+
free_indices: number[];
|
|
25
|
+
}
|
|
@@ -10,18 +10,22 @@ export interface MyOrdersOrder {
|
|
|
10
10
|
id: number;
|
|
11
11
|
creation_fee: number;
|
|
12
12
|
price: number;
|
|
13
|
+
oc_price: number;
|
|
14
|
+
original_price_usd?: number;
|
|
13
15
|
mrl: number;
|
|
14
16
|
image: string;
|
|
15
17
|
currency: Currency;
|
|
16
|
-
original_price_usd?: number;
|
|
17
18
|
spend: number;
|
|
18
19
|
ct: number;
|
|
20
|
+
p: number;
|
|
19
21
|
specs: Specs;
|
|
22
|
+
gpu_count: number;
|
|
23
|
+
total_gpus: number;
|
|
24
|
+
gpu_array: string[];
|
|
20
25
|
si: number;
|
|
21
26
|
my_past_rating?: number;
|
|
22
27
|
auto_login: string;
|
|
23
28
|
mon_container: number;
|
|
24
|
-
online: boolean;
|
|
25
29
|
pub_cluster: string[];
|
|
26
30
|
tcp_ports: string[];
|
|
27
31
|
http_port: string;
|
|
@@ -30,7 +34,8 @@ export interface MyOrdersOrder {
|
|
|
30
34
|
reliability: number;
|
|
31
35
|
owner: number;
|
|
32
36
|
cuda_version: string;
|
|
33
|
-
gpu_array: string[];
|
|
34
37
|
spot?: boolean;
|
|
35
38
|
expired?: boolean;
|
|
39
|
+
paused?: boolean;
|
|
40
|
+
online: boolean;
|
|
36
41
|
}
|
|
@@ -10,7 +10,15 @@ export interface MyServersServer {
|
|
|
10
10
|
pricing: Pricing;
|
|
11
11
|
online: boolean;
|
|
12
12
|
min_spot_pricing: Pricing;
|
|
13
|
-
allowed_currencies: Currency[];
|
|
14
13
|
init_token?: string;
|
|
15
|
-
specs
|
|
14
|
+
specs: Specs;
|
|
15
|
+
allowed_currencies: Currency[];
|
|
16
|
+
rented: boolean;
|
|
17
|
+
remaining_time: number;
|
|
18
|
+
rented_currency: Currency;
|
|
19
|
+
rented_price: number;
|
|
20
|
+
rental_state: string;
|
|
21
|
+
rented_gpus: number;
|
|
22
|
+
total_gpus: number;
|
|
23
|
+
rented_price_by_currency: Pricing;
|
|
16
24
|
}
|
|
@@ -3,6 +3,9 @@ export interface RenterFeesResponseData extends ResponseData {
|
|
|
3
3
|
renter_fees: RenterFees;
|
|
4
4
|
poh_config: RenterFeesPohConfig;
|
|
5
5
|
creation_fees: RenterFeesCreationFees;
|
|
6
|
+
creation_fee_delay_minutes: number;
|
|
7
|
+
minimal_balance_when_creating_order: RenterFeesMinimalBalance;
|
|
8
|
+
terminate_order_when_customer_has_less_balance_than_for_minutes: number;
|
|
6
9
|
poh_balance: number;
|
|
7
10
|
}
|
|
8
11
|
export interface RenterFees {
|
|
@@ -11,6 +14,7 @@ export interface RenterFees {
|
|
|
11
14
|
}
|
|
12
15
|
export interface RenterFee {
|
|
13
16
|
base: Pricing;
|
|
17
|
+
extra: Pricing;
|
|
14
18
|
}
|
|
15
19
|
export interface RenterFeesPohConfig {
|
|
16
20
|
max_reduction_percent: number;
|
|
@@ -20,3 +24,7 @@ export interface RenterFeesCreationFees {
|
|
|
20
24
|
on_demand: Pricing;
|
|
21
25
|
spot: Pricing;
|
|
22
26
|
}
|
|
27
|
+
export interface RenterFeesMinimalBalance {
|
|
28
|
+
on_demand: Pricing;
|
|
29
|
+
spot: Pricing;
|
|
30
|
+
}
|
|
@@ -17,11 +17,23 @@ export interface ServerConfig {
|
|
|
17
17
|
initialized: boolean;
|
|
18
18
|
id: number;
|
|
19
19
|
rental_status: number;
|
|
20
|
+
partial_rental_enabled: boolean;
|
|
20
21
|
specs: Specs;
|
|
21
22
|
background_job: ServerConfigBackgroundJob;
|
|
23
|
+
init_communication_token: string;
|
|
22
24
|
allowed_coins: Currency[];
|
|
23
25
|
autoprice: AutoPrice;
|
|
24
26
|
usd_pricing: PricingInOriginalUsd;
|
|
27
|
+
remaining_time: number;
|
|
28
|
+
rental_state: string;
|
|
29
|
+
rented_gpus: number;
|
|
30
|
+
total_gpus: number;
|
|
31
|
+
update_channel: string;
|
|
32
|
+
requested_channel: string;
|
|
33
|
+
target_backend_version: number;
|
|
34
|
+
driver: ServerConfigDriver;
|
|
35
|
+
rented_price_by_currency: Pricing;
|
|
36
|
+
tenants: ServerConfigTenant[];
|
|
25
37
|
}
|
|
26
38
|
export interface ServerConfigBackgroundJob {
|
|
27
39
|
times_updated: number;
|
|
@@ -29,3 +41,15 @@ export interface ServerConfigBackgroundJob {
|
|
|
29
41
|
command: string;
|
|
30
42
|
env: Record<string, string>;
|
|
31
43
|
}
|
|
44
|
+
export interface ServerConfigDriver {
|
|
45
|
+
version: string;
|
|
46
|
+
status: string;
|
|
47
|
+
latest: string;
|
|
48
|
+
}
|
|
49
|
+
export interface ServerConfigTenant {
|
|
50
|
+
rental_type: string;
|
|
51
|
+
currency: Currency;
|
|
52
|
+
price: number;
|
|
53
|
+
remaining_time: number;
|
|
54
|
+
gpu_count: number;
|
|
55
|
+
}
|
|
@@ -3,13 +3,8 @@ export interface SetSpotPriceRequestData {
|
|
|
3
3
|
order_id: number;
|
|
4
4
|
desired_price: number;
|
|
5
5
|
}
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
export interface SetSpotPriceResponseData extends ResponseData {
|
|
7
|
+
max_step?: number;
|
|
8
|
+
time_to_lowering?: number;
|
|
9
|
+
min_price?: number;
|
|
10
10
|
}
|
|
11
|
-
export interface SetSpotPriceTimeToLowering extends ResponseData {
|
|
12
|
-
error: 'can_lower_every_600_seconds';
|
|
13
|
-
time_to_lowering: number;
|
|
14
|
-
}
|
|
15
|
-
export type SetSpotPriceNormal = Omit<ResponseData, 'error'>;
|
package/dist/types.d.ts
CHANGED
|
@@ -23,25 +23,6 @@ export interface Price {
|
|
|
23
23
|
usd: PricingInUsd;
|
|
24
24
|
original_usd?: PricingInOriginalUsd;
|
|
25
25
|
}
|
|
26
|
-
export interface Net {
|
|
27
|
-
cc: string;
|
|
28
|
-
down: number;
|
|
29
|
-
up: number;
|
|
30
|
-
test_history: string[];
|
|
31
|
-
}
|
|
32
|
-
export interface Gpu {
|
|
33
|
-
type: string;
|
|
34
|
-
mem: number;
|
|
35
|
-
pcie_gen: number;
|
|
36
|
-
pcie_width: number;
|
|
37
|
-
}
|
|
38
|
-
export interface Overclock {
|
|
39
|
-
model: string;
|
|
40
|
-
core_offset: number | null;
|
|
41
|
-
mem_offset: number | null;
|
|
42
|
-
core_lock: number | null;
|
|
43
|
-
mem_lock: number | null;
|
|
44
|
-
}
|
|
45
26
|
export interface Specs {
|
|
46
27
|
mb: string;
|
|
47
28
|
cpu: string;
|
|
@@ -55,6 +36,7 @@ export interface Specs {
|
|
|
55
36
|
backend_version: number;
|
|
56
37
|
pcie_rev: number;
|
|
57
38
|
pcie_width: number;
|
|
39
|
+
update_channel: string;
|
|
58
40
|
xfs?: number;
|
|
59
41
|
stock_oc_override?: boolean;
|
|
60
42
|
pl: number[];
|
|
@@ -62,14 +44,26 @@ export interface Specs {
|
|
|
62
44
|
stock_pl: number[];
|
|
63
45
|
stock_oc: Overclock[] | 'default';
|
|
64
46
|
}
|
|
47
|
+
export interface Net {
|
|
48
|
+
cc: string;
|
|
49
|
+
down: number;
|
|
50
|
+
up: number;
|
|
51
|
+
test_history: string[];
|
|
52
|
+
}
|
|
53
|
+
export interface Gpu {
|
|
54
|
+
type: string;
|
|
55
|
+
mem: number;
|
|
56
|
+
pcie_gen: number;
|
|
57
|
+
pcie_width: number;
|
|
58
|
+
}
|
|
59
|
+
export interface Overclock {
|
|
60
|
+
model: string;
|
|
61
|
+
core_offset: number | null;
|
|
62
|
+
mem_offset: number | null;
|
|
63
|
+
core_lock: number | null;
|
|
64
|
+
mem_lock: number | null;
|
|
65
|
+
}
|
|
65
66
|
export interface Rating {
|
|
66
67
|
avg: number;
|
|
67
68
|
cnt: number;
|
|
68
69
|
}
|
|
69
|
-
export interface GigaspotOverclock {
|
|
70
|
-
pl: number;
|
|
71
|
-
core_offset?: number;
|
|
72
|
-
mem_offset?: number;
|
|
73
|
-
core_lock?: number;
|
|
74
|
-
mem_lock?: number;
|
|
75
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloreai",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "CLORE.AI API client",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloreai",
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
"type": "module",
|
|
17
17
|
"main": "dist/index.js",
|
|
18
18
|
"types": "dist/index.d.ts",
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
19
22
|
"scripts": {
|
|
20
23
|
"build": "rimraf dist && tsc --project tsconfig.build.json",
|
|
21
24
|
"check": "npm run typecheck && npm run lint && npm run format",
|
|
@@ -26,18 +29,18 @@
|
|
|
26
29
|
"typecheck": "tsc --noEmit"
|
|
27
30
|
},
|
|
28
31
|
"dependencies": {
|
|
29
|
-
"p-queue": "^9.
|
|
32
|
+
"p-queue": "^9.3.4"
|
|
30
33
|
},
|
|
31
34
|
"devDependencies": {
|
|
32
|
-
"@tsconfig/node-lts": "^24.0.
|
|
35
|
+
"@tsconfig/node-lts": "^24.0.1",
|
|
33
36
|
"@tsconfig/node-ts": "^23.6.4",
|
|
34
37
|
"@tsconfig/strictest": "^2.0.8",
|
|
35
|
-
"@types/node": "^
|
|
36
|
-
"eslint": "^10.
|
|
37
|
-
"eslint-config-vladpuz": "^4.0
|
|
38
|
+
"@types/node": "^26.6.5",
|
|
39
|
+
"eslint": "^10.12.0",
|
|
40
|
+
"eslint-config-vladpuz": "^4.3.0",
|
|
38
41
|
"husky": "^9.1.7",
|
|
39
|
-
"prettier": "^3.
|
|
40
|
-
"prettier-config-vladpuz": "^3.0.
|
|
42
|
+
"prettier": "^3.9.10",
|
|
43
|
+
"prettier-config-vladpuz": "^3.0.2",
|
|
41
44
|
"rimraf": "^6.1.3",
|
|
42
45
|
"typescript": "^6.0.3"
|
|
43
46
|
}
|
package/dist/Gigaspot.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type Cloreai from './Cloreai.ts';
|
|
2
|
-
import type { CancelOrdersRequestData, CancelOrdersResponseData } from './resources/cancelOrders.ts';
|
|
3
|
-
import type { CreateGigaspotOrdersRequestData, CreateGigaspotOrdersResponseData } from './resources/createGigaspotOrders.ts';
|
|
4
|
-
import type { EditGigaspotOrdersRequestData, EditGigaspotOrdersResponseData } from './resources/editGigaspotOrders.ts';
|
|
5
|
-
import type { GetGigaspotResponseData } from './resources/getGigaspot.ts';
|
|
6
|
-
type Fetch = (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
7
|
-
declare class Gigaspot {
|
|
8
|
-
#private;
|
|
9
|
-
constructor(cloreai: Cloreai, fetch: Fetch);
|
|
10
|
-
getGigaspot(init?: RequestInit): Promise<GetGigaspotResponseData>;
|
|
11
|
-
createGigaspotOrders(data: CreateGigaspotOrdersRequestData, init?: RequestInit): Promise<CreateGigaspotOrdersResponseData>;
|
|
12
|
-
editGigaspotOrders(data: EditGigaspotOrdersRequestData, init?: RequestInit): Promise<EditGigaspotOrdersResponseData>;
|
|
13
|
-
cancelOrders(data: CancelOrdersRequestData, init?: RequestInit): Promise<CancelOrdersResponseData>;
|
|
14
|
-
}
|
|
15
|
-
export default Gigaspot;
|
package/dist/Gigaspot.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { priorityLevels } from "./constants.js";
|
|
2
|
-
class Gigaspot {
|
|
3
|
-
#cloreai;
|
|
4
|
-
#fetch;
|
|
5
|
-
constructor(cloreai, fetch) {
|
|
6
|
-
this.#cloreai = cloreai;
|
|
7
|
-
this.#fetch = fetch;
|
|
8
|
-
}
|
|
9
|
-
async getGigaspot(init = {}) {
|
|
10
|
-
const url = new URL(this.#cloreai.baseURL + '/get_gigaspot');
|
|
11
|
-
const response = await this.#cloreai.queue.add(async () => {
|
|
12
|
-
return await this.#fetch(url, {
|
|
13
|
-
...init,
|
|
14
|
-
method: 'GET',
|
|
15
|
-
});
|
|
16
|
-
}, {
|
|
17
|
-
priority: priorityLevels.NORMAL,
|
|
18
|
-
signal: init.signal ?? undefined,
|
|
19
|
-
});
|
|
20
|
-
const data = await response.json();
|
|
21
|
-
const snapshotResponse = await fetch(data.v1_snapshot_url);
|
|
22
|
-
const snapshotData = await snapshotResponse.json();
|
|
23
|
-
return {
|
|
24
|
-
...data,
|
|
25
|
-
snapshot: snapshotData,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
async createGigaspotOrders(data, init = {}) {
|
|
29
|
-
const url = new URL(this.#cloreai.baseURL + '/create_gigaspot_orders');
|
|
30
|
-
const response = await this.#cloreai.queue.add(async () => {
|
|
31
|
-
return await this.#fetch(url, {
|
|
32
|
-
...init,
|
|
33
|
-
method: 'POST',
|
|
34
|
-
body: JSON.stringify(data),
|
|
35
|
-
});
|
|
36
|
-
}, {
|
|
37
|
-
priority: priorityLevels.HIGH,
|
|
38
|
-
signal: init.signal ?? undefined,
|
|
39
|
-
});
|
|
40
|
-
return await response.json();
|
|
41
|
-
}
|
|
42
|
-
async editGigaspotOrders(data, init = {}) {
|
|
43
|
-
const url = new URL(this.#cloreai.baseURL + '/edit_gigaspot_orders');
|
|
44
|
-
const response = await this.#cloreai.queue.add(async () => {
|
|
45
|
-
return await this.#fetch(url, {
|
|
46
|
-
...init,
|
|
47
|
-
method: 'POST',
|
|
48
|
-
body: JSON.stringify(data),
|
|
49
|
-
});
|
|
50
|
-
}, {
|
|
51
|
-
priority: priorityLevels.HIGH,
|
|
52
|
-
signal: init.signal ?? undefined,
|
|
53
|
-
});
|
|
54
|
-
return await response.json();
|
|
55
|
-
}
|
|
56
|
-
async cancelOrders(data, init = {}) {
|
|
57
|
-
const url = new URL(this.#cloreai.baseURL + '/cancel_orders');
|
|
58
|
-
const response = await this.#cloreai.queue.add(async () => {
|
|
59
|
-
return await this.#fetch(url, {
|
|
60
|
-
...init,
|
|
61
|
-
method: 'POST',
|
|
62
|
-
body: JSON.stringify(data),
|
|
63
|
-
});
|
|
64
|
-
}, {
|
|
65
|
-
priority: priorityLevels.HIGH,
|
|
66
|
-
signal: init.signal ?? undefined,
|
|
67
|
-
});
|
|
68
|
-
return await response.json();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
export default Gigaspot;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Currency, GigaspotOverclock, ResponseData } from '../types.ts';
|
|
2
|
-
export type CreateGigaspotOrdersRequestData = CreateGigaspotOrdersOrder[];
|
|
3
|
-
export interface CreateGigaspotOrdersOrder {
|
|
4
|
-
currency: Currency;
|
|
5
|
-
image: string;
|
|
6
|
-
renting_server: number;
|
|
7
|
-
price: number;
|
|
8
|
-
oc: GigaspotOverclock[];
|
|
9
|
-
env?: Record<string, string>;
|
|
10
|
-
}
|
|
11
|
-
export interface CreateGigaspotOrdersResponseData extends ResponseData {
|
|
12
|
-
failed_to_oc_servers: number[];
|
|
13
|
-
failed_to_rent_servers: number[];
|
|
14
|
-
too_low_bids_servers: number[];
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { GigaspotOverclock, ResponseData } from '../types.ts';
|
|
2
|
-
export type EditGigaspotOrdersRequestData = EditGigaspotOrdersOrder[];
|
|
3
|
-
export interface EditGigaspotOrdersOrder {
|
|
4
|
-
order_id: number;
|
|
5
|
-
price: number;
|
|
6
|
-
oc: GigaspotOverclock[];
|
|
7
|
-
}
|
|
8
|
-
export interface EditGigaspotOrdersResponseData extends ResponseData {
|
|
9
|
-
success_to_update_ids: number[];
|
|
10
|
-
failed_to_update_ids: number[];
|
|
11
|
-
too_low_bid_ids: number[];
|
|
12
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { Currency, Pricing, ResponseData } from '../types.ts';
|
|
2
|
-
export interface GetGigaspotResponseData extends GetGigaspotResponseDataBase {
|
|
3
|
-
snapshot: GetGigaspotSnapshot;
|
|
4
|
-
}
|
|
5
|
-
export interface GetGigaspotResponseDataBase extends ResponseData {
|
|
6
|
-
my_user_id: number;
|
|
7
|
-
v1_snapshot_url: string;
|
|
8
|
-
creation_fees: Pricing;
|
|
9
|
-
}
|
|
10
|
-
export type GetGigaspotSnapshot = Record<string, GetGigaspotSnapshotServer>;
|
|
11
|
-
export interface GetGigaspotSnapshotServer {
|
|
12
|
-
bids: GetGigaspotSnapshotServerBid[];
|
|
13
|
-
on_demand_rented: boolean;
|
|
14
|
-
online: boolean;
|
|
15
|
-
cpu: string;
|
|
16
|
-
cores: number;
|
|
17
|
-
threads: number;
|
|
18
|
-
ram: number;
|
|
19
|
-
gpus: GetGigaspotSnapshotServerGpu[];
|
|
20
|
-
working_properly: boolean;
|
|
21
|
-
cuda: string;
|
|
22
|
-
max_rental_length: number;
|
|
23
|
-
cc: string;
|
|
24
|
-
host: number;
|
|
25
|
-
reliability: number;
|
|
26
|
-
min_bid: number;
|
|
27
|
-
energy_price: number;
|
|
28
|
-
}
|
|
29
|
-
export interface GetGigaspotSnapshotServerBid {
|
|
30
|
-
owner: number;
|
|
31
|
-
id: number;
|
|
32
|
-
active: boolean;
|
|
33
|
-
to_cache: boolean;
|
|
34
|
-
cached: boolean;
|
|
35
|
-
price: number;
|
|
36
|
-
currency: Currency;
|
|
37
|
-
pl: number;
|
|
38
|
-
}
|
|
39
|
-
export interface GetGigaspotSnapshotServerGpu {
|
|
40
|
-
pl: [number, number];
|
|
41
|
-
mem_lock: [number, number];
|
|
42
|
-
core_lock: [number, number];
|
|
43
|
-
mem_offset: [number, number];
|
|
44
|
-
core_offset: [number, number];
|
|
45
|
-
model: string;
|
|
46
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|