el ▾
Get API key

Uncensored OpenAI-compatible API

keyapimistral.com

https://api.keyapimistral.com/v1

Quickstart: Use the uncensored API with OpenAI SDK

Connect your existing OpenAI SDK to our uncensored API by changing two configuration lines. Use the same client code for a model that answers without refusals.

Install the official OpenAI SDK

Install the library your code already expects. This step works for Python or Node projects without adding new dependencies.

  • Python: pip install openai
  • Node: npm install openai

The SDK handles retries and JSON parsing for you. You do not need a custom HTTP client to make requests to the chat endpoint.

Configure your base_url and API key

Point the client at our server instead of OpenAI. Change the base URL and inject your key. This switch makes the SDK talk to our uncensored model.

  • Base URL: https://api.keyapimistral.com/v1
  • API Key: Your unique key from the dashboard

Keep the model ID as uncensored in your requests. The SDK uses this ID to route the prompt to the correct endpoint.

Send your first chat completion request

Send a simple prompt to test the connection. The request returns a text response from the model. Use this to verify your key works.

curl https://api.keyapimistral.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Generate a summary of the provided technical documentation."}]
  }'

The response contains the generated text. Check the choices array for the content. Errors appear in the error object.

Handle streaming responses and token usage

Stream tokens for faster perceived latency. The SDK yields tokens as they are generated. This approach is ideal for long outputs.

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)

Token counts appear in the final chunk. Monitor usage to stay within your prepaid credit. Streaming reduces wait time for the user.

Explore function calling and JSON mode

Enable tools for structured outputs. Set response_format to json_object for strict JSON. Define functions in the tools parameter.

from openai import OpenAI

client = OpenAI(base_url="https://api.keyapimistral.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 model returns arguments for the defined functions. Parse the JSON response in your code. This method ensures reliable data extraction.

Understand rate limits and error handling

Expect 429 errors if you exceed limits. The rate limit is 300 requests per minute. Concurrent requests are capped at 8 per key. Request bodies must stay under 8 MB.

import OpenAI from "openai";

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

Handle 401 errors for invalid keys. 402 errors indicate insufficient credit. Refunds are not issued for used credit. Errors do not consume tokens.

Frequently asked questions

How do I get an API key without phone verification?

Sign up with Google or email on the dashboard. The key appears immediately. No phone number is required for the uncensored API key.

What models are available via the API?

Use the GET /v1/models endpoint to list them. The primary model is <code>uncensored</code>. It supports the full OpenAI chat completion format.

Do prompts get used for training?

No, prompts are not used for training. Your data remains private. The uncensored AI platform respects your input data.

Get your key in one step

Register, retrieve the key, update the endpoint. That’s all.

Get API key