Skip to main content

AI/ML API integrations

还没翻译译自英文(docs.langchain.com)本页 10 段都还没译

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