Package Exports
- monsterapi
- monsterapi/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (monsterapi) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
# monsterapi
**monsterapi** is a JavaScript client library for interacting with the Monster API. It provides an easy way to access the API's features and integrate them into your applications.
## Installation
You can install the `monsterapi` package using npm or yarn:
```bash
npm install monsterapi
or
yarn add monsterapi
Model Data
Available Models
Text Generation / Language Models (LLMs):
- falcon-7b-instruct
- mpt-7b-instruct
- llama2-7b-chat
- falcon-40b-instruct
- mpt-30b-instruct
Note: Other models are accessible through the client but are not activated yet. They will be updated shortly.
Image Generation:
- txt2img - stable-diffusion v1.5
- sdxl - stable-diffusion XL V1.0
- pix2pix - Instruct-pix2pix
- img2img - Image to Image using Stable Diffusion
Speech Generation:
- sunoai-bark - Bark (Sunoai Bark)
- whisper - Whisper Large V2
Usage
Import the Library
To use the monsterapi library in your project, import the MonsterApiClient
class:
import MonsterApiClient from 'monsterapi';
Initialize the Client
Create an instance of the MonsterApiClient
class by providing your API key:
const client = new MonsterApiClient('your-api-key');
Replace 'your-api-key'
with your actual Monster API key.
Generate Content
You can use the generate
method to create content using the Monster API:
const model = 'whisper'; // Replace with a valid model name
const input = {
// Replace with valid input data for the model
};
client.generate(model, input)
.then((response) => {
// Handle the response from the API
console.log('Generated content:', response);
})
.catch((error) => {
// Handle API errors
console.error('Error:', error);
});
Check Status
You can use the get_status
method to check the status of a content generation process:
const processId = 'your-process-id'; // Replace with the actual process ID
client.get_status(processId)
.then((status) => {
// Handle the status response from the API
console.log('Status:', status);
})
.catch((error) => {
// Handle API errors
console.error('Error:', error);
});
Wait and Get Result
You can use the wait_and_get_result
method to wait for a content generation process to complete and retrieve the result:
const processId = 'your-process-id'; // Replace with the actual process ID
client.wait_and_get_result(processId)
.then((result) => {
// Handle the generated content result
console.log('Generated content result:', result);
})
.catch((error) => {
// Handle API errors or timeout
console.error('Error:', error);
});
Documentation
For more details on the monsterapi library and its methods, refer to the documentation.
License
This project is licensed under the MIT License.