Skip to main content


Minimax is a Chinese startup that provides natural language processing models for companies and individuals.

This example demonstrates using Langchain to interact with Minimax.


To run this notebook, you'll need a Minimax account, an API key, and a Group ID

Single model call

from langchain_community.llms import Minimax
API Reference:Minimax
# Load the model
minimax = Minimax(minimax_api_key="YOUR_API_KEY", minimax_group_id="YOUR_GROUP_ID")
# Prompt the model
minimax("What is the difference between panda and bear?")

Chained model calls

# get api_key and group_id:

import os

os.environ["MINIMAX_API_KEY"] = "YOUR_API_KEY"
from langchain.chains import LLMChain
from langchain_community.llms import Minimax
from langchain_core.prompts import PromptTemplate
API Reference:LLMChain | Minimax | PromptTemplate
template = """Question: {question}

Answer: Let's think step by step."""

prompt = PromptTemplate.from_template(template)
llm = Minimax()
llm_chain = LLMChain(prompt=prompt, llm=llm)
question = "What NBA team won the Championship in the year Jay Zhou was born?"

Was this page helpful?

You can also leave detailed feedback on GitHub.