Skip to main content
These docs will be deprecated and no longer maintained with the release of LangChain v1.0 in October 2025. Visit the v1.0 alpha docs

ChatPrem

Setup

  1. Create a Prem AI account and get your API key here.
  2. Export or set your API key inline. The ChatPrem class defaults to process.env.PREM_API_KEY.
export PREM_API_KEY=your-api-key

You can use models provided by Prem AI as follows:

  • npm
  • Yarn
  • pnpm
npm install @langchain/community @langchain/core
import { ChatPrem } from "@langchain/community/chat_models/premai";
import { HumanMessage } from "@langchain/core/messages";

const model = new ChatPrem({
// In Node.js defaults to process.env.PREM_API_KEY
apiKey: "YOUR-API-KEY",
// In Node.js defaults to process.env.PREM_PROJECT_ID
project_id: "YOUR-PROJECT_ID",
});

console.log(await model.invoke([new HumanMessage("Hello there!")]));

API Reference:


Was this page helpful?


You can also leave detailed feedback on GitHub.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.