Last updated
Mistral API Integration Guide
You can replace the standard Mistral API with our uncensored alternative by simply updating your base URL and API key. This guide explains how to migrate your existing OpenAI-compatible code to run our uncensored model without changing your logic.
Why Switch from the Standard Mistral API?
Developers often hit content filters that interrupt their workflows. Standard APIs refuse specific topics. Our uncensored model answers directly. You retain full control over your output.
The standard Mistral API is reliable. It serves popular models. However, it applies its own moderation layers. You might see refusals for creative writing or adult themes. Our API removes those barriers. It runs an open-weight model tuned for fewer restrictions. You get the same OpenAI-compatible endpoint.
Cost is another factor. Standard plans often lock you into subscriptions. We use a prepaid credit system. You pay only for what you use. Errors do not cost you tokens. This transparency helps you budget accurately.
Migration is trivial. Your existing code works. You only change the base URL. No complex rewrites are needed. This flexibility suits developers who want uncensored generation without managing local models.
Step 1: Obtain Your API Key
Start by creating an account on our platform. You can sign in with Google or use an email and password. No phone number is required. This keeps your identity private.
Once you log in, navigate to the dashboard. Generate your API key immediately. The key is shown only once. Copy it and store it securely. You will need it for every request.
You receive trial credit automatically. New accounts get $0.50 valid for seven days. This lets you test the integration before committing funds.
Your key has specific limits. You can make 300 requests per minute. Only eight requests run simultaneously. Each key is unique to your account. If you generate a new key, the old one stops working. This ensures secure access to your credits.
Step 2: Configure Your Base URL
The base URL is the single most important change. Point your SDK to our endpoint. Use the standard OpenAI format. This ensures compatibility with your existing libraries.
Set your base URL to HTTPS://api.mistralbaseurl.com/v1. This path mirrors the structure of major providers. Your code will recognize the endpoints correctly. You do not need new drivers or clients.
Update your API key variable in your code. Replace the old provider key with your new one. Ensure the key string is correct. Typos cause immediate authentication errors.
Test the connection with a simple ping. Request the list of available models. You should see our uncensored model listed. This confirms your configuration is correct. You are now ready to send prompts.
Step 3: Implement Chat Completions
Send a POST request to the chat completions endpoint. Use the model ID "uncensored". This triggers our specific large language model. It processes your input and generates text.
Structure your messages as an array. Include system, user, and assistant roles. The model follows these instructions closely. You can set parameters like temperature and top_p. These control the creativity of the output.
The context window is 100,000 tokens. This allows for long documents. You can pass extensive context in a single request. The model maintains coherence over long sequences. This is useful for code analysis or summarization.
Max output is 16,000 tokens. If you do not set max_tokens, the limit is 2,048. Adjust this parameter based on your needs. Longer responses require more credits. Plan your token budget accordingly.
Handling Streaming and Tokens
Streaming improves user experience. It sends tokens as they are generated. This reduces perceived latency. Enable streaming in your SDK settings.
We use Server-Sent Events (SSE). The stream provides chunks of text. Each chunk contains a part of the response. You can display tokens in real time.
Token usage is reported in the final chunk. This ensures accurate billing. You see exactly what was consumed. Errors do not charge you. Refusals are free. This protects your budget from wasted requests.
Monitor your credit balance regularly. You can top up via crypto at any time. Credits never expire. This allows you to pause usage without penalty. You retain your balance indefinitely.
Function Calling and JSON Mode
Our API supports structured outputs. You can enforce JSON mode. Set response_format to json_object. The model returns valid JSON only. This is critical for integrations.
Function calling works seamlessly. Define your tools in the request. The model identifies which tool to use. It passes arguments correctly. You can parse the result in your code.
Set tool_choice to auto or specific. This gives you control over behavior. The model prioritizes tool use when needed. This enhances reliability in complex workflows.
Use these features for data extraction. Automate forms or API calls. The uncensored model handles edge cases well. It does not refuse complex queries. This makes it suitable for production tasks.
Common Errors: 404 and 422 Explained
Errors usually indicate configuration issues. A 404 Not Found error is common. It means the endpoint is wrong. Check your base URL carefully. Ensure you include /v1 in the path.
A 422 Unprocessable Entity error occurs. This often happens with invalid JSON. Check your request body structure. Ensure all required fields are present. Verify the model ID is correct.
Rate limits return 429 errors. You exceeded 300 requests per minute. Wait briefly before retrying. Implement exponential backoff in your code. This prevents overwhelming the API.
Check your API key validity. Ensure it is not expired. Keys replace automatically if regenerated. Use the correct key for each request. This minimizes downtime.
Cost Comparison: Mistral vs. Our Uncensored API
Our pricing is straightforward. You pay $0.15 per million input tokens. Output tokens cost $0.50 per million. This is transparent and predictable.
Standard APIs often charge more. They include platform fees. Our model runs on our servers. You pay for compute directly. This lowers the base cost.
Errors are free. You do not pay for failed requests. This saves money on debugging. You only pay for valid outputs.
Top-ups start at $20. You pay with crypto. Bonus credits are available. Add $50 for 5% extra. Add $100 for 10% extra. Add $200 for 15% extra. This rewards higher usage.
Final Checklist for a Smooth Migration
Verify your base URL is correct. Update your API key in the environment. Test with a simple prompt. Ensure streaming works if needed.
Check your rate limit handling. Implement retries for 429 errors. Monitor your token usage. Adjust max_tokens as needed.
Enable JSON mode for structured data. Test function calling with your tools. Ensure the model responds correctly. Verify output format matches your expectations.
Tailor your parameters. Set temperature for creativity. Use top_p for diversity. These settings affect output quality. Experiment to find the best balance. Your code should remain unchanged except for the URL and key.