Skip to main content

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 model
  • AimlapiLLM – text completion model
  • AimlapiEmbeddings – embeddings
  • AimlapiImageModel – image generation
  • AimlapiVideoModel – video generation
  • AIMLAPI_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")

Download files

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

Source Distribution

langchain_aimlapi-0.1.1.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

langchain_aimlapi-0.1.1-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file langchain_aimlapi-0.1.1.tar.gz.

File metadata

  • Download URL: langchain_aimlapi-0.1.1.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for langchain_aimlapi-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8e5087f3744e6b580bcdb5971026ab2b94401c64b1d2f277b0d920bca465751b
MD5 f71e13cb2faab27b035ff2ceda7cd060
BLAKE2b-256 fde640620ade834601bb3de8e5a7fbb4296fb05e21925fb3c80ffb6bae76250c

See more details on using hashes here.

File details

Details for the file langchain_aimlapi-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_aimlapi-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a1290acad770704aeba32d1ecae8130b33e6aff440c4d8073da0d38d3c80edf4
MD5 2824800d4da6887cccdd9ee432b86f1c
BLAKE2b-256 4a8269c363e31ae84bb674ea848b689296fcb523411e9959c642f09fbc81e1f8

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.2

2 files

This release

0.1.1 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page