API mistral ai: Quickstart Guide
Connect your existing OpenAI SDK to our uncensored inference endpoint by swapping the base URL and API key. This single change unlocks unrestricted model behavior without altering your client code.
Base URL and Authentication
The first step is configuring your client to point at our infrastructure. Replace the standard OpenAI base URL with HTTPS://api.apimistralai.com/v1 and inject your unique API key into the authorization header. This simple swap redirects all requests to our uncensored model while keeping your existing integration logic intact.
- Base URL: HTTPS://api.apimistralai.com/v1
- Authentication: Bearer token via the
Authorizationheader
Ensure your key is active in your account dashboard before testing connections.
First Request
Send a standard chat completion request to verify connectivity and model response. The following curl command targets the uncensored model with a basic prompt.
This confirms the endpoint is reachable and returns text without standard content filters.
curl https://api.apimistralai.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Fix syntax error in python list comprehension"}]
}'If the response contains text, your integration is successfully routed through our uncensored inference layer.
Python SDK Integration
Use the official OpenAI Python library to interact with our API without modifying the core request structure. Initialize the client with the new base URL and your API key, then call chat.completions.create.
This approach allows you to retain all existing Python logic while gaining access to the uncensored model capabilities.
from openai import OpenAI
client = OpenAI(base_url="https://api.apimistralai.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)The response object behaves identically to standard OpenAI responses, making migration seamless for Python developers.
Node SDK Integration
For JavaScript or TypeScript environments, initialize the OpenAI package with the custom base URL. Set the apiKey and baseURL properties before calling chat.completions.create.
This ensures your Node.js applications route requests to our uncensored endpoint while maintaining compatibility with standard SDK patterns.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.apimistralai.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);The response structure remains consistent with OpenAI standards, allowing easy integration into existing Node.js workflows.
Streaming Responses via SSE
Enable real-time token generation by setting stream: true in your request. The API returns a Server-Sent Events (SSE) stream, allowing you to process tokens as they generate.
This reduces perceived latency for users and provides immediate feedback during long completions.
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)Parse the SSE data stream to display tokens incrementally. The final chunk contains the total token usage for the request.
Limits, Errors, and Context
Monitor your usage against strict rate limits and handle common HTTP errors gracefully. You are allowed 300 requests per minute and 8 concurrent requests per key.
A 401 error indicates an invalid or missing API key, while a 402 error means your prepaid credit is exhausted. A 429 status signals you have exceeded the 300 requests per minute limit.
Your context window supports 100,000 tokens total, with a maximum output of 16,000 tokens per request. Errors and refusals do not consume credit, ensuring you only pay for actual content generated.
Common questions
Is this the official Mistral AI API?
No, this is an independent uncensored API that is compatible with the OpenAI SDK format. It runs its own open-weight model tuned for unrestricted output, not the official Mistral models.
What is the context window size?
The model supports a 100,000 token context window, combining both prompt and completion tokens. You can output up to 16,000 tokens in a single request.
How do I top up my credit?
Top up using cryptocurrency only, specifically USDT (TRC20) or USDC (Base). Minimum top-ups start at $20, and bonus credit is applied based on the amount deposited.