Prerequisites: SDK and environment
Start by installing your preferred OpenAI-compatible SDK. You only need a valid API key and the base URL for our service.
Export the key to your environment variables so your scripts can access it securely. Create a new account via Google or email to receive your key instantly. No phone number verification is required for this step.
Ensure your environment supports standard HTTP libraries. The API expects standard JSON payloads for all requests. You do not need to install vendor-specific drivers.
Setting the base URL
Point your SDK client to our dedicated endpoint for uncensored inference. The base URL replaces the standard OpenAI endpoint in your configuration.
Use HTTPS://api.apikeymistral.com/v1 as your base URL. This ensures all requests route through our high-throughput servers. You do not need to change the endpoint path if your SDK defaults to /chat/completions.
Keep your API key in memory or a secure vault. The key authenticates every request you send to this URL.
Making your first POST request
Send a standard chat completion request to get text output. Use the model ID "uncensored" to access our tuned model.
Specify the temperature and other parameters to control creativity. The endpoint accepts standard JSON bodies with messages array.
Here is a basic curl command to test connectivity:
curl https://api.apikeymistral.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "return json object with keys name age"}]
}'Verify the response contains the generated text. Check the status code is 200 for success.
Python SDK integration
Configure the Python client to use our base URL. Initialize the client with your API key and the custom endpoint.
Call the chat.completions.create method with your prompt. The response object contains the generated text in choices[0].message.content.
Handle potential errors like rate limits or invalid keys gracefully. Log the token usage if needed for cost tracking.
from openai import OpenAI
client = OpenAI(base_url="https://api.apikeymistral.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)This approach works with any OpenAI-compatible library. You can reuse existing code with minimal changes.
Node SDK integration
Initialize the Node.js client with the custom base URL. Pass your API key in the configuration object.
Invoke the chat.completions.create function with your desired parameters. The response follows the standard OpenAI format.
Process the stream or final response as needed. Error handling should catch network issues or authentication failures.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.apikeymistral.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);This setup allows you to integrate uncensored inference into your Node applications quickly.
Handling streaming responses
Enable streaming by setting stream=true in your request. The API returns data in chunks as they are generated.
Process each chunk to display real-time output to your users. Accumulate the content to get the full response.
Monitor token usage in the final chunk of the stream. This helps you track costs accurately.
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)Streaming reduces perceived latency for long responses. It is ideal for chat interfaces and interactive applications.
Limits, errors, and context window
Understand the technical limits to avoid service interruptions. The context window supports 100,000 tokens for prompt and completion combined.
Max output is 16,000 tokens per request. Set max_tokens explicitly to avoid hitting the 2,048 default.
Rate limits allow 300 requests per minute per key. You can have 8 concurrent requests at a time.
Handle 401 errors by checking your key validity. 402 errors indicate insufficient credit. 429 errors mean you hit the rate limit.
Requests exceeding the body size limit of 8 MB will fail. Plan your payload accordingly.