ru ▾

MiniMax api: Quickstart Guide

Drop in our uncensored LLM API using standard OpenAI SDKs with a single base_url change. This guide covers authentication, request syntax, and streaming for developers who want raw capability without corporate refusals.

Install the official OpenAI SDK

Install the client library compatible with your language environment to begin using our uncensored AI models. This ensures your code follows the standard conventions for OpenAI-compatible API interactions.

  • For Python, run pip install openai.
  • For Node.js, run npm install openai.

These libraries handle the HTTP negotiation automatically, allowing you to focus on your prompt logic.

Set your base_url to HTTPS://api.apiminimax.com/v1

Configure the base URL to point directly to our hosted endpoint so your requests reach our uncensored model. This single line change redirects traffic from the standard provider to our infrastructure.

Python: Pass base_url="https://api.apiminimax.com/v1" when initializing the client. Node.js: Set the same URL in the client configuration object.

This ensures all subsequent calls, including model inference and authentication checks, route correctly to our servers without requiring custom headers.

Configure your API key for authentication

Authenticate requests by passing your unique key generated from the Get API key page. Our system validates this key against the account balance before processing any tokens.

Python: Set api_key="your_key_here". Node.js: Set apiKey="your_key_here". HTTP: Add Authorization: Bearer your_key_here to headers.

Keep this value secure in your environment variables. A missing or invalid key triggers a 401 error immediately.

Send a request to POST /v1/chat/completions

Send your first prompt to the uncensored model to verify connectivity and response quality. This standard endpoint handles text generation with full support for modern parameters.

  • Set model to "uncensored".
  • Include a messages array with your prompt.

Ensure the request body stays under 8 MB. Exceeding this limit or using an expired key will halt the request before token counting begins.

Handle streaming responses via SSE

Enable streaming by setting stream=true to receive tokens sequentially instead of waiting for the full completion. This reduces perceived latency significantly for long outputs.

The final chunk contains the total token usage for billing purposes. Errors during streaming still reflect the tokens processed up to the failure point, ensuring accurate billing for partial generation.

Use function calling and JSON mode

Structure your requests using tools for function calling or response_format for strict JSON output. Our uncensored model supports these features reliably for coding and data extraction tasks.

Set temperature and top_p to control creativity. The model accepts standard parameters like stop sequences and seed for reproducibility. No embeddings or fine-tuning endpoints are available in this API.

Check available models with GET /v1/models

Query the GET /v1/models endpoint to verify the uncensored model ID and current availability. This returns a list of supported models, confirming your authentication is valid.

Our context window allows 100,000 tokens for prompt and completion combined. Max output is 16,000 tokens per request, or 2,048 if max_tokens is unset.

cURL

curl https://api.apiminimax.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "List the top 5 linux kernel versions"}]
  }'

Python

from openai import OpenAI

client = OpenAI(base_url="https://api.apiminimax.com/v1", api_key="YOUR_KEY")

resp = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)

Node.js

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.apiminimax.com/v1", apiKey: process.env.API_KEY });

const resp = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);

Streaming

stream = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Tell the story in second person."}],
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

Common questions

How do I handle 401, 402, and 429 errors?

A 401 error indicates an invalid or missing API key. A 402 error means your prepaid credit is exhausted; top up via crypto to continue. A 429 error occurs if you exceed 300 requests per minute or 8 simultaneous requests per key.

Does the MiniMax API support image or video generation?

No, this API serves only the uncensored large language model via <code>POST /v1/chat/completions</code>. It does not support image, audio, or video generation endpoints. Use the standard text endpoints for all interactions.

Is the MiniMax uncensored coding AI reliable for structured data?

Yes, use <code>response_format: {"type": "json_object"}</code> for strict JSON output. The model handles complex coding tasks without the refusals common in other models, making it ideal for automated data extraction pipelines.

Get your key in seconds

Register, copy the token, update your base URL. Done.

Claim trial key

No subscriptions. Credits do not expire.