Setting Up

Generating an API Key

To use the AI/ML API, you need to create an account and generate an API key. Follow these steps:

  1. Create an Account: Visit the AI/ML API website and create an account.

  2. Generate an API Key: After logging in, navigate to your account dashboard and generate your API key.

Configure Base URL

Set the base URL for API requests as follows:

Making Your First API Call

Example in Python

import openai

system_content = "You are a travel agent. Be descriptive and helpful."
user_content = "Tell me about San Francisco"

client = openai.OpenAI(

chat_completion =
        {"role": "system", "content": system_content},
        {"role": "user", "content": user_content},

response = chat_completion.choices[0].message.content
print("AI/ML API:\n", response)

Example in Node.js

const { OpenAI } = require("openai");

const openai = new OpenAI({
  apiKey: "your_api_key_here",
  baseURL: "",

(async () => {
  const chatCompletion = await{
    model: "mistralai/Mistral-7B-Instruct-v0.2",
    messages: [
      { role: "system", content: "You are a travel agent. Be descriptive and helpful" },
      { role: "user", content: "Tell me about San Francisco" }
    temperature: 0.7,
    max_tokens: 128,
  console.log("AI/ML API:\n", chatCompletion.choices[0].message.content);

Versioned URLs

The AI/ML API supports both versioned and non-versioned URLs, providing flexibility in your API requests. You can use either of the following formats:

Non-versioned URL:

Versioned URL:

Using versioned URLs can help ensure compatibility with future updates and changes to the API. It is recommended to use versioned URLs for long-term projects to maintain stability.

Last updated