Open account
mistralbaseurl.com

API Documentation

Drop your existing OpenAI-compatible code into our endpoint. This guide shows how to connect, authenticate, and stream responses with zero configuration overhead.

Authentication & Base URL

Start by pointing your client to the correct base URL. We accept standard OpenAI headers for compatibility. Your API key goes in the Authorization header as a bearer token. Pass it directly from your environment variables to avoid hardcoding secrets. This setup works with any library that supports the OpenAI protocol.

First Request

Send a simple chat completion to verify connectivity. Use the model ID "uncensored" for text generation. The endpoint returns standard JSON with choices and usage metrics. If you get a 401, check your key format. A 402 indicates insufficient prepaid balance. This quick test confirms your integration is ready for production traffic.

curl https://api.mistralbaseurl.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "List installed python packages with versions"}]
  }'

Python SDK Integration

Configure the OpenAI Python package to use our base URL. Set the API key and model name explicitly. Pass your messages as a list of dictionaries with role and content keys. The response object contains the generated text in choices[0].message.content. Handle exceptions gracefully to catch network or rate limit errors during execution.

from openai import OpenAI

client = OpenAI(base_url="https://api.mistralbaseurl.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 SDK Setup

Initialize the OpenAI client with your base URL and key. Define the messages array with user and assistant roles. Call chat.completions.create with the uncensored model. The response provides the generated text in the first choice. Use this pattern for both synchronous and asynchronous calls in your Node applications.

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.mistralbaseurl.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 Responses

Enable streaming by setting stream to true. The API sends chunks of data as they are generated. Each chunk contains delta text that you can append to a buffer. This approach reduces perceived latency for long outputs. Monitor token usage in the final chunk to track billing accurately.

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)

Limits & Context Window

Your account supports a 100,000 token context window. Max output is 16,000 tokens per request. You can send 300 requests per minute. Only 8 requests run simultaneously. Requests over 8MB body size will fail. Use these limits to design your retry logic. Errors like 429 indicate rate limit hits. Refusals do not consume credits.

Common questions

What is the mistral base URL for this API?

Use HTTPS://api.mistralbaseurl.com/v1 as your base URL. It works with any OpenAI-compatible SDK. Point your client there and set the model to uncensored.

How do I handle 429 rate limit errors?

You get a 429 when exceeding 300 requests per minute. Implement exponential backoff in your client. Retry after the delay period specified in the retry-after header.

Does the uncensored model support streaming?

Yes, set stream to true in your request. The API sends Server-Sent Events with token deltas. Parse these chunks to update your UI in real time without waiting for full completion.

Get your API key now

Sign up, grab your key, update your base URL. That is all.