Metadata-Version: 2.3
Name: langchain-aimlapi
Version: 0.1.0
Summary: An integration package connecting Aimlapi and LangChain
License: MIT
Author: Dmitry Tumanov
Author-email: d1m7asis@gmail.com
Requires-Python: >=3.9,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: aiohttp (>=3.9.1,<4.0.0)
Requires-Dist: langchain-core (>=0.3.15,<0.4.0)
Requires-Dist: langchain-openai (>=0.3,<0.4)
Requires-Dist: requests (>=2,<3)
Project-URL: Repository, https://github.com/langchain-ai/langchain
Project-URL: Release Notes, https://github.com/langchain-ai/langchain/releases?q=tag%3A%22aimlapi%3D%3D0%22&expanded=true
Project-URL: Source Code, https://github.com/langchain-ai/langchain/tree/master/libs/partners/aimlapi
Description-Content-Type: text/markdown

# 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](https://aimlapi.com/app/?utm_source=langchain&utm_medium=github&utm_campaign=integration).

## Installation

```bash
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.

```python
from langchain_aimlapi import ChatAimlapi

llm = ChatAimlapi()
llm.invoke("Sing a ballad of LangChain.")
```

## Embeddings

`AimlapiEmbeddings` class exposes embeddings from Aimlapi.

```python
from langchain_aimlapi import AimlapiEmbeddings

embeddings = AimlapiEmbeddings()
embeddings.embed_query("What is the meaning of life?")
```

## LLMs
`AimlapiLLM` class exposes LLMs from Aimlapi.

```python
from langchain_aimlapi import AimlapiLLM

llm = AimlapiLLM()
llm.invoke("The meaning of life is")
```

## Image Generation

`AimlapiImageModel` generates images from prompts.

```python
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.

```python
from langchain_aimlapi import AimlapiVideoModel

vid = AimlapiVideoModel(
    model="veo2",
)
vid.invoke("A timelapse of city lights at night")
```

