Ship a Full-Stack App with One Prompt

Copy this prompt into your AI coding agent, or open it in one below.

Give this to your AI Create a to-do list app using Puter.js

Coding manually? see the guide

Tutorials

How to Get a MiniMax API Key: A Step-by-Step Guide

On this page

This guide shows you how to get a MiniMax API key. You'll create a MiniMax account, generate your key, and make your first API call, plus a free alternative for adding MiniMax models to your web app.

Prerequisites

  • An email address
  • A payment method — MiniMax's API is usage-based
  • Basic familiarity with code (we'll show simple JavaScript examples)

Step 1: Create Your MiniMax Account

Go to platform.minimax.io. You'll land on the developer platform page.

MiniMax developer platform page

Click Console in the top right to reach the sign-up page.

Sign up with your email. Once you're in, you'll land on the dashboard.

MiniMax platform sign-up page MiniMax API platform dashboard

Step 2: Generate Your API Key

In the left sidebar, click Access, then click Create new API key.

MiniMax API keys page

Give your key a descriptive name like my-app-dev so you can identify it later, then confirm.

MiniMax create new API key dialog

Store it somewhere safe — a password manager, an .env file, or your platform's secrets manager. Never commit API keys to a public repository.

MiniMax API key revealed with copy button

Step 3: Make Your First API Call

MiniMax uses an OpenAI-compatible API, so you can use the OpenAI SDK directly. Install it first:

npm install openai

Then make your first call:

import OpenAI from "openai";

const openai = new OpenAI({
  baseURL: "https://api.minimax.io/v1",
  apiKey: process.env.MINIMAX_API_KEY,
});

const completion = await openai.chat.completions.create({
  model: "minimax-m3",
  messages: [{ role: "user", content: "Hello, world!" }],
});

console.log(completion.choices[0].message.content);

If you get a response back, everything is working. For the full set of endpoints and parameters, see MiniMax's official API docs.

Can You Use the MiniMax API for Free?

Creating an API key is free, but using it requires topping up credits. MiniMax's own API is pay-as-you-go and bills per token.

New accounts receive trial credits at signup, tied to phone or email verification. The exact amount shifts with promotions, so check your dashboard after activating the account rather than counting on a set figure. Past that, the API bills per token.

Puter.js offers a different model. With its User-Pays model, you can add MiniMax models to your app for free: each user covers their own AI usage through their own Puter account, so your cost stays at $0 regardless of how many users you have, with no API key and no backend.

Add MiniMax models with the browser script tag:

<script src="https://js.puter.com/v2/"></script>
<script>
  puter.ai.chat("Explain quantum computing in simple terms", {
    model: "minimax/minimax-m3"
  }).then(response => {
    document.body.innerHTML = response.message.content;
  });
</script>

or the npm package:

import { puter } from '@heyputer/puter.js';

const response = await puter.ai.chat("Explain quantum computing in simple terms", {
  model: "minimax/minimax-m3"
});
console.log(response.message.content);

This fits front-end apps where your users sign into Puter: usage is tied to their accounts, and Puter.js runs in the browser, so it does not replace a server-side key for a backend you control. For a backend, you can use the prepaid route below.

How Much Does the MiniMax API Cost?

MiniMax bills per token, with separate input and output rates, so cost scales with usage instead of a flat fee. The flagship text model, MiniMax-M3, is $0.30 per 1M input tokens and $1.20 per 1M output on the standard tier with inputs up to 512k tokens. That is also the cheapest text rate: every model in the M-series, from M2 up to M3, shares the same $0.30/$1.20 at the standard tier, with the version number changing capability rather than price.

For the full breakdown, including the highspeed and Priority tier multipliers, prompt caching, and the speech, video, music, and image meters, see our MiniMax API pricing guide.

Why Isn't My Key Working?

MiniMax returns these in the response body as base_resp.status_code. Most first-call failures trace back to a few of them:

  • 1004, not authorized: the key is wrong, was revoked, or picked up a stray space or newline when copied. Regenerate it and paste again.
  • 2049, invalid API Key: the key string itself is malformed or does not match an active key, so check you copied the full value.
  • 1008, insufficient balance: the account has no credits. Top up in the dashboard, then retry.
  • 1002, rate limit: requests are going out faster than your tier allows. Add retries with exponential backoff, or slow the request rate.
  • 1039, token limit: the request exceeded the model's token quota, so trim the prompt or lower max_tokens.

Most of these come back to billing or a mistyped key, so check those first. For the full list of status codes, see MiniMax's error codes reference.

Conclusion

To get a MiniMax API key: sign up at platform.minimax.io, add a payment method, then go to Access and click Create new API key. From there you can make your first API call, or skip the key entirely and add MiniMax models to a web app for free with Puter.js.

Ship a Full-Stack App with One Prompt

Give this to your AI Build an AI chat app using Puter.js

Coding manually? see the guide