Quickstart: Connect your OpenAI SDK
Connect your OpenAI SDK to our uncensored LLM endpoint in seconds. This guide covers the exact configuration steps to start generating text with zero subscription friction.
Prerequisites: SDK and environment
Install the official client library for your preferred language. You will need a modern Python or Node.js runtime and a valid API key from your dashboard. The environment variables should be set securely before initializing the client instance.
Configuration: base_url and API key
Point your SDK to our specific endpoint instead of the default OpenAI host. Use the base URL provided in your dashboard and assign your generated key to the standard authorization header. This ensures all requests route correctly to our uncensored model infrastructure without needing custom headers.
Sending your first chat completion
Make a simple POST request to the chat completions endpoint to verify connectivity. Our uncensored model responds instantly to standard prompts, allowing you to test content generation without immediate refusals. Use the following example to confirm your key works:
curl https://api.mistralopenaicompatibleapi.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "list top 5 linux commands for disk cleanup"}]
}'
The response confirms the model processed your input within the allowed context window. You can now integrate this logic into your application workflows.
Python SDK implementation
Use the official Python library to handle request serialization automatically. Set the base URL to our domain and pass your API key as the primary authentication parameter. This approach works identically for local testing and production deployments.
from openai import OpenAI
client = OpenAI(base_url="https://api.mistralopenaicompatibleapi.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)
Ensure you handle exceptions properly, as network errors or invalid keys will raise standard HTTP exceptions. The library manages token counting efficiently for your prepaid balance.
Node SDK implementation
Initialize the client with the correct base URL and API key in your Node.js environment. The SDK supports both synchronous and asynchronous patterns for different use cases. Configure the model ID to "uncensored" for consistent results.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.mistralopenaicompatibleapi.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);
Node users benefit from the same token pricing structure and rate limits as Python users. Monitor your usage dashboard to track prepaid credit consumption accurately.
Streaming responses and limits
Enable streaming to receive tokens progressively, reducing perceived latency for long outputs. Our API supports Server-Sent Events for real-time text generation, which is ideal for chat interfaces. Watch for rate limits (429) and token constraints during high-volume usage.
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)
Each request respects the 100,000-token context window and the 16,000-token output limit. Errors like 401 indicate invalid credentials, while 402 signals insufficient prepaid credit. Keep requests under 8 MB to avoid payload rejections.
Frequently asked questions
What is the mistral openai compatible API endpoint URL?
The base URL is HTTPS://api.mistralopenaicompatibleapi.com/v1. Point your SDK to this address instead of the default OpenAI host to use our uncensored model.
How does the prepaid credit system work?
You pay only for tokens used, with no monthly fees. Credits are topped up via crypto and never expire. Errors and refusals do not consume your prepaid balance.
Can I use the standard OpenAI SDK with your API?
Yes, our endpoint is fully compatible with the official OpenAI SDKs. You only need to update the base URL and API key in your configuration.
Get your API key
Register, grab the key, update your endpoint base URL. That’s it.