Mistral API Setup: Switch to an OpenAI-Compatible API
A mistral api setup for this endpoint takes three changes: the base URL, the key and the model ID. This guide shows the swap in Python, Node and curl, and what to check when something returns an error.

Key points
- Set the base URL to https://api.mistraluncensored.com/v1 and use the model ID uncensored.
- Any OpenAI SDK works, so the official mistralai client is not needed.
- Check the connection with GET /v1/models before you change application code.
- A 429 means a limit: rate_limited, concurrency, or a short overload with Retry-After.
What changes when you switch
If you already have code that sends chat messages to a hosted model, a mistral api setup against this service is mostly a configuration edit. The endpoint speaks the OpenAI chat completions format, so the standard OpenAI client libraries work as they are. You point them at a different base URL, give them a different key and name a different model.
Be clear about what you are connecting to. This is not Mistral's official API and does not forward requests to Mistral or any other vendor. It serves one open-weight model, run by an independent provider and tuned to answer without content refusals for lawful adult use. The model ID is uncensored. If your product depends on specific Mistral models or on features outside text chat, keep those calls where they are and move only the traffic that fits.
| Setting | Value here |
|---|---|
| Base URL | https://api.mistraluncensored.com/v1 |
| Auth header | Authorization: Bearer YOUR_API_KEY |
| Model ID | uncensored |
| Endpoints | POST /v1/chat/completions, GET /v1/models |
Step 1: get a key
Sign up with Google, or with an email and a password, then open the API key page. New accounts can claim $0.50 of trial credit with one click, one claim per person. The trial credit is valid for 7 days and needs no card, which is enough for a complete round of testing. The walkthrough is on the API key page.
Trial keys are limited to 2 concurrent requests and 60 requests per minute. A funded key gets 8 concurrent requests and 300 requests per minute. Keep the key out of your repository: read it from an environment variable.
export UNCENSORED_API_KEY="paste-your-key-here"
Step 2: test the connection with curl
Before touching application code, confirm that the key and URL work. The models endpoint is the cheapest check, because it does not generate text.
curl https://api.mistraluncensored.com/v1/models -H "Authorization: Bearer $UNCENSORED_API_KEY"
You should get a JSON list that includes uncensored. Then send a real chat request:
curl https://api.mistraluncensored.com/v1/chat/completions -H "Authorization: Bearer $UNCENSORED_API_KEY" -H "Content-Type: application/json" -d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Write one sentence about a night train."}]
}'
The response headers include X-Request-Id and X-Balance-USD. Save the request ID when you contact support, since it lets the team find your call. The docs list the rest of the request options.
Step 3: switch your code
Python
Install the OpenAI package with pip install openai. If you were calling client.chat.complete from the mistralai package, the equivalent here is client.chat.completions.create.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.mistraluncensored.com/v1",
api_key=os.environ["UNCENSORED_API_KEY"],
)
resp = client.chat.completions.create(
model="uncensored",
messages=[
{"role": "system", "content": "You are a concise writing assistant."},
{"role": "user", "content": "Give me three titles for a ghost story set on a ferry."},
],
temperature=0.8,
max_tokens=200,
)
print(resp.choices[0].message.content)
Node.js
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.mistraluncensored.com/v1",
apiKey: process.env.UNCENSORED_API_KEY,
});
const resp = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Give me three titles for a ghost story set on a ferry." }],
});
console.log(resp.choices[0].message.content);
max_tokens is optional. If you leave it out, the completion may use whatever is left of the 100,000-token window, which covers prompt and completion together. For predictable cost and latency, set a cap that fits your use.
Parameters that carry over
Most settings you used before map by name. The service passes through temperature, top_p, stop, seed and the frequency and presence penalties. Streaming works with stream: true and returns usage at the end. Tool calling and JSON mode (response_format with json_object) are available as well.
Things that do not move: this API has no embeddings, no image, audio or video generation and no fine-tuning. If your current setup also calls an embedding model, keep that part with its current provider. A common arrangement is to retrieve with embeddings elsewhere and send the retrieved text to uncensored for the answer.
Two practical notes on migration. First, system prompts written for a refusal-prone model often contain defensive text, such as long disclaimers. You can usually delete these. Second, rerun your evaluation prompts after the switch. A different model reads instructions differently, so a prompt tuned for one model is a starting point, not a guarantee.
A short migration checklist
Moving a working integration is easier when you do it in a fixed order, so a failure points to one change.
- Create a key and run the two curl checks above. If they pass, the network path and credentials are fine.
- Put the base URL, the key and the model ID in configuration, not in the code. That way you can switch back in seconds if you need to, and run both providers side by side during testing.
- Replace the client library calls in one code path only, usually the least critical feature, and keep the rest on the old setup.
- Run a fixed set of 20 to 50 prompts from your real traffic through both and compare the answers. Look at tone, length, format compliance and how often a reply is unusable.
- Check rate limits against your peak load. If your app fires 20 requests at once, a full key will answer 8 and reject the rest with a concurrency error, so add a queue.
- Move the remaining features once the first one has run for a few days without surprises.
Keep logs of the X-Request-Id header and the usage object from the start. They make cost tracking and bug reports easy, and they cost nothing to collect. If a reply looks wrong, replay the same messages with a fixed seed and a lower temperature to see whether the problem is the prompt or just sampling noise.
Fixing errors
- Authentication error. The key is missing, mistyped or has extra whitespace. Print the first six characters of what your code reads from the environment, never the whole key.
- Not found. The base URL is usually wrong. It must end in
/v1, and the SDK appends/chat/completionsitself. Do not paste the full path into the base URL setting. - Model error. The model ID has to be
uncensored. Old model names from your previous provider will not match. - 429 with
rate_limited. You exceeded the per-minute request limit. Slow down or batch the work. - 429 with
concurrency. Too many requests at once. A streamed request holds its slot until the stream ends, so close streams you no longer read. - 429 with
Retry-After: 5. Temporary overload. Wait five seconds and try again. - Body too large. The maximum body is 8 MB.
A simple retry wrapper handles the last three cases. Sleep for the Retry-After value when present, otherwise back off exponentially, and give up after a few attempts.
Paying and what it costs
You pay as you go from prepaid credit: $0.15 per 1M input tokens and $0.50 per 1M output tokens, with no subscription. Failed or refused requests are not charged, and credit never expires. Top up any whole amount from $20 to $500, with +5% from $50, +10% from $100 and +15% from $200. You can pay with crypto (USDT on TRC20, USDC on Base). See pricing for the full table.
As a check on cost, a request with 1,000 input tokens and 300 output tokens costs 1,000 / 1,000,000 x $0.15 + 300 / 1,000,000 x $0.50 = $0.00015 + $0.00015 = $0.0003. If you are comparing providers before you commit, the Mistral alternative guide covers what this service is and is not, and prompts sent here are not used for training.
More guides
Questions and answers
Do I need the Mistral SDK?
No. Use any OpenAI SDK or plain HTTP, set the base URL to https://api.mistraluncensored.com/v1 and the model to uncensored.
Is this the official Mistral API?
No. It is an independent OpenAI-compatible service that serves one open-weight model and does not route to Mistral or any other vendor.
How do I check that my key works?
Call GET /v1/models with the Authorization header. A JSON list that includes the model means the key and URL are correct.
What are the rate limits?
A full key allows 8 concurrent requests and 300 requests per minute. A trial key allows 2 concurrent requests and 60 per minute.
Can I try it without paying?
Yes. After sign-up you can claim $0.50 of trial credit with one click, valid for 7 days, with no card required.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.