1.0.3 • Published 2 years ago

@ainize-team/ainize-sdk v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

ainize-sdk

A Typescript SDK for the Ainize, a system for running AI services on the AI Network.

Requirements

node >= 16

usage

Install

npm install @ainize-team/ainize-sdk

yarn install @ainize-team/ainize-sdk

Import

import Ainize from '@ainize-team/ainize-sdk'
const ainize = new Ainize(<CHAIN_ID>);

CHAIN_ID

  • 0: AI Network test net
  • 1: AI Network main net

Login

You should login to ainize with AI Network account before deploy the container.

ainize.login(<YOUR_PRIVATE_KEY>);

Deploy

You can deploy your AI service to ainize.

const service = await ainize.deploy(<CONFIGURATION>);

CONFIGURATION

  • serviceName: The name you want to deploying service.
  • billingConfig: Billing configuration required for service usage.
    • depositAddress: The address for receiving AIN deposits.
    • costPerToken: Cost per token for service usage.
    • minCost: Minimum cost.
    • maxCost: Maximum cost. (optional)

You can stop or run your service container. Only service deployer can use this.

service.stop();
service.run();

Using Service

You can use a service using ainize.service(<SERVICE_NAME>).

const service = await ainize.service(<SERVICE_NAME>);

You should deposit AIN to credit before using service.

await service.chargeCredit(<AMOUNT>);
const balance = await service.getCreditBalance();

If you have enough credit, you can use the service.

const result = await service.use(<REQUEST_DATA>);
1.0.2

2 years ago

1.0.1

2 years ago

1.0.3

2 years ago

1.0.0

2 years ago

0.0.1-beta.20

2 years ago

0.0.1-beta.19

2 years ago

0.0.1-beta.18

2 years ago

0.0.1-beta.17

2 years ago

0.0.1-beta.16

2 years ago

0.0.1-beta.15

2 years ago

0.0.1-beta.14

2 years ago

0.0.1-beta.13

2 years ago

0.0.1-beta.12

2 years ago

0.0.1-beta.11

2 years ago

0.0.1-beta.10

2 years ago

0.0.1-beta.9

2 years ago

0.0.1-beta.8

2 years ago

0.0.1-beta.7

2 years ago

0.0.1-beta.4

2 years ago

0.0.1-beta.3

2 years ago

0.0.1-beta.2

2 years ago

0.0.1-beta.1

2 years ago

0.0.1-beta.0

2 years ago