Free, Unlimited MiniMax API
On this page
This tutorial will show you how to use Puter.js to access MiniMax models, including MiniMax M2.1, MiniMax M2, MiniMax M1, and MiniMax 01 completely free, without any API keys.
Puter.js uses the User-Pays model, where users of your application cover their own AI costs. This means you as a developer don't pay anything for your users' usage, making your app practically free to run. You can scale to unlimited users and pay nothing for the AI or server usage.
Getting Started
You can use Puter.js without any API keys or sign-ups. To start using Puter.js, include the following script tag in your HTML file, either in the <head> or <body> section:
<script src="https://js.puter.com/v2/"></script>
Nothing else is required to start using Puter.js for free access to MiniMax models and capabilities.
Example 1: Code generation with MiniMax M2.1
MiniMax M2.1 excels in code generation tasks. Here's how to use it for writing code:
<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<script>
puter.ai.chat(
"Write a Python function that implements a binary search tree with insert and search methods",
{ model: "openrouter:minimax/minimax-m2.1" }
)
.then(response => {
puter.print(response, {code: true});
});
</script>
</body>
</html>
Example 2: Long context processing with MiniMax M1
MiniMax M1 is optimized for handling long contexts. Use streaming for better performance with longer inputs:
async function streamLongContext() {
const longText = `Your long document or context here...`;
const response = await puter.ai.chat(
`Analyze and summarize the following document: ${longText}`,
{ model: "openrouter:minimax/minimax-m1", stream: true }
);
for await (const part of response) {
puter.print(part?.text);
}
}
streamLongContext();
Full code example:
<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<script>
async function streamLongContext() {
const response = await puter.ai.chat(
"Explain the history of artificial intelligence in detail, covering its origins, major milestones, key figures, and future prospects",
{ model: "openrouter:minimax/minimax-m1", stream: true }
);
for await (const part of response) {
puter.print(part?.text);
}
}
streamLongContext();
</script>
</body>
</html>
List of supported models
The following MiniMax models are supported by Puter.js:
openrouter:minimax/minimax-m2.1
openrouter:minimax/minimax-m2
openrouter:minimax/minimax-m1
openrouter:minimax/minimax-01
Conclusion
Using Puter.js, you can gain access to MiniMax models without having to set up the AI server yourself. And thanks to the User-Pays model, your users cover their own AI usage, not you as the developer. This means you can build powerful applications without worrying about AI usage costs.
You can find all AI features supported by Puter.js in the documentation.
Related
Free, Serverless AI and Cloud
Start creating powerful web applications with Puter.js in seconds!
Get Started Now