AI/ML API provides a single API for accessing 300+ hosted foundation models (DeepSeek, Gemini, GPT, and more) with enterprise-grade uptime and throughput.

Installation and setup

  • Install the AI/ML API integration package.
    pip install langchain-aimlapi
    
  • Create an account at aimlapi.com and generate an API key.
  • Authenticate by setting the AIMLAPI_API_KEY environment variable.
import os

os.environ["AIMLAPI_API_KEY"] = "aimlapi_..."

Chat models

See a usage example.
from langchain_aimlapi import ChatAimlapi

LLMs

See a usage example.
from langchain_aimlapi import AimlapiLLM

Embedding models

See a usage example.
from langchain_aimlapi import AimlapiEmbeddings