Install the Official SDK
Start by installing the official OpenAI SDK for your preferred language. The beauty of our API is that it uses the same client libraries you already know. You do not need a custom library or a complex setup script. pip install openai or npm install openai gets you ready. This approach means your existing codebase adapts with minimal friction. You can switch between providers without rewriting your core logic.
Configure Base URL and Key
Point your client to our specific base URL and inject your API key. Our endpoint lives at https://api.groknsfwprompts.com/v1. This URL ensures you hit our uncensored model directly. You must set the base_url parameter in your SDK configuration. Pass your key via the standard api_key header. This setup bypasses the default OpenAI routing. It guarantees you are talking to our servers, not theirs.
Here is how you configure the connection in a standard request:
curl https://api.groknsfwprompts.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Describe a cybernetic woman in a neon city"}]
}'
Send Your First Request
Send a simple chat completion to verify your connection. Use the model ID uncensored for all requests. This ID points to our open-weight model tuned for adult content. Send a prompt that would normally trigger a filter. The model will return the raw text without refusal. You get immediate text output for your prompt engineering needs. This step confirms your credit balance is active.
Try this minimal Python script to test connectivity:
from openai import OpenAI
client = OpenAI(base_url="https://api.groknsfwprompts.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)
Enable Streaming for Real-Time Output
Enable streaming to receive tokens as they generate. This reduces perceived latency for long responses. Set stream=True in your request parameters. The SDK will yield chunks as they become available. This is crucial for video prompt generation where you want instant feedback. You can abort the stream if the response goes off-track. It provides a smoother developer experience for iterative testing.
Here is the streaming implementation pattern:
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 Function Calling and JSON Mode
Leverage structured output for consistent data parsing. Use response_format={"type": "json_object"} for strict JSON. This ensures your downstream parsers receive valid data. You can also define tools for function calling. The model supports standard tool definitions and choices. This feature is vital for automated NSFW prompt generation pipelines. It keeps your data structure predictable and clean.
See how to enforce JSON mode in Node.js:
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.groknsfwprompts.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);
Understand Token Limits and Pricing
Monitor your usage against our clear limits. We charge $0.15 per million input tokens and $0.50 per million output tokens. Your context window spans 100,000 tokens total. You can output up to 16,000 tokens per request. Rate limits cap you at 300 requests per minute. Handle errors like 402 (no credit) or 429 (rate limit) gracefully. Errors and refusals do not consume your credit. This model favors heavy prompt engineering workflows.