Skip to content

aimlapi/langchain-aimlapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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")

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors