EN ▾
Get API key
Get API key

MiniMax API Integration Guide: Connect Your Tools

Updated

This minimax api integration guide shows the exact settings for connecting common tools to a hosted OpenAI-compatible endpoint. Change the base URL, add a key, set the model, and you are done.

Isometric hub connecting an editor, chat window, linked chain and terminal to one API endpoint

The four values every integration needs

If you searched for a minimax api integration guide, one clarification comes first: this site is not the official MiniMax API and is not run by MiniMax. It is a hosted, OpenAI-compatible endpoint for a single open-weight model, run by an independent provider and tuned to answer without content refusals for lawful adult use. If your tool can talk to an OpenAI-style server, it can talk to this one once you change a few settings.

Those settings are the same in every client, so it helps to see them once in one place.

SettingValue
Base URLhttps://api.minimaxapi.top/v1
Model IDuncensored
Auth headerAuthorization: Bearer <your key>
EndpointsPOST /v1/chat/completions and GET /v1/models

The rest of this page is variations on that table. Text goes in, text comes out. There is no image, audio or video generation, no embeddings and no fine-tuning, so a tool that needs those will not get them here. The context window is 100,000 tokens, counting the prompt and the completion together.

Get a key and send the first request

Sign up with Google or with an email and password, then open the API key page. New accounts can claim $0.50 of trial credit there with one click. It needs no card, lasts 7 days and is limited to one per person, which is enough to run every example in this article many times over.

Export the key as an environment variable and run a quick check before you touch any application settings. The first call lists models and confirms the key works. The second sends a real chat request.

curl https://api.minimaxapi.top/v1/models \
  -H "Authorization: Bearer $API_KEY"

curl https://api.minimaxapi.top/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "uncensored", "messages": [{"role": "user", "content": "Reply with the word ready."}]}'

If both calls return JSON, the key, the base URL and the model ID are correct. Every later problem is then in the client configuration, not in the account. Keeping this curl check around saves a lot of guessing when a tool shows only a vague connection error.

Python and Node with the OpenAI SDK

The official OpenAI SDKs accept a custom base URL, which is all the integration requires. In Python it is the base_url argument. Nothing else in your code changes: chat.completions.create, message roles, temperature, top_p, stop, seed and the penalty parameters keep their usual meaning.

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.minimaxapi.top/v1",
    api_key=os.environ["API_KEY"],
)

resp = client.chat.completions.create(
    model="uncensored",
    messages=[
        {"role": "system", "content": "You are a concise assistant."},
        {"role": "user", "content": "Give me three names for a fantasy tavern."},
    ],
    temperature=0.9,
)
print(resp.choices[0].message.content)

Streaming works through Server-Sent Events with stream: true, and usage figures arrive at the end of the stream. The Node version below prints tokens as they come in.

import OpenAI from "openai";

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

const stream = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Write a two-line poem about rain." }],
  stream: true,
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}

Note the optional chaining on delta?.content. Some chunks, such as the final one, carry no text, and reading them without a guard throws an error that looks unrelated to streaming.

LangChain

LangChain talks to any OpenAI-compatible server through the ChatOpenAI class in the langchain-openai package. Install it with pip install langchain-openai, then point it at the base URL and set the model to uncensored.

import os
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="uncensored",
    base_url="https://api.minimaxapi.top/v1",
    api_key=os.environ["API_KEY"],
    temperature=0.7,
)

reply = llm.invoke("Summarise the plot of Hamlet in two sentences.")
print(reply.content)

for part in llm.stream("Now do it in one sentence."):
    print(part.content, end="", flush=True)

Because the API supports tool calling, you can pass tools to the model with LangChain's usual binding helpers, and chains that rely on JSON output can use the JSON mode described in the API documentation. Treat tool use as something to test on your own prompts first. Open-weight models differ in how reliably they fill tool arguments, so keep tool schemas small and descriptions plain.

For agent loops, remember the concurrency cap. A graph that fans out into ten parallel model calls will hit the limit of 8 on a full key, or 2 on a trial key. Lower the fan-out in the graph config or add a semaphore as shown in the limits section below.

SillyTavern

SillyTavern can add an OpenAI-compatible endpoint, which makes it the most common front end for fiction and roleplay with this kind of model. The menu names shift a little between versions, but the path is stable.

  1. Open the plug icon (API connections) and set API to Chat Completion.
  2. Choose Custom (OpenAI-compatible) as the chat completion source.
  3. Paste https://api.minimaxapi.top/v1 into the custom endpoint field.
  4. Paste your key into the key field and press connect.
  5. Enter uncensored as the model ID if the list does not fill in on its own.

A green status means the connection works. After that, spend a minute on two settings. First, context size: the model accepts up to 100,000 tokens, but you pay for every input token on every message because the whole history is sent each time. A chat that has grown to 20,000 tokens costs 20,000 x $0.15 / 1M = $0.003 for input plus 300 output tokens at $0.50 / 1M = $0.00015, so $0.00315 for one reply. That is cheap, and it still adds up over a long session, so a smaller context with a summary is often the better trade.

Second, temperature. Values between 0.7 and 1.0 suit creative writing; drop it for structured tasks. Use these tools for fiction, roleplay and companion apps for adults. The service has one hard rule that no setting changes: no sexual content involving minors.

Cursor and other editors

Cursor lets you override the OpenAI base URL in its model settings. Open Settings, go to Models, switch on the OpenAI API key section, paste your key, enable the base URL override and enter the base URL above. Then add a custom model named uncensored and select it in chat.

Two cautions apply. Which editor features accept a custom endpoint depends on the editor version and plan, and features built on a vendor's own models, such as inline completion, may keep using that vendor. Check the editor's current documentation if a feature seems to ignore your setting. Also remember that this is a general chat model tuned for open answers, so for code review it will behave like a capable open-weight model, not like a specialised coding service.

Extensions such as Continue and Cline also include an OpenAI-compatible provider option. The pattern never changes: provider type OpenAI-compatible, the base URL, the key, the model ID uncensored.

Limits, retries and parallel calls

A full key allows 8 concurrent requests and 300 requests per minute. A trial key allows 2 and 60. Go over either and the API returns HTTP 429. The error code tells you which limit you hit: rate_limited means too many requests per minute, concurrency means too many at once. On temporary overload you also get a 429, with a Retry-After: 5 header.

One detail trips up streaming apps. A streamed request holds its concurrency slot until the stream ends, so a client that opens streams and never closes them will start seeing concurrency errors even at a low request rate. Always consume or cancel the stream.

import asyncio, os
from openai import AsyncOpenAI

client = AsyncOpenAI(
    base_url="https://api.minimaxapi.top/v1",
    api_key=os.environ["API_KEY"],
    max_retries=4,          # the SDK retries 429 responses with a delay
)
gate = asyncio.Semaphore(6)  # stay under the 8 concurrent requests of a full key

async def ask(prompt: str) -> str:
    async with gate:
        r = await client.chat.completions.create(
            model="uncensored",
            messages=[{"role": "user", "content": prompt}],
        )
        return r.choices[0].message.content

async def main():
    prompts = [f"Write a one-line tagline, variant {i}." for i in range(20)]
    results = await asyncio.gather(*(ask(p) for p in prompts))
    print(len(results), "done")

asyncio.run(main())

The SDK retry setting handles the brief 429 responses, and the semaphore keeps your own code under the cap. The response headers X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency show the limits for your key, and X-Balance-USD shows what is left. Log X-Request-Id if you ever need to ask support about a specific call at the documentation or support page.

Fixing common connection errors

SymptomLikely causeFix
Not found errorBase URL missing the /v1 suffix, or doubledUse the base URL exactly as listed above
Authentication errorKey pasted with spaces, or sent without the Bearer prefixRe-paste the key; SDKs add the prefix for you
Model not foundA default OpenAI model name is still selectedSet the model to uncensored
429 with concurrencyParallel or unclosed streamsAdd a semaphore, close streams
429 with rate_limitedOver 60 or 300 requests per minuteSlow the loop or retry with a delay
Body too largeRequest body over 8 MB, or prompt beyond 100,000 tokensTrim history or summarise older turns

When you are ready to move past the trial, the pricing page lists the top-up amounts and payment methods, and you can compare the model's per-token rates in the cost analysis.

Questions and answers

Is this the official MiniMax API?

No. It is an independent, OpenAI-compatible endpoint for one open-weight model. It is not run by MiniMax or any other model vendor.

Do I need a special SDK?

No. Any OpenAI SDK or OpenAI-compatible client works after you change the base URL and the key, and set the model to uncensored.

Which model ID should I use in my tool?

Use uncensored. You can confirm it by calling GET /v1/models with your key.

Does streaming and tool calling work in these tools?

The API supports streaming over SSE and tool calling. Whether a given client uses them depends on the client, so test with a short prompt first.

Your key is one form away

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