API MistralMistral api docs: Quickstart Integration
Mistral api docs: Quickstart Integration
Stop rewriting your codebase just to swap providers. Our uncensored LLM API uses the standard OpenAI-compatible endpoints, so you can change your base URL and API key to start generating text immediately.
Authentication: Setting your header
Start by generating a key on our dashboard. The process is instant and requires no phone number verification. You only need an email address or a Google account to create an account. Once generated, the key appears on your screen immediately. Save it securely because we do not store the full string for retrieval. You will pass this string in the Authorization header for every request. Our system validates this token against your prepaid balance before processing your prompt. If the key is invalid or expired, you will receive a 401 error. We allow only one active key per account to keep access simple. A new key replaces the old one instantly when you generate a replacement.
The /v1/chat/completions endpoint
Send your first request to our base URL using the standard chat completions endpoint. Replace the placeholder key with your actual credentials. The model identifier is simply uncensored. This model is tuned to answer without refusals for lawful adult content. It handles text in and text out efficiently. You do not need to configure complex routing or select specific model versions. Just point your client to our base URL and send the payload. Our servers handle the inference and return the generated text. This approach ensures compatibility with existing tools and libraries.
Streaming responses with SSE
Enable streaming to receive tokens as they are generated. This reduces perceived latency for long outputs. Set the stream parameter to true in your request body. The server will return a series of Server-Sent Events. Each event contains a partial delta of the response. You can process these tokens in real-time for a chat interface. The final chunk includes the total token usage for the request. This allows you to track costs accurately as the conversation progresses. Streaming is ideal for applications where immediate feedback improves the user experience.
Function calling and JSON mode
Structure your outputs reliably using our supported parameters. Enable JSON mode by setting response_format to {"type": "json_object"}. This forces the model to return valid JSON without markdown fences. You can also define function schemas for tool usage. The model will follow the provided structure strictly. This is useful for automated data extraction or API chaining. Use the tools parameter to define available functions. The model can choose which function to call based on the prompt. This capability is essential for building agentic workflows without extra parsing logic.
Parameters: Temperature, Top-p, and Seeds
Control the randomness and determinism of your outputs. Adjust the temperature to vary creativity. Lower values produce more focused responses. Higher values introduce more variety. Use top_p to limit vocabulary selection. This works alongside temperature to refine output quality. Set the seed parameter for reproducible results. Identical inputs and seeds will yield identical outputs. This is critical for debugging and testing your integration. You can also set stop sequences to halt generation at specific markers. These parameters give you fine-grained control over the model behavior.
Limits, errors, and context window
Monitor your usage against our defined limits. The context window supports 100,000 tokens combined. This allows for extensive document analysis or long conversations. Each request can output up to 16,000 tokens. If you do not specify max_tokens, the limit defaults to 2,048. You are allowed 300 requests per minute per key. Only eight requests can run simultaneously per key. The request body size is capped at 8 MB. Errors like 402 indicate insufficient credit. Rate limits (429) occur if you exceed the per-minute threshold. Credit never expires, so you can pause usage without losing funds.
cURL
curl https://api.apimistral.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Set temperature to 0.7 for code generation"}]
}'Python
from openai import OpenAI
client = OpenAI(base_url="https://api.apimistral.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.apimistral.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)Frequently asked questions
How do I set the base URL for my client?
Use HTTPS://api.apimistral.com/v1 as your base URL. This endpoint is compatible with the official OpenAI SDKs. You only need to change the base URL and API key in your configuration. All other parameters remain the same as standard OpenAI requests.
What happens if I exceed the rate limit?
You will receive a 429 status code indicating too many requests. The limit is 300 requests per minute per key. You can wait for the window to reset or generate a new key to reset the counter. New keys replace the old one instantly if you need immediate access.
Can I use this API for roleplay applications?
Yes, the model is uncensored and designed for lawful adult content. It does not refuse controversial or fictional topics. This makes it ideal for immersive roleplay and creative writing. Just ensure the content does not involve minors, which is our only hard limit.
Get your API key now
Register, retrieve your key, and update the base URL. That is all you need to configure.