How To...

How to use our APIs...

Welcome to Monster API. Do checkout our pricing if you wish to upgrade

Monster API provides you a simple platform to help you get started with consuming Generative AI APIs and add them in your application.

Below are some steps that you can follow to get started with using Monster APIs for your workflows:

Step 1: Create an Account and get free credits

To get started with Monster API, you'll need to create an account on our platform.

Head over to our Sign Up page. You may sign up easily via Google or GitHub or your email.

Post Sign up, you get FREE Credits to try us out. Using these free credits you can quickly test Monster API platform and see if it is a right fit for your requirements.

Step 2: Obtain API Keys

Once you've created an account, we automatically generate an API key for you (can be found in your Monster API Dashboard).

📘

API Keys

Every Monster API account has been assigned a unique key. Please do not share this key with anyone else. You can anytime generate a new key if needed.

We understand security, so no limit on how many time you can re-generate API key

Hurraayyy 🥳 Now you have your personal API Key, lets dive in...🏄

Step 3: Try out a Model

Monster API provides several pre-hosted Generative AI models. For this guide, we will focus on txt2img model.

Send API Request

API Endpoint: https://api.monsterapi.ai/v1/generate/txt2img

Request Type: POST

Payload to all model is send as content-type: multipart/form-data. This provides the flexibility to upload files

Pick Integration of your choice

You can choose any Programming language readily available under each model. For this guide, we will focus on curl request

📘

Copy your Authorization Token before sending below request

curl --request POST \
     --url https://api.monsterapi.ai/v1/generate/txt2img \
     --header 'accept: application/json' \
     --header 'authorization: Bearer <YOUR-BEARER-TOKEN>' \
     --header 'content-type: multipart/form-data' \
     --form 'prompt=detailed sketch of lion by greg rutkowski, beautiful, intricate, ultra realistic, elegant, art by artgerm' \
     --form aspect_ratio=portrait \
     --form guidance_scale=12.5

On sending above request, below response will be returned:

{
  "message": "Request accepted successfully",
  "process_id": "0152f297-d0c4-47b2-8bc0-f6db0136fe61",
  "status_url": "https://api.monsterapi.ai/v1/status/0152f297-d0c4-47b2-8bc0-f6db0136fe61",
  "callback_url": ""
}

📘

Monster APIs are asynchronous API

Monster API are asynchronous API which will return process_id for every request submitted. Users need to query status_url to know status of their request

On successful submission of request, Monster API will return a unique process_id and status_url to fetch status on for this request.

We also provide an option to receive status updates on a Callback URL. You can register a callback URL from your Monster Account Setting page. Once done, simply provide callbackURL as queryparameter as below:

API Endpoint: https://api.monsterapi.ai/v1/generate/txt2img?callbackURL=mycallback

Receive Results

We will send GET request to status_url received in last request

Sample request to fetch results

📘

Copy your Authorization Token before sending below request

curl --request GET \
     --url https://api.monsterapi.ai/v1/status/93690cb8-ca4b-48f3-8d60-e76f3bed3711 \
     --header 'authorization: Bearer <copy your token>' \
     --header 'accept: application/json'

Response Received:

{
  "process_id": "93690cb8-ca4b-48f3-8d60-e76f3bed3711",
  "status": "COMPLETED",
  "result": {
    "output": [
      "https://processed-model-result.s3.us-east-2.amazonaws.com/936dfgdrb8-ca4b-48f3-8d60-e76f3bed3711_0.png",
      "https://processed-model-result.s3.us-east-2.amazonaws.com/936tget8-ca4b-48f3-8d60-e76f3bed3711_1.png"
    ]
  },
  "credit_used": 13,
  "overage": 0
}

Following keys are returned which can be interpreted as below:

  • process_id : Unique process_id for request submitted
  • status: Status of your request. Can return following values
    • IN_PROGRESS --> When worker is working on your request
    • IN_QUEUE --> Request received but waiting in queue to be picked by Monster worker
    • FAILED --> Request failed, due to some payload error or internal error
    • COMPLETED --> Request completed successfully
  • result: Output from Generative Model requested
  • credits_used: Monster API credits used for processing this request
  • overage: Credits consumed more than credits available.

With this, we hope you find our APIs easy to integrate with your platform. We are highly scalable, so trust us when we say we are ready to onboard you.

Now, hop on to try different Generative API model available. We will continue to add models, so do come back and check us out...

Happy Coding!!!👨🏼‍💻