MiniMax API: First request in five minutes

Get your first uncensored text generation running in minutes. This guide covers the base URL, authentication, and SDK setup for our OpenAI-compatible API.

https://api.minimaxapikey.com/v1uncensored

Install the OpenAI SDK

Start by installing the official OpenAI SDK for your preferred language. The library handles request formatting and streaming automatically. Ensure you have Python 3.8+ or Node.js 18+ installed. Run pip install openai for Python or npm install openai for Node. The SDK simplifies interaction with the /v1/chat/completions endpoint. It manages headers, retries, and SSE parsing so you can focus on the prompt. This works because our API follows the OpenAI chat completions standard. You do not need a custom client library. Standard SDK methods map directly to our endpoints. This reduces integration time and leverages existing developer knowledge.

Configure Your Base URL & Key

Set your API key and base URL in your environment variables. Our base URL is https://api.minimaxapikey.com/v1. This allows you to use standard OpenAI clients without modification. Create an account to generate your key. The key is shown immediately after signup. No card is needed for the trial. Store the key securely. Pass it as a header or environment variable. The SDK uses OPENAI_API_KEY by default. You can override the base URL to point to our servers. This ensures all requests go to the uncensored model. Verify your key works with a simple ping. This step prevents authentication errors later.

Send a Basic Chat Completion

Make your first request to generate text. Use the POST method on /v1/chat/completions. Specify the model as uncensored. Pass a message array with a user prompt. The API returns a completion token. This is the core text generation feature. It supports 64k context window. You can send long prompts or conversation history. The response includes the generated text and token usage. This is ideal for creative writing or unrestricted dialogue. Ensure the content is lawful. The model does not refuse adult topics. It only blocks sexual content involving minors. Start simple to verify connectivity.

Enable Streaming (SSE)

For real-time output, enable streaming. Set the stream parameter to true. The API returns Server-Sent Events (SSE). Each chunk contains part of the response. This reduces perceived latency. Users see text appear as it is generated. The SDK handles chunk parsing automatically. You can display text incrementally in a UI. This is crucial for chat interfaces. Streaming works with all model responses. It does not affect token counting. Each chunk includes usage data at the end. Use this for better user experience. It feels more responsive than waiting for the full response. Configure your client to buffer chunks correctly.

Use Tool/Function Calling

Support structured outputs with function calling. Define tools in the request body. The model can call functions based on the prompt. This enables integration with external systems. Pass tool definitions and user messages. The response includes a tool call object. Execute the function and feed results back. This works with standard OpenAI SDKs. It allows complex workflows. You can build agents or assistants. The model maintains context across calls. This is powerful for automation. Ensure your tool definitions are precise. The API handles the routing of tool outputs. It keeps the conversation coherent. Use this for dynamic content generation.

Check Available Models

Verify the model list via GET /v1/models. This endpoint returns available models. Our API serves one model: uncensored. It is an open-weight model. It is not GPT, Claude, or Gemini. The response confirms the model ID. Use this to debug client configurations. Ensure your code targets the correct model. The endpoint is fast and reliable. It returns JSON data. You can parse this for UI displays. It confirms your API key is valid. Use this for automated health checks. It is part of the standard OpenAI spec. No extra configuration is needed. This ensures compatibility with existing tools.

cURL

curl https://api.minimaxapikey.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Write a blunt product review of a cheap VPN."}]
  }'

Python

from openai import OpenAI

client = OpenAI(base_url="https://api.minimaxapikey.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.minimaxapikey.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)

API facts in one table

If your tool speaks the OpenAI API, these are the details that matter.

ItemValue
ProtocolOpenAI-compatible: any OpenAI SDK or client works — change the base URL and the key
Model IDuncensored
Base URLhttps://api.minimaxapikey.com/v1
MethodsPOST /v1/chat/completions · GET /v1/models
API keyBearer token in the Authorization header
Sampling parameterstemperature, top_p, stop, seed and the two penalties are passed through
Structured outputJSON object mode via response_format json_object
Max context64,000 tokens (prompt + completion together)
StreamingSupported (stream: true), usage included at the end
Function callingYes — tools, tool_choice; replies carry tool_calls, also when streaming; send results back as role: tool
Max output16,000 tokens max; 2,048 if max_tokens is not set
Concurrency8 requests at the same time per key
HeadersX-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency
Requests per minute300 requests per minute per key
Request sizeup to 8 MB per request
Billingprepaid credit, charged by real token usage; errors and refusals are free
Credit expirypaid credit never expires, no subscription
Trial credit$0.50 for 7 days, no card
Token prices$0.25 per 1M input tokens · $1.00 per 1M output tokens
Volume bonus+5% from $50, +10% from $100
Top-upcrypto: USDT on TRON or USDC on Base, $10–$500, any whole sum
AccountGoogle or e-mail and password
Keysone key per account, regenerate any time (the old one stops working)
Contentuncensored for adults; the only hard rule: no sexual content involving minors

Error codes

Errors come back as JSON with a stable type; failed and refused requests are not billed.

CodeTypeMeaning
400bad_requestmalformed request or too long for the context window
401missing_key · invalid_key · key_revokedno key, wrong key, or a key replaced by a newer one
402no_creditbalance is empty — top up, requests resume at once
403content_blockedrefused by the content policy
404not_foundonly /v1/chat/completions and /v1/models exist
413request_too_largerequest body larger than 8 MB
429rate_limited · concurrencyover 300/min or 8 parallel — back off and retry
503upstream_busytemporary overload, retry shortly

Questions and answers

What happens if I exceed the rate limit?

You will receive a 429 error. The limit is 300 requests per minute per key. Pause and retry after the window resets. You can regenerate your key to get a new one if needed.

Why do I get a 401 error?

Your API key is invalid or missing. Check that you copied the key correctly. Ensure the base URL is set to our endpoint. Keys are shown immediately after signup.

How does pricing work?

Pay-as-you-go prepaid credit. $0.25 per 1M input tokens, $1.00 per 1M output tokens. No monthly fees. Credit never expires. Top-ups start at $10.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.

Get API key