How To Set Up API On Janitor AI? [2024]

Janitor AI is an artificial intelligence platform that allows you to build custom AI solutions. It provides developers with powerful tools like natural language processing, computer vision, speech recognition etc. to create intelligent bots, virtual agents, analytic tools and more.

One of the ways to integrate Janitor AI’s capabilities into your own application or website is through its API (Application Programming Interface). The API allows you to access Janitor AI’s machine learning models and data through simple API calls.

In this comprehensive guide, we will walk you through the step-by-step process of setting up the Janitor AI API from creating an account to making your first API call.

Prerequisites

Before you can start using the Janitor AI API, you need:

  • A Janitor AI account. You can sign up for a free account on their website. This will give you free credits to experiment with the API.
  • An API key. After signing up, you can generate an API key from the account dashboard. This acts as your unique identifier.
  • Basic coding knowledge. You don’t need to be an expert developer, but basic understanding of concepts like APIs, JSON, libraries etc. will be useful.
  • Code editor/API testing tool. You will need a way to write and test code that calls the Janitor AI API. Popular options are Postman, Visual Studio Code, Sublime Text etc.

Step 1 – Sign Up for a Janitor AI Account

Go to Janitor AI website and click on Sign Up. Follow the prompts to create your free account.

You need to enter your email, name and set a password. Janitor AI will send a confirmation email to activate your account.

Once logged in, you will be taken to the dashboard. This is where you can view usage, credits balance and manage API keys.

Step 2 – Generate an API Key

An API key is required to authenticate your API requests. All calls to Janitor AI API must include a valid API key.

To generate your API key:

  1. Click on the Profile icon and select API Keys from the menu.
  2. Click on the Create API Key button.
  3. Give your key a name and description to identify it.
  4. Select the products you want to enable for this key. For testing, you can enable all products.
  5. Set an optional quota on monthly requests.
  6. Click Create and copy the generated API key.

This key acts as your unique access token for the API. Make sure to store it somewhere secure – do not share it publicly.

You can always come back here to manage, revoke or create new API keys.

Step 3 – Install the SDK / Helper Library

To call the Janitor AI API from your code, you can either use:

REST API – Directly make HTTP requests to API endpoints. Useful for testing from API clients like Postman.

Helper Libraries – Language-specific libraries that abstract direct calls. Easier integration into apps.

Here are a few options:

  • Pythonpip install janitor-ai
  • JavaScriptnpm install janitor-ai
  • Java – Get packages from Maven repository
  • C# .NET Nuget Package

We will use the Python SDK in this guide for demonstration. Make sure to have Python 3.6+ installed on your system.

Run this command in your terminal / command prompt:

This will download and set up the Python SDK with all dependencies.

Step 4 – Import the SDK

Create a new Python file and import the JanitorAI module:

This single import provides access to the entire Janitor AI API.

You can now instantiate a client object by passing your API key:

Replace YOUR_API_KEY with the key you generated earlier.

The client will manage state, authentication, serialization and other complexities making it super easy to call the API.

Step 5 – Make Your First API Call

Let’s start with a simple API call to test out the client:

This uses the text-generation endpoint to get AI generated text from the prompt “Hello”.

The response is returned as a Python dict containing the completed text. We simply print the text field.

When you run the script, it should make the API call and print the AI generated text.

And that’s it! You have successfully made your first call to Janitor AI API using the Python SDK.

The client handles authorization, request serialization, response validation etc. behind the scenes making it easy to integrate Janitor AI’s capabilities in just few lines of code.

Step 6 – Explore More API Capabilities

Janitor AI provides a wide suite of state-of-the-art AI models through the API including:

Text

  • Text Generation
  • Translation
  • Content Moderation
  • Summarization
  • Sentiment Analysis

Vision

  • Image Classification
  • Object Detection
  • Face Comparison

Audio

  • Speech to Text
  • Text to Speech

And many more advanced capabilities.

You can check out the full API reference documentation for details on usage, inputs/outputs, supported languages and more examples.

Let’s try another API – analyze an image to extract insights:

This makes a call to vision.analyze_image endpoint, passing the image URL.

The response contains detected tags, text captions, faces and other details about the image content. We print tags and captions.

Similarly, you can leverage other endpoints like text.moderate, audio.transcribe, vision.detect_objects etc. that best fit your use case.

Each API call follows the same flow – pass inputs, call endpoint, process outputs.

Step 7 – Set Up API Monitoring

As you integrate Janitor AI API into applications handling user data, it’s good practice to monitor API traffic for visibility.

Janitor AI provides options to monitor API requests within account limits:

1. View Usage Dashboard

Log in to your Janitor AI account and go to the Usage tab for graphs on requests, compute time and credits spent. Filter by date ranges or API keys.

This gives an overview of how different applications are utilizing your account resources.

2. Set Alerts

You can set up custom alerts for daily/monthly quotas so you are notified when usage reaches defined thresholds.

Go to Profile > Alerts to configure email/webhook notifications based on request volumes.

3. Enable Logging

While testing, you may want to log API requests/responses to debug issues faster.

Pass the log=true parameter to log call info without changing code.

You can also explicitly log messages using the SDK’s logging module for more control.

Monitoring usage metrics and logs will help gain insights into traffic patterns and optimize resource planning.

Conclusion

That concludes our step-by-step guide to setting up the Janitor AI API!

We learned how to:

  • Sign up for a Janitor AI account
  • Generate an API key
  • Install the Python SDK
  • Make API calls to text & vision endpoints
  • Handle responses and print outputs
  • Monitor API traffic and usage

The Janitor AI API abstracts away all the AI model complexities, allowing you to easily integrate powerful text/image/speech analysis into apps without needing deep ML expertise.

You can go through the documentation to explore the full capabilities, input options, supported languages and code examples.

As next steps, you can look into building proof-of-concept prototypes leveraging Janitor AI API to test viability for your own AI solutions!

If you have any query, feel free to Contact Us!

FAQs

What is the Janitor AI API?

The Janitor AI API is a web service that provides access to Janitor AI’s machine learning models via API calls. It allows you to integrate AI capabilities like text generation, image recognition, predictions etc. into your own applications.

What platforms and languages does the API support?

The Janitor AI API can be called from any language that can make HTTP requests like Python, JavaScript, Java, C# etc. Helper libraries are available in popular languages. The API is accessible from web, mobile and server platforms.

Is there a free tier for the API?

Yes, Janitor AI offers a free tier to allow testing the API before committing to a paid plan. It includes limited monthly requests that refresh each month.

How do I authenticate API calls?

All API calls must include your unique API key generated from your Janitor AI dashboard account. This key authenticates all your requests.

How can I monitor my API usage?

You get access to usage dashboards and alerts to monitor request volumes, compute time used, credits balance etc. This allows optimizing consumption.

Where can I find API documentation and code examples?

Full API reference documentation with endpoint details, parameters, code examples etc can be found at docs.janitor.ai. SDK documentation provides language-specific usage guides.

Who can I contact for API support?

If you face any issues or have integration questions, you can reach out to Janitor AI’s developer support team through the chat widget on their website or email support@janitor.ai.

2 thoughts on “How To Set Up API On Janitor AI? [2024]”

Leave a comment