Get API key

OpenRouter api Troubleshooting Guide

The OpenRouter API Troubleshooting Guide helps developers resolve common integration issues with uncensored LLM endpoints, focusing on base URL configuration, rate limits, and streaming behavior. This guide provides concrete solutions for token counting errors, JSON mode failures, and crypto payment delays to ensure your AI applications run reliably.

Last updated

Summary

  • Always verify your base URL points to the correct uncensored endpoint to avoid routing errors.
  • Streaming responses require proper SSE handling to capture the final token usage statistics.
  • JSON mode failures often stem from missing strict formatting headers or invalid schema definitions.
  • Crypto top-ups via USDT or USDC apply instantly, but bonus credits require specific minimum thresholds.

Understanding the Base URL

The base URL defines where your client sends requests. A mismatch here causes immediate connection failures or unexpected model responses. Many developers assume the standard OpenAI URL works universally, but uncensored providers often use distinct endpoints to route traffic to specific model pools.

Verify that your configuration points to https://api.openrouterabliteratedmodels.com/v1 for our service. If you are using a third-party aggregator, ensure the base URL matches their documentation exactly. Incorrect URLs often result in 404 errors or responses from default models instead of the intended uncensored variant.

  • Check your environment variables for BASE_URL or API_HOST.
  • Ensure the path includes /v1 for standard compatibility.
  • Test connectivity with a simple model list request before heavy usage.

Handling Rate Limits

Rate limits restrict how many requests you can send within a specific timeframe. Our API enforces a limit of 300 requests per minute per key. Exceeding this threshold results in HTTP 429 errors, temporarily blocking further requests until the window resets.

Additionally, there is a concurrent request limit of 8 requests at the same time per key. If you send more than 8 simultaneous requests, the excess will queue or fail depending on your client library. Monitor your application’s concurrency to avoid hitting these hard limits. Use exponential backoff strategies in your code to handle 429 errors gracefully without spamming the server.

Remember that each key is unique to your account. Sharing keys across multiple services can accelerate hitting these limits. Generate a new key if you need separate rate limit pools for different parts of your application.

Streaming vs. Non-Streaming Responses

Streaming returns data incrementally as tokens are generated, while non-streaming waits for the full response. Streaming is essential for real-time user experiences but requires careful handling of Server-Sent Events (SSE).

When streaming, the final chunk contains the token usage statistics. If you stop processing early, you might miss this data. Ensure your client parses the last SSE message to retrieve input and output token counts accurately. Non-streaming responses are simpler but can cause high latency for long outputs.

Choose streaming for chat interfaces where users see text appear character by character. Use non-streaming for batch processing or when you need the complete response before proceeding. Our API supports both modes via the stream parameter in the request body.

JSON Mode Errors

JSON mode ensures the model outputs valid JSON, which is critical for programmatic integration. Errors here often stem from incorrect headers or schema mismatches. The API requires response_format: {"type": "json_object"} to enforce strict JSON output.

If you receive malformed JSON, check your schema definition. The model might include markdown code blocks or explanatory text outside the JSON structure. Use a robust parser that can strip markdown fences or validate the output against your expected schema. Avoid overly complex schemas that confuse the model.

Test with simple structures first. Gradually add complexity to identify where the model struggles. Ensure your temperature is set appropriately, as higher temperatures can increase randomness and reduce JSON validity.

Token Count Miscalculations

Token counts determine your billing and context window usage. Miscalculations can lead to unexpected charges or truncated responses. Our API charges $0.15 per 1M input tokens and $0.50 per 1M output tokens.

Use a reliable tokenizer library that matches the model’s tokenization scheme. Different models may tokenize whitespace or punctuation differently, leading to discrepancies between your local count and the API’s count. Always rely on the token usage returned in the response for accurate billing.

Keep an eye on your context window, which is 100,000 tokens total. Exceeding this limit will cause errors. Truncate older messages or summaries to stay within bounds. Monitor your token usage over time to optimize your prompt structure and reduce costs.

Crypto Payment Delays

Crypto top-ups via USDT (TRC20) or USDC (Base) are processed instantly on our end. However, network congestion can sometimes cause slight delays in confirmation. Ensure you send the correct amount and network to avoid loss.

Top-ups range from $20 to $500 in whole amounts. Bonus credits apply automatically: +5% from $50, +10% from $100, and +15% from $200. Verify the transaction hash to confirm payment. If credits do not appear within a few minutes, check the blockchain explorer for the transaction status.

Credit never expires, so there is no urgency to use it immediately. Mistakes like double charges are resolved through the Support page. Keep your transaction records for easy reference if issues arise.

Model ID Configuration

The model ID identifies which version of the uncensored model you are using. For our service, the model ID is uncensored. Using an incorrect ID can result in errors or unexpected behavior.

Ensure your requests specify model: "uncensored" in the request body. This ID points to our specific open-weight model tuned for unrestricted responses. It is not a generic identifier but a specific pointer to our hosted instance.

Check your client library’s documentation for how to set the model ID. Some libraries use a model field, while others might use a different parameter. Consistency in model ID usage across your application prevents confusion and ensures you are always calling the intended uncensored model.

Context Window Exceedances

The context window limits the total number of tokens you can send in a single request. Our API supports a window of 100,000 tokens, including both prompt and completion. Exceeding this limit results in an error.

To manage context, implement a sliding window strategy. Remove older messages or summarize them to free up space. Monitor the token count of your input to ensure it stays within the 100,000 token limit. If you exceed the limit, the API will reject the request.

Use the max_tokens parameter to control output length. The maximum output per request is 16,000 tokens. Setting this parameter helps prevent excessive token usage and keeps responses within manageable bounds for your application.

Support and Refund Policy

Credit is not refunded once used, but it never expires. If you encounter issues with payments or service, contact Support through the designated page. Mistakes like double charges are resolved by the Support team.

For technical issues, check the documentation first. Our API is straightforward, but edge cases may arise. Provide your API key and request details when seeking help. Response times vary, but we aim to resolve issues quickly.

Remember that credit is prepaid. You pay for what you consume, with errors and refusals being free. This model ensures transparency in billing. Use the Support page for any discrepancies or questions about your account.

Common questions

What is the primary keyword for this guide?

The primary keyword is 'openrouter abliterated models', which refers to the uncensored API service described in the guide. This term helps users find specific information about our hosted uncensored model.

How do I handle streaming responses correctly?

Streaming responses require handling Server-Sent Events (SSE). Ensure your client parses the final chunk to get token usage statistics. This approach provides real-time updates and accurate billing data.

What happens if I exceed the rate limit?

Exceeding the rate limit of 300 requests per minute results in HTTP 429 errors. Your requests will be blocked until the window resets. Implement exponential backoff to handle these errors gracefully.

Can I use crypto for payments?

Yes, we accept USDT (TRC20) and USDC (Base) for top-ups. Payments range from $20 to $500, with bonus credits for larger amounts. Credit never expires, and errors are free.

Get your API key

Sign up, copy your key, update the base URL. Simple integration.