hi ▾
Try with trial credit

Codex nsfw API Documentation

Integrate the uncensored model into your workflow with a simple OpenAI-compatible endpoint. Pay only for tokens via crypto, keep your data private, and generate unrestricted text without subscription lock-in.

https://api.codexnsfw.com/v1uncensored

Authentication & Base URL

Start every request with your API key in the authorization header. Use https://api.codexnsfw.com/v1 as your base URL to ensure compatibility with standard SDKs. You receive one active key per account, which you can regenerate immediately if needed. This setup works with any OpenAI-compatible client by simply updating the base URL configuration.

Chat Completions Endpoint

Send your prompts to POST /v1/chat/completions using the model identifier "uncensored". This endpoint handles text input and returns text output without content filters for lawful adult use. You can control parameters like temperature and top_p to adjust creativity. Requests are processed on our dedicated servers, ensuring minimal latency and direct access to the model.

Streaming Responses via SSE

Enable streaming by setting stream: true in your request body. The API returns Server-Sent Events (SSE) that allow you to render text token-by-token. The final chunk in the stream contains the total token usage for billing purposes. This approach reduces perceived latency for users waiting for long-form content or complex reasoning chains.

Function Calling & Tools

Define tools in your request to enable the model to call external functions. Use the tools and tool_choice parameters to guide execution. The model returns structured arguments that your code can parse and execute. This feature supports standard tool definitions, allowing you to integrate the API into broader workflows without manual parsing of natural language outputs.

JSON Mode for Structured Output

Force the model to return valid JSON by setting response_format: {"type": "json_object"}. This ensures predictable output for programmatic consumption, which is critical for automating workflows. The model adheres strictly to the schema you provide, reducing the need for post-processing validation. Use this mode when building chatbots or data extraction pipelines that require consistent formatting.

Rate Limits & Constraints

Each API key supports 300 requests per minute and 8 concurrent requests. The maximum request body size is 8 MB. The context window allows 100,000 tokens for prompt and completion combined. If you exceed limits, you receive a 429 error. Errors and refusals do not consume credit, so you can test safely without financial risk.

cURL

curl https://api.codexnsfw.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Set system clock to 12:00 UTC"}]
  }'

Python

from openai import OpenAI

client = OpenAI(base_url="https://api.codexnsfw.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)

Node.js

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.codexnsfw.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);

Streaming

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)

Common questions

Is the codex NSFW API compatible with OpenAI SDKs?

Yes, it uses the same endpoint structure and parameters as the OpenAI API. You only need to update the base URL to <code>https://api.codexnsfw.com/v1</code> and provide your API key. This allows you to use existing client libraries without code changes.

What happens if I get a 402 error?

A 402 error indicates that your prepaid credit is exhausted. You can top up instantly using USDT (TRC20) or USDC (Base) to resume service. Credit never expires, so you can add funds whenever convenient.

Does the uncensored model filter sexual content involving minors?

Yes, there is a hard content limit that always applies. Requests containing sexual content involving minors are refused regardless of other settings. All other lawful adult, fictional, or controversial topics are allowed.

Secure your API key

Register, retrieve your key, and update your base URL. Simple configuration.

Try with trial creditView documentation