EN ▾
Get your key

Troubleshooting Mistralllmapi: Common Errors and Fixes

Developers integrating with our hosted text-only API often encounter specific error codes that halt their workflows. This guide breaks down the most frequent issues, from authentication failures to rate limits, providing clear steps to resolve them. We also cover safety considerations and when this service might not fit your needs.

Developer working on API integration with a laptop and coffee cup

Understanding Authentication Errors (401)

When your application sends a request to our base URL, the first hurdle is often authentication. A 401 error indicates that the API key provided in the header is invalid or missing. This is the most common issue for new integrations. The key is generated immediately upon signup via Google or email, so ensure you have copied it correctly without extra spaces or line breaks.

To fix this, verify that your request includes the correct Authorization header. The key must be sent exactly as it appears in your dashboard. If you have rotated your key, ensure the old one is no longer being used. Since our service is independent and does not share keys with other vendors, a 401 error is specific to your account's credentials.

Another common cause is sending the key in the wrong format. Ensure you are using the standard Bearer token format. If you are using a library or SDK, check that it is correctly injecting the header. For manual HTTP requests, double-check the syntax of the header string.

If the key is valid but you still receive a 401, check for network issues or proxy interference. Our API does not support OAuth flows beyond the initial signup. The key is the sole identifier for your account. Resetting your key in the dashboard can also resolve persistent authentication issues.

Resolving Insufficient Credit Errors (402)

A 402 error occurs when your prepaid credit balance is zero or insufficient for the request. Unlike subscription-based services, our API charges only for real token usage. Errors and refusals do not consume credit, but successful completions do. This means you must monitor your balance closely to avoid interruptions in your workflow.

To resolve this, you need to top up your account. We accept only crypto payments, specifically USDT on the TRC20 network or USDC on the Base network. The minimum top-up amount is $20, and the maximum is $500. You can top up any whole amount within this range. Credit never expires, so you can top up whenever convenient.

Additionally, new accounts receive $0.50 of trial credit, which can help you test the API without immediate payment. If you are using this trial credit, ensure you have enough balance for your intended request. Once the trial credit is exhausted, you must add funds to continue using the service.

After topping up, your balance should update immediately. If you still receive a 402 error, check that the transaction was confirmed on the blockchain. Our system processes payments automatically, but network delays can occasionally occur. Contact support if the balance does not reflect your payment after a reasonable wait time.

Managing Rate Limits (429)

Our API enforces a limit of 300 requests per minute per key. If you exceed this limit, you will receive a 429 error. This is designed to ensure fair usage and maintain service stability for all users. Developers making bulk requests or running high-frequency loops should be aware of this constraint.

To handle 429 errors, implement an exponential backoff strategy in your code. This means waiting for a short period after receiving a 429, then retrying. If the error persists, increase the wait time gradually. This approach prevents overwhelming the API and helps you recover smoothly from temporary spikes in traffic.

You can also monitor your request volume to stay within the limit. If you are using multiple keys, remember that the limit applies per key, not per account. Distributing your load across multiple keys can help you handle higher volumes. However, each key has its own 300 requests per minute limit.

Another strategy is to batch your requests if possible. Instead of sending individual requests for each item, consider sending larger payloads if the API supports it. This reduces the total number of requests and helps you stay within the rate limit. Always check the API documentation for any specific guidelines on batching.

Handling Content Refusals and Safety

Our model is uncensored, meaning it does not refuse lawful adult, fictional, or controversial topics. However, there is a hard limit: requests involving sexual content with minors are refused. If you send a request that triggers this filter, the model will return a refusal. This is a safety feature to ensure the content remains appropriate for a wide range of users.

To avoid unexpected refusals, review your prompts carefully. Ensure that the content you are generating aligns with the model's guidelines. If you are generating stories or scripts, check for any elements that might trigger the minor content filter. Adjusting your prompts can help you get the desired output without triggering a refusal.

It is also important to note that the model does not guarantee that every request will be accepted. Even if the content is lawful, the model may refuse based on its internal safety mechanisms. If you encounter a refusal, try rephrasing your prompt or adjusting the parameters to see if the output changes.

For developers working on applications that require consistent output, consider implementing a fallback mechanism. If a request is refused, you can retry with a slightly modified prompt or switch to a different model if available. This ensures that your application remains reliable and reliable, even when facing content refusals.

When This API Is Not the Right Choice

While our API is powerful for text generation, it is not suitable for all use cases. It is a text-only service, meaning it does not support image, audio, video, or embedding generation. If your application requires multimodal capabilities, such as generating images from text or transcribing audio, this API will not meet your needs.

Additionally, our API does not offer fine-tuning or model routing. If you need to train a custom model or route requests to different models based on specific criteria, you will need to look for a more flexible solution. Our service is designed for developers who need a reliable, uncensored text model without the complexity of fine-tuning.

Another limitation is the payment method. We accept only crypto payments, specifically USDT on TRC20 or USDC on Base. If your business model relies on credit cards, PayPal, or bank transfers, this API may not be the best fit. You will need to set up a crypto wallet to manage your credits.

Finally, our API does not provide an SLA or certifications like SOC2 or HIPAA. If your application requires strict compliance with specific regulations or guaranteed uptime, you may need to consider other providers. Our service is ideal for developers who prioritize flexibility and uncensored output over formal certifications.

Integrating with Your Application

Integrating our API into your application is straightforward, thanks to its OpenAI-compatible endpoint. You can use the standard /v1/chat/completions endpoint to send requests. This compatibility means you can use existing libraries and tools that support the OpenAI API format.

Start by obtaining your API key from the dashboard. Then, configure your application to send requests to our base URL. Ensure that you include the correct Authorization header with your key. You can also use the /v1/models endpoint to retrieve information about the available models.

For developers using languages like Python or JavaScript, there are many libraries available that simplify the integration process. These libraries handle the HTTP requests and response parsing, allowing you to focus on your application logic. Make sure to check the documentation for the specific library you are using to ensure compatibility.

Testing your integration is important. Start with simple requests to verify that the API is responding correctly. Then, gradually increase the complexity of your requests to ensure that your application can handle various scenarios. Monitor your usage and error rates to identify any potential issues early in the development process.

Optimizing Performance and Costs

To optimize performance and costs, it is important to understand how tokens are counted. Our API charges $0.15 per million input tokens and $0.50 per million output tokens. The context window is 100,000 tokens, which includes both the prompt and the completion. Understanding token usage can help you manage your budget effectively.

One way to reduce costs is to optimize your prompts. Shorter prompts result in fewer input tokens, which lowers the cost. Additionally, you can control the output length by setting the max_tokens parameter. This prevents the model from generating excessively long responses, which can increase costs.

Another strategy is to use streaming for real-time responses. Streaming allows you to receive the model's output as it is generated, rather than waiting for the entire response. This can improve the user experience and reduce perceived latency. It also allows you to start processing the output earlier, which can be beneficial for applications that require immediate feedback.

Finally, monitor your usage regularly to identify any unusual patterns. If you notice a spike in token usage, investigate the cause. It could be due to a bug in your application or a change in the model's behavior. By keeping a close eye on your usage, you can ensure that you are getting the most value from your API credits.

Frequently asked questions

How do I fix a 401 error?

Verify that your API key is correct and included in the Authorization header. Ensure there are no typos or extra spaces.

What payment methods are accepted?

We accept only crypto payments: USDT on TRC20 or USDC on Base. Credit cards and PayPal are not supported.

What is the rate limit?

The limit is 300 requests per minute per key. Exceeding this results in a 429 error.

Does the API support image generation?

No, this is a text-only API. It does not support image, audio, video, or embedding generation.