Authentication and base URL
Start by generating your key on the dashboard.
Use this base URL for all requests:
HTTPS://api.nsfwia.com/v1
Pass your key in the Authorization header. The endpoint accepts standard OpenAI-compatible clients.
Sending your first request
Send a POST request to /v1/chat/completions to get a response.
Use the model ID "uncensored" for text generation.
Input is text, output is text. No images or video.
Here is a basic curl example:
curl https://api.nsfwia.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "List the API endpoints and their HTTP methods"}]
}'
Streaming responses
Enable streaming by setting stream to true.
Receive tokens as they are generated.
Use SSE for real-time output.
This is ideal for roleplay.
Example streaming code:
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)
Function calling and JSON mode
Use function calling for structured data.
Set response_format to json_object for strict JSON.
Define tools in the request body.
This ensures reliable parsing.
Python SDK example:
from openai import OpenAI
client = OpenAI(base_url="https://api.nsfwia.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)
Parameters: temperature, top_p, and more
Adjust temperature for creativity.
Set top_p for nucleus sampling.
Use stop sequences to end generation.
Seed ensures reproducibility.
Node SDK example:
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.nsfwia.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);
Understanding token costs
Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens.
Errors are free. Refusals are free.
Context window is 100,000 tokens total.
Max output is 16,000 tokens per request.
Limits: 300 requests per minute, 8 concurrent requests.
Errors include 401 (invalid key), 402 (no credit), 429 (rate limit).