EN ▾
Get API key

Integrating OpenRouter Abliterated Models via SDK

Developers often seek reliable access to uncensored text models for specialized applications. This guide explains how to configure the API for maximum output quality using system prompts and temperature adjustments. We provide a clear integration path for indie builders and technical teams.

Developer workspace with glowing server rack and abstract uncensored symbol

Understanding the API Base and Authentication

The first step in integration is establishing a connection to the service. Our API operates as a hosted solution that accepts standard OpenAI-compatible requests. You must direct your HTTP clients to the specific base URL provided for this service. This ensures that your requests reach the correct uncensored model endpoint without being routed through other providers. The base URL is https://api.openrouterabliteratedmodels.com/v1. All subsequent endpoints are relative to this root path.

Authentication is handled via an API key that you generate upon signing up. You can create an account using Google or an email and password combination. The key is displayed immediately after registration, so copy it securely. This key is required for every request you make to the API. Without a valid key, the server will return a 401 error indicating an invalid key. Keep this key private and do not expose it in public code repositories.

Once you have your key, you can begin constructing your HTTP requests. The service supports standard headers for authorization. You should include the key in the Authorization header using the Bearer scheme. This is the standard method for API authentication in modern web services. Ensure that your client library is configured to send this header automatically with each request.

It is important to note that this service is independent and not an official partner of any major model provider. When you send a request, you are interacting directly with our infrastructure. The model id you must send in your request body is "uncensored". This identifier tells the server which specific open-weight text model to serve. Using any other model id may result in errors or unexpected behavior. Stick to the documented model id for reliable results.

Configuring System Prompts for Behavior Control

System prompts are the primary tool for shaping how the model responds. They allow you to define the persona, tone, and constraints of the output. For uncensored text generation, you might want to instruct the model to bypass standard refusal filters for lawful adult or controversial topics. A well-crafted system prompt can significantly improve the relevance and quality of the generated text.

Start by defining the role of the assistant. You can specify that the model should be direct, unfiltered, or creative. For example, you might instruct it to answer questions without moralizing or hedging. This is particularly useful for applications that require raw text output for analysis or creative writing. The system prompt is sent as part of the messages array in your request.

Be specific about what you want to avoid. If you want to prevent the model from refusing certain types of content, state that explicitly. However, remember that there is a hard content limit regarding sexual content involving minors. Requests involving such content will be refused regardless of your system prompt. Ensure your prompts do not inadvertently trigger this hard limit if you are testing edge cases.

Test different system prompts to find the best balance between creativity and coherence. Some prompts may lead to more verbose responses, while others might produce concise answers. Experiment with various phrasings to see which yields the most useful results for your specific use case. The goal is to guide the model toward the output style you need without over-constraining its capabilities.

Adjusting Temperature and Sampling Parameters

Temperature is a critical parameter that controls the randomness of the model's output. A higher temperature leads to more creative and varied responses, while a lower temperature produces more deterministic and focused text. For uncensored models, you might experiment with higher temperatures to encourage more unique or unconventional outputs. However, too high a temperature can result in incoherent or nonsensical text.

The API supports several sampling parameters including temperature, top_p, and stop sequences. Temperature values typically range from 0 to 2, though the exact range may depend on the underlying model implementation. Start with a moderate temperature and adjust based on the quality of the responses. You can also use top_p to control the diversity of the token selection.

Stop sequences allow you to terminate the generation when a specific string is encountered. This is useful for controlling the length of the output or ensuring that the model stops at logical boundaries. For example, you might set a stop sequence to prevent the model from continuing after a specific marker. This helps in maintaining consistent formatting and structure in the generated text.

Seed values can be used to make the output reproducible. By setting a specific seed, you can ensure that the same input produces the same output. This is valuable for debugging and testing. You can also use the seed parameter to explore different variations of a response while keeping other parameters constant. Experiment with different combinations of these parameters to find the optimal settings for your application.

Implementing Streaming and Function Calling

Streaming is a key feature for improving the user experience in chat applications. Our API supports streaming over Server-Sent Events (SSE). This allows you to receive tokens as they are generated, rather than waiting for the entire response. Streaming reduces the perceived latency and provides a smoother interaction for end users. The usage information is included in the last chunk of the stream.

To enable streaming, set the stream parameter to true in your request. Your client must handle the SSE events and parse the tokens as they arrive. This requires a bit more code than standard synchronous requests, but the benefit is immediate feedback. You can display the text as it is generated, creating a typing effect that feels more natural.

Function calling is another powerful feature supported by the API. You can define tools that the model can invoke to perform specific actions. This is useful for applications that require the model to interact with external systems or retrieve data. The model will return a function call object that you can execute on your backend. This enables more complex and interactive applications.

JSON mode is also available for structured output. If you need the model to return data in a specific format, you can enforce JSON output. This is particularly useful for applications that parse the response programmatically. Ensure that your system prompts clearly instruct the model to return valid JSON. This reduces the need for post-processing and error handling.

Pricing, Credits, and Payment Methods

Understanding the pricing structure is essential for budgeting your API usage. Our service charges $0.15 per million input tokens and $0.50 per million output tokens. These rates are applied to real token usage, including both the prompt and the completion. Errors and refusals are free, so you only pay for successful responses. This can be cost-effective for applications with high volumes of requests.

There is no subscription or monthly fee. You pay only for what you use. The prepaid credit never expires, so you can top up when convenient. This flexibility is beneficial for projects with variable usage patterns. You can start with a small amount and scale up as needed. The trial credit of $0.50 allows you to test the API without any financial commitment.

Payments are accepted only in cryptocurrency. You can top up using USDT on the TRC20 network or USDC on the Base network. The minimum top-up amount is $20, and the maximum is $500. There is no support for credit cards, PayPal, or bank transfers. This crypto-only approach may appeal to users who prefer decentralized payment methods. Ensure that you send the correct amount in the specified cryptocurrency to receive the corresponding credit.

Bonus credit is available for top-ups of $50 or more. The bonus ranges from 5% to 15%, depending on the amount. This provides additional value for larger purchases. Keep track of your credit balance to ensure you have sufficient funds for your requests. If you run out of credit, the API will return a 402 error until you top up.

Testing and Verifying Response Integrity

Once you have integrated the API, it is important to test the responses to ensure they meet your quality standards. Start with simple prompts to verify that the model is responding correctly. Check that the system prompts are being respected and that the temperature settings are producing the desired level of creativity. Use the seed parameter to reproduce specific responses for consistent testing.

Verify that the streaming functionality works as expected. Ensure that tokens are arriving in real-time and that the usage information is accurate in the final chunk. Test the function calling feature by defining a simple tool and observing if the model invokes it correctly. This helps in validating the integration of complex features.

Check for any unexpected refusals or errors. The API has a hard limit on sexual content involving minors, so ensure that your test cases do not trigger this limit unintentionally. Also, monitor for rate limit errors (429) if you are sending a high volume of requests. The limit is 300 requests per minute per key. Adjust your request rate if you encounter throttling.

Document your test results and parameter settings. This will help you optimize the API for production use. Keep a record of the system prompts, temperature values, and other parameters that yield the best results. This documentation will be valuable when onboarding new developers or troubleshooting issues in the future. Regular testing ensures that the API continues to perform as expected.

When This API Is Not the Right Choice

While our API is powerful for text generation, it may not be the right choice for all applications. If you need embeddings, image generation, audio processing, or video creation, this service does not support those capabilities. It is strictly a text-in, text-out API. For projects requiring multimodal outputs, you may need to combine this service with other tools or providers.

Similarly, if you require OCR, fine-tuning, or model routing, this API does not offer those features. It serves a single uncensored open-weight model. If you need to switch between different models or access a variety of specialized models, you might find the single-model focus limiting. Check the documentation of other providers if you need a broader range of model options.

Additionally, if you prefer traditional payment methods like credit cards or PayPal, this crypto-only service might not suit your workflow. The top-up process requires sending cryptocurrency, which may be a barrier for some users. Also, if you need guaranteed uptime SLAs or specific certifications like SOC2 or HIPAA, this independent service does not claim those. Verify these requirements against your project needs before integrating.

Finally, if you are looking for a free unlimited tier, this service is not that option. It operates on a prepaid credit model. While the trial credit allows for testing, sustained usage requires purchasing credit. For applications with extremely high volume and low budget constraints, the per-token pricing might be a consideration. Evaluate your total cost of ownership based on your expected token usage.

Frequently asked questions

How do I authenticate requests to the API?

Include your API key in the Authorization header using the Bearer scheme. You can generate a key by signing up with Google or email and password. The key is displayed immediately after registration.

What is the context window size?

The context window is 100,000 tokens, which includes both the prompt and the completion. This allows for processing long documents or conversations.

Can I use the API for function calling?

Yes, the API supports function calling (tools). You can define tools in your request, and the model will return function call objects that you can execute.

What happens if I run out of credit?

If you have no credit, the API will return a 402 error. You can top up using USDT on TRC20 or USDC on Base, with amounts between $20 and $500.