Tutorials
Free, Unlimited MiniMax API
This tutorial will show you how to use Puter.js to access MiniMax models, including MiniMax M2, MiniMax M1, and MiniMax 01 completely free, without any API keys or usage restrictions.
Puter is the pioneer of the "User-Pays" model, which allows developers to add AI capabilities to their applications with each user covering their own usage costs. This model enables developers to access advanced AI capabilities without any API keys or server-side setup.
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 1Code generation with MiniMax M2
MiniMax M2 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" }
)
.then(response => {
puter.print(response, {code: true});
});
</script>
</body>
</html>
Example 2Long 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
openrouter:minimax/minimax-m2:free
openrouter:minimax/minimax-m1
openrouter:minimax/minimax-01
That's it! You now have a free alternative to the MiniMax API using Puter.js. This allows you to access MiniMax M2, MiniMax M1, and MiniMax 01 capabilities without needing an API key or backend. True serverless AI!
Related
Free, Serverless AI and Cloud
Start creating powerful web applications with Puter.js in seconds!
Get Started Now