1.3.1 • Published 10 months ago

@ainize-team/ainize-js v1.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

ainize-js

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

Requirements

node >= 16

usage

Install

npm install @ainize-team/ainize-js

yarn install @ainize-team/ainize-js

Import

import Ainize from '@ainize-team/ainize-js'
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>);

You can also login using AIN Wallet on the web.

ainize.loginWithSigner();

This feature is supported from AIN Wallet version 2.0.5 or later.

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.getService(<SERVICE_NAME>).

const service = await ainize.getService(<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.request(<REQUEST_DATA>);
1.3.1

10 months ago

1.2.2

1 year ago

1.3.0

11 months ago

1.2.1

1 year ago

1.2.1-beta.0

1 year ago

1.2.0

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1-beta.3

1 year ago

1.1.1-beta.2

1 year ago

1.1.1-beta.1

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.7-beta.3

1 year ago

1.0.7-beta.4

1 year ago

1.0.7-beta.1

1 year ago

1.0.7-beta.2

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

2 years ago

1.0.3

2 years ago