The OpenRouter API Explained
An OpenAI-compatible API lets you swap your codebase to a new provider without rewriting logic, which is critical when you need uncensored models for specific use cases. This guide explains how base URLs, token pricing, and streaming work so you can integrate an alternative endpoint reliably.
Last updated
Summary
- Use the standard /v1/chat/completions endpoint with any OpenAI SDK by simply changing the base URL.
- Token pricing is prepaid and transparent, charging only for actual usage with no monthly subscriptions.
- Streaming responses via SSE allow real-time token delivery, which is essential for chat interfaces.
- Function calling and JSON mode are supported for structured data extraction and tool integration.
What Is an OpenAI-Compatible API?
It is a REST API that follows the OpenAI chat-completions interface. You send prompts and receive text outputs using standard JSON payloads. This compatibility means your existing client code works without major changes.
The primary endpoint is POST /v1/chat/completions. It accepts messages as an array of role and content objects. You can also list available models via GET /v1/models. This standardization reduces integration time significantly.
Our service provides exactly this interface. We serve one uncensored model under the ID "uncensored". It runs on our own servers. It does not route to other vendors. You get direct access to the model you need.
Context windows support up to 100,000 tokens total. Output limits are 16,000 tokens per request. Streaming is available via Server-Sent Events. Function calling and JSON mode are fully supported.
Understanding Base URLs and API Keys
The base URL points to the server handling your requests. You replace the default OpenAI URL with our specific endpoint. Our base URL is HTTPS://api.openrouterabliterated.com/v1. This change directs traffic to our uncensored infrastructure.
API keys authenticate your requests. You generate one key per account. The key is shown immediately after signup. You can replace it if needed. Each account holds one active key at a time.
Rate limits are enforced per key. You can send 300 requests per minute. Up to 8 requests can run simultaneously. Request bodies are capped at 8 MB. These limits handle high-volume usage well.
Signup requires only an email or Google account. No phone number is needed. The key appears instantly. You can start sending requests immediately. Privacy is preserved; prompts are not used for training.
Why Choose an Uncensored Model for Your Use Case?
Uncensored models do not refuse lawful adult, fictional, or controversial topics. They are ideal for creative writing, roleplay, or research. Mainstream models often apply strict guardrails. These can interrupt the flow of generation.
Our model is tuned to answer directly. It handles NSFW content without pushback. It works well for political philosophy or niche genres. You get consistent behavior without extra prompting.
Tool use is supported. You can define tools for your application. The model respects tool choices. This makes it suitable for complex workflows. Errors and refusals are free. You only pay for real usage.
Content limits still apply. Sexual content involving minors is always refused. This is a hard limit. It ensures basic safety standards. Everything else is fair game for your use case.
Token Pricing: How Costs Are Calculated
Pricing is based on token usage. Input tokens cost $0.15 per 1 million tokens. Output tokens cost $0.50 per 1 million tokens. You pay only for what you use. There are no hidden fees.
Credit is prepaid. You top up with crypto only. USDT on TRC20 or USDC on Base are accepted. Any whole amount from $20 to $500 is allowed. Credits never expire. This avoids subscription lock-in.
Bonus credit is available on top-ups. You get +5% from $50. +10% from $100. +15% from $200. This reduces your effective cost. Errors are free. Refusals are free. You only pay for successful tokens.
A trial account gets $0.50. It is valid for 7 days. This lets you test the API thoroughly. You can verify integration before committing funds.
Streaming vs. Non-Streaming Responses
Streaming sends tokens as they are generated. This reduces perceived latency. Users see text appear in real time. It is essential for chat interfaces. Non-streaming waits for the full response. This can feel slow for long outputs.
We support streaming via SSE. The last chunk includes token usage. This allows accurate billing tracking. You can handle partial responses gracefully. Errors are handled consistently.
Non-streaming is also available. It returns the full response at once. This is simpler for batch processing. You choose based on your needs. Both modes use the same endpoint.
Function calling can be streamed. Tools are executed as they are identified. This improves interactivity. You can start processing inputs early. The API handles the complexity for you.
Function Calling and Structured Output
Function calling lets the model invoke tools. You define tool schemas in the request. The model returns function calls. Your code executes them. This enables complex workflows. You can build agents or assistants.
JSON mode forces structured output. The model returns valid JSON. This is useful for data extraction. You get consistent formats. Parsing is easier. Errors are rare.
Parameters like temperature and top_p control behavior. Stop sequences limit output. Seeds ensure reproducibility. Penalties reduce repetition. You have fine-grained control.
Tool choice can be automatic or forced. You specify the model's preference. This guides the generation process. It improves reliability. Your application stays robust.
Common Client Libraries and SDKs
Most SDKs work with minor changes. You only update the base URL. The rest of the code remains the same. This applies to Python, Node.js, and others. Integration is straightforward.
The OpenAI SDK is the standard. It handles authentication and retries. You pass your API key. The base URL points to our service. Requests are sent normally.
Streaming is supported in all SDKs. You iterate over chunks. Token usage is available in the final chunk. This matches our billing model. Errors are caught consistently.
Function calling is built into modern SDKs. You pass tool definitions. The SDK parses responses. Your code executes tools. The loop continues until done. It is efficient and reliable.
Troubleshooting Common API Errors
Rate limits return 429 errors. You can send 300 requests per minute. Exceeding this triggers a wait. Implement exponential backoff. This prevents overwhelming the server.
Invalid keys return 401 errors. Check your API key. Ensure it is active. Replace it if needed. Each account has one key. Generate a new one if lost.
JSON errors occur in JSON mode. Ensure your schema is valid. The model must return valid JSON. If it fails, retry. Adjust temperature for better stability.
Timeouts happen with long generations. Increase your timeout value. Streaming reduces timeout risk. Partial responses are handled. You can reconstruct the full output.
Next Steps: Getting Your First API Key
Visit the signup page. Use Google or email. No phone number is required. The process is fast. You get immediate access.
Your API key is shown. Copy it securely. Use it in your SDK. Set the base URL to our endpoint. Start sending requests.
Top up with crypto. USDT or USDC is accepted. Get bonus credit on larger amounts. Credits never expire. Use them at your pace.
Test with the trial credit. It lasts 7 days. Verify streaming and function calling. Explore the model's capabilities. Integrate it into your app. The API is ready for production.
Common questions
Is the uncensored model the same as OpenRouter's models?
No, our model is independent. It runs on our own servers. It is not GPT, Claude, or any other vendor's model. It is tuned for uncensored responses. You get direct access without routing.
How do I pay for the API?
We accept crypto only. USDT on TRC20 or USDC on Base are supported. Top-ups range from $20 to $500. Bonus credit is added for larger amounts. Credits never expire.
Can I use this with the OpenAI SDK?
Yes, it is fully compatible. Change the base URL to our endpoint. Use the same authentication method. The rest of your code remains the same. Streaming and function calling work as expected.
What are the rate limits?
You can send 300 requests per minute. Up to 8 requests can run simultaneously. Request bodies are capped at 8 MB. These limits handle high-volume usage well. Errors and refusals are free.
Get your API key
Sign up, copy the key, update your base URL. That is all.