Integrate the Uncensored LLM API

Connect your existing OpenAI-compatible client to our uncensored model by updating the base URL and API key. You can send text completions, enable streaming, and handle JSON responses with zero configuration changes.

Authentication and base URL setup

Start by replacing the standard OpenAI base URL with our endpoint and providing your unique API key. You receive this key immediately after signing up via Google or email, and it remains the sole credential for all requests. Our API accepts standard headers, so you can migrate your existing codebase without rewriting authentication logic.

Use the Authorization header with the Bearer scheme to pass your key. This method works with any library that supports OpenAI-compatible endpoints, ensuring you can test connectivity before committing to usage.

  • Base URL: https://api.mistralaikey.com/v1
  • Header: Authorization: Bearer YOUR_API_KEY

Sending your first chat completion

Send a POST request to /v1/chat/completions with your prompt and the model identifier uncensored. This endpoint processes text input and returns a generated text response, adhering strictly to OpenAI standards. You do not need to configure embeddings or image generation parameters, as this API focuses solely on chat completions.

Ensure you set the model field to uncensored to access the uncensored large language model. The system processes your input and returns a completion, allowing you to verify that your key works and the model responds correctly to your queries.

curl https://api.mistralaikey.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Summit the code for the login function"}]
  }'

Enabling streaming and tools

Enable streaming by setting the stream parameter to true, which returns token-by-token updates via Server-Sent Events (SSE). This approach reduces perceived latency and allows you to display partial results as they generate. You can also integrate function calling by defining tools in your request, enabling the model to execute specific actions or retrieve data dynamically.

Streaming provides real-time feedback, which is crucial for interactive applications. The final chunk of the stream includes token usage statistics, helping you track costs accurately. Tool definitions follow the standard OpenAI format, making integration straightforward for developers familiar with function calling.

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)

Handling JSON mode responses

Force structured output by setting response_format to {"type": "json_object"}. This ensures the model returns valid JSON, which simplifies parsing in your application code. You can combine this with tool definitions or strict prompt instructions to maintain data integrity.

JSON mode is essential for programs that need to consume structured data reliably. By enforcing this format, you avoid parsing errors and ensure consistent responses. This feature works alongside other parameters like temperature and top_p, allowing you to balance creativity with structure.

from openai import OpenAI

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

Understanding token limits and usage

The model supports a context window of 100,000 tokens, encompassing both the prompt and the completion. This generous limit allows you to process large documents or maintain long conversation histories without truncation. However, the maximum output per request is capped at 16,000 tokens, or 2,048 tokens if you do not specify max_tokens.

Track your usage through the token counts returned in the response. Each request consumes input and output tokens, billed at $0.15 per million input tokens and $0.50 per million output tokens. Errors and refusals do not incur charges, ensuring you only pay for successful completions.

import OpenAI from "openai";

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

Limits, errors, and reliability

You are limited to 300 requests per minute and 8 concurrent requests per key. If you exceed these limits, you will receive a 429 Too Many Requests error. Authentication failures return a 401 Unauthorized status, while insufficient credit triggers a 402 Payment Required response.

These limits ensure stable performance for all users. If you encounter a 401 error, verify your API key and ensure it has not been replaced. A 402 error indicates that your prepaid credit is exhausted, and you need to top up via crypto. Request bodies are capped at 8 MB, so large payloads should be compressed or split appropriately.

Common questions

What is the mistral AI key and how does it work?

The mistral AI key is your unique authentication token that grants access to our uncensored LLM API. You obtain it by signing up via Google or email, and you use it to authenticate requests to our OpenAI-compatible endpoint. This key allows you to integrate our model into any existing client that supports standard API authentication.

Can I use this uncensored AI API key with other providers?

Yes, because our API follows OpenAI-compatible standards, you can use your key with any library or client that supports the OpenAI protocol. You simply need to update the base URL to our endpoint and keep your existing code structure. This flexibility allows you to switch between providers without significant code changes.

How do I handle errors and rate limits with the uncensored coding AI endpoint?

Errors return standard HTTP status codes: 401 for invalid keys, 402 for insufficient credit, and 429 for rate limits. You can handle these by retrying after a delay or topping up your crypto credit. The API also respects concurrency limits, so monitor your parallel requests to avoid hitting the 8-request cap.

Get your key instantly

Sign up, copy the token, update your base URL. That is all you need.

Start nowView documentation