Get API key
Get API key

Grok API Uncensored: Integration Guide

The Grok API Uncensored integration guide explains how to connect your app to our dedicated uncensored LLM endpoint, optimized for romantic and adult roleplay scenarios without the constraints of traditional LLMs. This page covers the technical steps to authenticate, configure, and send requests using our OpenAI-compatible interface, ensuring you get reliable, uncensored text generation for your AI girlfriend or companion app.

Updated:

Key points

  • Our API serves a dedicated open-weight model identified as "uncensored," not xAI's Grok, optimized for adult roleplay.
  • Integration is straightforward using the standard OpenAI SDK by changing the base URL and API key.
  • Pricing is transparent at $0.25/1M input tokens and $1.00/1M output tokens with no monthly fees.
  • The endpoint supports streaming via SSE and function calling, with a 100k token context window.

What is Grok API Uncensored?

When developers search for a Grok API uncensored solution, they are often looking for an LLM that doesn't shy away from adult themes, spicy dialogue, or unrestricted creative writing. While the term "Grok" is frequently associated with xAI's models, our uncensored AI API provides a distinct, dedicated endpoint. It is not xAI’s Grok. It is an open-weight model hosted on our own GPU servers, specifically tuned to answer without content refusals for lawful adult use.

This NSFW LLM API is designed for developers building AI girlfriends, companions, or roleplay bots who need consistent, uncensored text generation. Unlike general-purpose models that might filter out romantic or mature content, our model is optimized for conversational fluency in these specific contexts. It maintains a natural, engaging tone suitable for long-form roleplay, ensuring your users get the immersive experience they expect without unexpected content blocks.

Why Use Grok for AI Girlfriend Apps?

Building an AI girlfriend API application requires a model that can handle emotional nuance, romantic tension, and adult themes without breaking character. Traditional LLMs often apply strict safety filters that can feel jarring during intimate roleplay. Our uncensored chatbot API eliminates these distractions, allowing for more authentic and engaging interactions.

  • No Content Refusals: The model is tuned to accept lawful adult content, ensuring smoother roleplay sessions.
  • Optimized for Conversation: The architecture prioritizes conversational flow and memory, crucial for long-term companion apps.
  • Predictable Costs: With pay-as-you-go pricing, you only pay for what you use, making it ideal for indie developers scaling their user base.
  • Simple Integration: As an OpenAI-compatible endpoint, it works with existing SDKs, reducing development time.

This approach allows you to focus on building your application's unique features rather than wrestling with complex moderation layers.

Setting Up Your Environment

To integrate our uncensored LLM API, you need a standard development environment capable of making HTTP requests. Most developers use Python, Node.js, or cURL for quick testing. Since our API follows the OpenAI compatibility standard, you can leverage existing libraries like openai for Python or openai for Node.js.

Ensure you have an account set up on roleplayapi.com. During signup, you will receive an API key immediately. This key is your primary credential for all requests. Keep it secure, as it grants access to your prepaid credit. You can regenerate the key at any time if needed, which will invalidate the old one.

For local testing, you might use tools like Postman or cURL. For production apps, integrate the SDK directly into your backend service. The base URL for all requests is https://api.roleplayapi.com/v1. This URL is critical for routing your requests to our uncensored model endpoint.

Authenticating with Your API Key

Authentication for our uncensored AI API is handled via the standard Authorization header. Each request must include your API key in the format Bearer YOUR_API_KEY. This ensures that only authorized requests are processed against your prepaid balance.

When you sign up, you get a key instantly. No credit card is required for the trial, which gives you $0.50 of credit valid for 7 days. This allows you to test the integration thoroughly before committing to a paid plan. For paid plans, you can top up with crypto (USDT or USDC), starting at $10.

Here is how you set the header in a typical request:

  • Header Name: Authorization
  • Header Value: Bearer sk-your-api-key-here

Ensure your API key is stored securely in your application's environment variables, not hardcoded in your source code. This prevents accidental exposure if your code is shared or pushed to a public repository.

Configuring the Base URL

The most critical step in integrating any OpenAI-compatible API is setting the correct base URL. For our uncensored chatbot API, the base URL is https://api.roleplayapi.com/v1. This URL directs your requests to our dedicated uncensored model, not to xAI or OpenAI's servers.

When using SDKs, you typically pass this URL as a parameter. For example, in Python:

from openai import OpenAI

client = OpenAI(base_url="https://api.roleplayapi.com/v1", api_key="YOUR_KEY")

resp = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)

In Node.js:

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.roleplayapi.com/v1", apiKey: process.env.API_KEY });

const resp = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);

Using cURL:

curl https://api.roleplayapi.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Write a blunt product review of a cheap VPN."}]
  }'

Double-check this URL. If you use the default OpenAI base URL, your requests will go to the wrong service and likely fail. Our endpoint is specifically configured for our uncensored model, ensuring the content filters are applied correctly for adult roleplay scenarios.

Sending Your First Request

With your environment set up and authentication configured, you are ready to send your first request. The endpoint for chat completions is POST /v1/chat/completions. You must specify the model ID as uncensored. This tells the API to use our dedicated uncensored model.

Here is a basic example of a request structure:

curl https://api.roleplayapi.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Write a blunt product review of a cheap VPN."}]
  }'

The response will be a JSON object containing the generated text. Ensure you handle the response appropriately in your application, extracting the content from the choices[0].message.content field. This text is what your user will see in your AI girlfriend app.

Remember that our model has a context window of 100,000 tokens. This allows for long conversations without losing context, which is essential for immersive roleplay. If you exceed this limit, the API will return an error.

Handling Streaming Responses

For a better user experience, especially in real-time chat applications, you should use streaming responses. Our API supports Server-Sent Events (SSE) for streaming. This allows you to display text to the user as it is generated, rather than waiting for the entire response to complete.

To enable streaming, set the stream parameter to true in your request body. The API will return a stream of JSON chunks, each containing a portion of the generated text.

stream = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Tell the story in second person."}],
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

Handle these chunks by appending the text to your UI's display area. This creates a more engaging and responsive experience for your users. Streaming is particularly useful for long-form roleplay, where users appreciate seeing the AI's thoughts and dialogue appear in real-time.

Troubleshooting Common Errors

During integration, you may encounter common errors. Understanding these will help you debug your application quickly.

  • 401 Unauthorized: Your API key is incorrect or expired. Check your key and ensure it is passed in the Authorization header.
  • 429 Too Many Requests: You have exceeded the rate limit of 300 requests per minute per key. Implement exponential backoff in your client.
  • 413 Payload Too Large: Your request body exceeds 8 MB. Reduce the length of your conversation history or prompts.
  • 400 Bad Request: Check your JSON structure. Ensure the model ID is uncensored and the messages array is correctly formatted.

Always check the response body for detailed error messages. Our API provides clear descriptions to help you identify the issue. If problems persist, verify your base URL and authentication credentials.

Finalizing Your Integration

With your API key, base URL, and request structure configured, your uncensored AI API integration is complete. Test your application thoroughly, ensuring that streaming works correctly and that content filters behave as expected for your specific use case.

Remember that our model is designed for lawful adult use. While it is uncensored, it does block sexual content involving minors, a hard limit that always applies. This ensures compliance with general content standards while allowing for mature themes.

Monitor your usage and credit balance through your dashboard. With pay-as-you-go pricing, you can scale your AI girlfriend app efficiently without worrying about monthly fees. Integrate our uncensored LLM API and provide your users with an unrestricted, engaging roleplay experience.

Questions and answers

Is the Grok API Uncensored the same as xAI's Grok?

No. Our API serves a dedicated open-weight model identified as "uncensored," hosted on our own GPU servers. It is not xAI's Grok model. While it may share similar characteristics in terms of uncensored content, it is a distinct model optimized for our specific infrastructure and use cases.

What is the context window size for the uncensored model?

The context window is 100,000 tokens, covering both the prompt and the completion. This allows for long conversations and detailed roleplay scenarios without losing context. If you exceed this limit, the API will return an error indicating that the context window has been exceeded.

Can I use this API for NSFW content?

Yes, the model is specifically tuned to answer without content refusals for lawful adult use. It is ideal for NSFW LLM applications, AI girlfriend bots, and romantic roleplay. However, it does block sexual content involving minors, which is a hard limit that always applies.

How do I start testing the API?

You can sign up for a free trial account, which provides $0.50 of credit valid for 7 days. No credit card is required. You can then use your API key to make requests to the <code>https://api.roleplayapi.com/v1</code> endpoint. For paid plans, you can top up with crypto (USDT or USDC) starting at $10.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.