EN ▾

Mistral api doc: Quickstart Guide

Migrate your existing code to our uncensored LLM by swapping the base URL and API key. This mistral API doc guides you through the exact steps to start sending requests with zero vendor lock-in.

Install the SDK and set your base URL

Start by installing the official SDK for your language and pointing it at our endpoint. The base URL is HTTPS://api.mistralapidoc.com/v1. This single change directs all calls to our uncensored infrastructure without altering your existing logic. You can use any standard client that supports OpenAI compatibility. The setup takes seconds and requires no complex configuration files.

Ensure you pass your unique API key in the Authorization header. Our system validates this key against your prepaid balance before processing any tokens. This approach ensures you only pay for what you use. Keep your key secure and rotate it if you suspect exposure. The key is issued immediately upon signup via Google or email.

Make your first request to the uncensored model

Send a POST request to /v1/chat/completions with the model ID set to "uncensored". This model responds to lawful adult content, fiction, and controversial topics without standard refusals. It is an open-weight model tuned for direct answers. You do not need to specify a version number or route between different vendors. The response returns text in the content field.

curl https://api.mistralapidoc.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "List all available models and their context windows"}]
  }'

The request body includes your message array and optional parameters. Our API ignores extra fields gracefully. If you send a simple prompt, you receive a direct completion. Use this to verify your integration works before adding complex logic. The model handles context up to 100,000 tokens efficiently.

Enable streaming and handle token usage

Set stream to true to receive tokens via Server-Sent Events. This method reduces perceived latency for long responses. The final chunk in the stream contains the complete token usage statistics for that request. You can log these metrics to track your prepaid credit consumption accurately. Streaming is ideal for chat interfaces and real-time applications.

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)

Handle partial responses by accumulating the content delta. Our API ensures the total token count matches the actual usage. Errors during streaming do not charge you for incomplete tokens. This feature provides a smooth user experience while keeping costs transparent. You can stop the stream early if the user interrupts the generation.

Use function calling and JSON mode

Pass a tools array to enable function calling. The model will output structured tool calls when appropriate. You can also enforce JSON mode by setting response_format to json_object. This guarantees the output is valid JSON, which simplifies parsing in your application. Both features work with the standard OpenAI SDK syntax.

import OpenAI from "openai";

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

Define your function schema with name, description, and parameters. The API returns the function name and arguments in the response. This allows your code to execute external logic based on the model's decision. JSON mode is useful when you need strict data structures. Combine these features for robust, automated workflows.

Configure parameters: temperature, top_p, and seed

Adjust temperature to control randomness. Lower values make responses more deterministic. Top_p limits the nucleus sampling to the most probable tokens. Seed ensures reproducible outputs for debugging. These parameters give you fine-grained control over the model's behavior. Use them to tune the balance between creativity and accuracy.

from openai import OpenAI

client = OpenAI(base_url="https://api.mistralapidoc.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)

Set presence_penalty and frequency_penalty to reduce repetition. The model supports all standard OpenAI parameters. You can pass a stop sequence to halt generation at specific markers. These controls help you get the exact output format you need. Experiment with different combinations to find the optimal settings for your use case.

Limits, errors, and context window

Our API supports a 100,000 token context window. The maximum output per request is 16,000 tokens, or 2,048 if you omit max_tokens. You are limited to 300 requests per minute and 8 concurrent requests per key. The request body must stay under 8 MB. These limits ensure fair usage for all prepaid customers.

Handle HTTP 401 errors by verifying your API key. A 402 error indicates insufficient prepaid credit. Top up with crypto to resume service. A 429 error means you have exceeded the rate limit. Wait briefly before retrying. Our system does not use prompts for training, preserving your data privacy. Errors and refusals are free, so you only pay for successful completions.

Common questions

Is this the official Mistral API?

No, this is an independent service hosting an uncensored model. We use the same OpenAI-compatible protocol but run our own infrastructure. Check the vendor's documentation for their specific details.

What happens if I get a 402 error?

A 402 error means your prepaid balance is exhausted. You can top up with USDT or USDC to add credit. Your existing credit never expires, so you can add more whenever you want.

Does this API support image generation?

No, we only provide text completions via /v1/chat/completions. We do not offer embeddings, image, audio, or video generation. Focus on high-quality text responses with our uncensored model.

Your API key awaits

Sign up, grab your key, update your base URL. That’s it.

Try with trial credit