Modzy's JavaScript SDK provides a convenient wrapper around many of Modzy's most popular API routes. SDK functions include querying models, submitting inference jobs, and returning results directly to your IDE or browser.


Use yarn to package and install the SDK in an existing project:

  • $ yarn add @modzy/modzy-sdk

Or you can use npm:

  • $ npm install @modzy/modzy-sdk


Get Your API key

Once you have a model and version identified, get authenticated with your API key.

API keys are security credentials required to perform API requests to Modzy. Our API keys are composed of an ID that is split by a dot into two parts: a public and private part.

The public part is the API keys' visible part only used to identify the key and by itself, it’s unable to perform API requests.

The private part is the public part's complement and it’s required to perform API requests. Since it’s not stored on Modzy’s servers, it cannot be recovered. Make sure to save it securely. If lost, you can replace the API key.

Find your API key in your user profile. To get your full API key click on "Get key".


Once you have a model and version identified, get authenticated with your API key.

const modzy = require('@modzy/modzy-sdk');
const modzyClient = new modzy.ModzyClient('', 'API Key');

Basic usage

Submit a job providing the model, version, and input text:

let job = await modzyClient.submitJobText(
        'input-1':{'input.txt':'Modzy is great'},
        'input-2':{'input.txt':'Modzy is great'},

Hold until the inference is complete and results become available

job = await modzyClient.blockUntilComplete(job);

Get the output results:

let results = await modzyClient.getResult(job.jobIdentifier);

Fetch errors

Errors may arise for different reasons. Fetch errors to know what is their cause and how to fix them.

ApiErrorWrapper for different errors, check code, message, url attributes.

Functions & Methods

Currently the Javascript SDK support the following API Routes

Function or MethodDescription
modzyClient.getAllModelsRetrieve all the models
modzyClient.getModelsRetrieve some models
modzyClient.getModelRetrieve model details by identifier
modzyClient.getModelByNameRetrieve model details by name
modzyClient.getRelatedModelsRetrieve the list of related models
modzyClient.getModelVersionsRetrieve the versions of a model by identifier
modzyClient.getModelVersionRetrieve the version details
modzyClient.getModelVersionInputSampleRetrieve the raw JSON input sample of a model and version
modzyClient.getModelVersionOutputSampleRetrieve the output sample of a model and version
modzyClient.getJobHistoryGet the job history
modzyClient.submitJobTextSubmit a job using text as inputs
modzyClient.submitJobFileSubmit a job using files as inputs
modzyClient.submitJobEmbeddedSubmit a job using bytes or byte arrays as inputs
modzyClient.submitJobAWSS3Submit a job using aws s3 files as inputs
modzyClient.submitJobJDBCSubmits a job using a SQL query with JDBC access params
modzyClient.getJobRetrieve the job information from Modzy
modzyClient.cancelJobSend a request to cancel the job processing
modzyClient.getResultRetrieve the results of a job