An integration package connecting Aimlapi and LangChain
Project description
langchain-aimlapi
This package contains the LangChain integration with Aimlapi. AI/ML API provides over 300 models including Deepseek, Gemini and ChatGPT. All models are served with enterprise-grade rate limits and uptimes via Aimlapi.
Installation
pip install -U langchain-aimlapi
Configure credentials by setting the environment variable:
AIMLAPI_API_KEY– your AI/ML API key
Available modules
The package exports the following classes:
ChatAimlapi– chat completion modelAimlapiLLM– text completion modelAimlapiEmbeddings– embeddingsAimlapiImageModel– image generationAimlapiVideoModel– video generationAIMLAPI_HEADERS– default request headers
All classes provide both synchronous and asynchronous APIs. See the docs/ folder for complete examples.
Chat Models
ChatAimlapi class exposes chat models from Aimlapi.
from langchain_aimlapi import ChatAimlapi
llm = ChatAimlapi()
llm.invoke("Sing a ballad of LangChain.")
Embeddings
AimlapiEmbeddings class exposes embeddings from Aimlapi.
from langchain_aimlapi import AimlapiEmbeddings
embeddings = AimlapiEmbeddings()
embeddings.embed_query("What is the meaning of life?")
LLMs
AimlapiLLM class exposes LLMs from Aimlapi.
from langchain_aimlapi import AimlapiLLM
llm = AimlapiLLM()
llm.invoke("The meaning of life is")
Image Generation
AimlapiImageModel generates images from prompts.
from langchain_aimlapi import AimlapiImageModel
img = AimlapiImageModel(
model="stable-diffusion-v3-medium",
size="512x512",
n=1,
)
img.invoke("A serene mountain lake at sunset")
Video Generation
AimlapiVideoModel generates short videos from prompts.
from langchain_aimlapi import AimlapiVideoModel
vid = AimlapiVideoModel(
model="veo2",
)
vid.invoke("A timelapse of city lights at night")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_aimlapi-0.1.0.tar.gz.
File metadata
- Download URL: langchain_aimlapi-0.1.0.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.9 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc87dcefd6512466a7fa16a6d5ce372de98337e68c3a38f97d4c03da3d9d4212
|
|
| MD5 |
b4e3cd8b43aeb84a51704da59dc7226a
|
|
| BLAKE2b-256 |
275e88c2e6a9183222d04c5120c13e4a6d11ae0238bfd9d0d2565fb8b8420fd7
|
File details
Details for the file langchain_aimlapi-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_aimlapi-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.9 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a2f59838dd7275c03248270418b62208063c9a46e9de6763da8e50b3ed73da3
|
|
| MD5 |
e2eaf7d349e94c67b775e0a5ef05c730
|
|
| BLAKE2b-256 |
1da3f725551a1ca19046f746ea72d8092b560db5f221df0f553c46135f2d309d
|