Skip to main content

AI/ML API library for a simple and seamless connection to AI/ML services.

Project description

AI/ML API Python library

The AI/ML Python library provides convenient access to the AI/ML API.
(Currently, only chat completion and embeddings are supported. If you'd like to help improve this library, feel free to join our Discord)

Documentation

Getting started with the AI/ML API is simple. Follow these steps to set up your integration:

1. Get Your API Key

To begin, you need an API key. You can obtain yours here:
🔑 Get Your API Key

2. Explore Available Models

Looking for a different model? Browse the full list of supported models:
📚 Full List of Models

3. Read the Documentation

For detailed setup instructions and usage guidelines, refer to the official documentation. If you’d like to get started quickly, check out our examples below.

And don’t forget the first step—you’ll need an API key! ^^
📖 AI/ML API Docs

4. Need Help?

If you have any questions, feel free to reach out. We’re happy to assist! 🚀 Discord

Installation

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

touch .env

Then, copy the code below, paste it into your .env file, and set your API key to AIML_API_KEY="".

AIML_API_KEY = ""
AIML_API_URL = "https://api.aimlapi.com/v1"

Install aiml_api package

# install from PyPI
pip install aiml_api

Usage

from aiml_api import AIML_API

api = AIML_API()

completion = api.chat.completions.create(
    model="mistralai/Mistral-7B-Instruct-v0.2",
    messages=[
        {"role": "user", "content": "Explain the importance of low-latency LLMs"},
    ],
    temperature=0.7,
    max_tokens=256,
)

response = completion.choices[0].message.content
print("AI:", response)

Running the Script

To execute the script, use:

python3 <your_script_name>.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiml_api-0.1.4.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiml_api-0.1.4-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file aiml_api-0.1.4.tar.gz.

File metadata

  • Download URL: aiml_api-0.1.4.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for aiml_api-0.1.4.tar.gz
Algorithm Hash digest
SHA256 9f5577341ab6a91297050b20e55013307bcc58336671d1f5a9b475cc37c70a7e
MD5 337862be7614882c83fbaac1b8ffd9d5
BLAKE2b-256 087ee60baccfa42c1e9449ba04f8afa55c06dea36b9b9b06d06bf10d9f689e20

See more details on using hashes here.

File details

Details for the file aiml_api-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: aiml_api-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for aiml_api-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c4dcb716697366f4438a1b34935e0da46d2e7be6dd67e9449f4ec570401cc084
MD5 dabacaa71713f3a7703164576e345b72
BLAKE2b-256 86366e98d77df4352241f3c75e01fcc7a1092eb4e6bba6681baac0cfa8983395

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page