Quickstart
Make a first request to any model with the OpenAI SDK, Python requests or curl: base URL https://api.aimlapi.com/v1, header Authorization: Bearer <AIMLAPI_KEY>.
Here, you'll learn how to start using our API in your code. The following steps must be completed regardless of which of our models you plan to call:
Let's walk through an example of connecting to the Gemma 3 model via REST API.
Generating an AIML API Key
To use the AIML API, you need an account and at least one AIML API key. If you have not created them yet, follow these steps:
Create an Account: Visit the AI/ML API website and create an account.
Generate an API Key: After logging in, navigate to your account dashboard and generate your API key. Ensure that key is enabled on UI.

Detailed instructions for managing your API keys in the dashboard can be found in the corresponding Help Center article.
Choosing the Development Environment
Each language has recommended environments for running code samples.
cURL
Python
Jupyter Notebook is a popular online environment for running Python code and is the fastest option if you do not want to install anything locally.
Visual Studio Code (VS Code) is a lightweight and widely used code editor that supports both Python and Node.js. It is suitable for running and debugging local examples and for working on real projects.
JavaScript
Visual Studio Code (VS Code)
Making an API Call
Based on your environment, you will call our API differently. Below are three common ways to call our API using two popular languages: cURL (a command-line format for making HTTP requests rather than a programming language), Python, and JavaScript (NodeJS).
If you want to get started really quickly, choose one of the four expandable sections below. Each one contains instructions for calling our model using different tools and environments. The first two options are especially simple and suitable even for beginners.
For completeness, the same example is explained in detail in the Code Step-by-Step section.
Code Step-by-Step
Below is a step-by-step explanation of the same API call in three variants: cURL, JavaScript, and Python. All three examples send an identical request to the google/gemma-3-4b-it chat model.
Future Steps
Last updated
Was this helpful?






