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
Metadata
Release files for aiml-api 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| aiml_api-0.1.4.tar.gz | 3.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aiml_api-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.9 kB
Release files / aiml_api-0.1.4.tar.gz
| Download URL | aiml_api-0.1.4.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f5577341ab6a91297050b20e55013307bcc58336671d1f5a9b475cc37c70a7e
|
|
BLAKE2b-256 checksum How to use checksums |
087ee60baccfa42c1e9449ba04f8afa55c06dea36b9b9b06d06bf10d9f689e20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / aiml_api-0.1.4-py3-none-any.whl
| Download URL | aiml_api-0.1.4-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c4dcb716697366f4438a1b34935e0da46d2e7be6dd67e9449f4ec570401cc084
|
|
BLAKE2b-256 checksum How to use checksums |
86366e98d77df4352241f3c75e01fcc7a1092eb4e6bba6681baac0cfa8983395
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Security for aiml-api 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.