hammer-brushSupported SDKs

This page describes the SDKs that can be used to call our API.

chevron-rightKey Definitions & Noteshashtag

The REST API itself is not an SDK. It is the server-side interface that exposes your models over HTTP. It defines endpoints, HTTP methods (POST/GET), required headers, and the structure of request and response JSON. Essentially, it’s the “contract” the server provides for clients to interact with models programmatically.


An SDK (Software Development Kit) is a client-side library that wraps around the REST API. It handles details like building HTTP requests, serializing/deserializing JSON, error handling, retries, and sometimes additional conveniences.

You can skip the SDK and call the REST API directly via cURL, fetch, requests, etc. The SDK just makes your life easier; the REST API is the “core interface” the SDK talks to.


The following flow shows how a request travels from your code to the model and back. Using an SDK is optional — it simply wraps the REST API for convenience.

Your code → SDK (optional) → REST API → Model → REST API → SDK → Your code

circle-info

Comparing requests made with raw REST API and different SDKs, pay attention to the following common aspects:

  • how the Authorization header and the AIML API key are provided,

  • how the POST method and the endpoint URL are specified,

  • how the input parameters are passed.

circle-check

REST API

We use the REST API because it’s fast, simple, and easy to understand. Only in Python do you need to import a separate library (requests), while cURL and JavaScript (Node.js) already have built-in support for HTTP requests. Therefore, REST API is used in the documentation examples for all of our models.

Installation

In Python examples, you need to import the requests library. The Node.js and cURL examples do not require any additional imports.

Install the library first:

pip install requests

Import the library in every Python code snippet where you make calls to the REST API.

Authorization

Our API authorization is based on a Bearer token. Include it in the Authorization HTTP header within the request. Example:

Request Example


OpenAI

The OpenAI SDK is a convenient library that simplifies working with our API. It automatically handles JSON responses, includes built-in error handling and retry logic, and provides simple, easy-to-use methods for all API features such as chat, embeddings, and completions.

chevron-rightThe AI features that the OpenAI SDK supportshashtag
  • Streaming

  • Completions

  • Chat Completions

  • Audio

  • Beta Assistants

  • Beta Threads

  • Embeddings

  • Image Generation

  • File Uploads

circle-info

Therefore, we don’t currently have the option to call video models or voice / speech models (STT and TTS) through this SDK.

Installation

chevron-rightPythonhashtag

1. Make sure you have Python 3.7+ and pip installed.

2. Install the OpenAI SDK via terminal or Jupyter Notebook:

In Jupyter Notebook, you can also use:

3. Import the SDK:


chevron-rightJavaScript (Node.js)hashtag

1. Make sure you have Node.js 18+ and npm installed.

2. Install the OpenAI SDK in your project:

3. Import the SDK and initialize the client:

Example Code


AI/ML API Python library

We have started developing our own SDK to simplify the use of our service. Currently, it supports only chat completion and embedding models.

circle-check

Installation

After obtaining your AIML API key, create an .env file and copy the required contents into it.

Copy the code below, paste it into your .env file, and set your API key in AIML_API_KEY="<YOUR_AIMLAPI_KEY>", replacing <YOUR_AIMLAPI_KEY> with your actual key:

Install aiml_api package:

Request Example

To execute the script, use:


Next Steps

Last updated

Was this helpful?