EN ▾
Uncensored AI API for free usehttps://api.apisemrestricoes.com/v1

Janitor AI API tutorial: set up in 6 steps

This Janitor AI API tutorial shows how to connect Janitor AI to an OpenAI-compatible API, with URL, key, and model, and how to fix the most common errors. A quick curl test first saves hours of trial and error.

Uncensored AI: Checklist for Production Implementation

Updated

Speech bubble connected by a luminous cable to a server, symbolizing the connection of Janitor AI to an API

Key points

  • Test the key with curl before modifying Janitor AI
  • Base URL and uncensored model ID are the two fields that cause the most errors
  • Messages with 8,000 context tokens cost about US$ 0.00135
  • Reduce context if the conversation becomes expensive or slow

What you need before starting

Janitor AI is a character chat site used for fiction and roleplay among adults. It lets you configure your own API in the chat settings, and that is where an OpenAI-compatible endpoint comes in. This part of the janitor ai api tutorial lists what you need to have ready:

  • an account on Janitor AI and the minimum age required by the site itself;
  • an API key, which you get on the key page after signing up;
  • the base URL https://api.apisemrestricoes.com/v1;
  • the model ID: uncensored.

If you don't have a balance yet, signing up lets you redeem US$ 0.50 in trial credit with one click, once per person and valid for 7 days. This is enough for a good number of test messages, as shown in the calculation below.

Step 1: test the key outside Janitor AI

The most common error is blaming Janitor AI for a problem in the key or URL. Test with curl first. If it works here, the rest is just copying the values.

curl https://api.apisemrestricoes.com/v1/chat/completions \
  -H "Authorization: Bearer SUA_CHAVE" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [
      {"role": "system", "content": "Você é um narrador de fantasia."},
      {"role": "user", "content": "Descreva a entrada de uma taverna em duas frases."}
    ],
    "max_tokens": 150
  }'

A JSON response with the text in choices[0].message.content confirms that the key, model, and network are correct. If you get an error here, fix it before proceeding.

Want to see the text arriving gradually, like in a chat? The same test in Python, with streaming, uses the OpenAI SDK:

from openai import OpenAI

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

stream = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Continue a cena da taverna."}],
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

Streaming uses SSE and delivers token usage at the end. While the stream is not finished, the request occupies one of the key's parallel request slots.

Steps 2 to 5: configure the API in Janitor AI

The exact names of Janitor AI menus and buttons change over time, so I describe the path generally. If in doubt, check the site's own help.

  1. Open a chat with the character and go to API or chat generation settings.
  2. Choose the custom API or proxy option, instead of the site's default model. This is the field that lets you enter your own address.
  3. Fill in the URL. Many guides use the full address of the chat method, i.e., https://api.apisemrestricoes.com/v1/chat/completions. If the connection fails with this format, also test the base https://api.apisemrestricoes.com/v1, depending on what the site field asks for.
  4. Enter the key and model. Paste the key into the key field and write uncensored in the model name field, exactly like this, in lowercase.
  5. Save and send a test message. If the response arrives, Janitor AI is talking to the API.

Treating the address as a "proxy" is just the name the site gives the option. Behind the scenes, it is a POST /v1/chat/completions call in the OpenAI format.

Step 6: adjust context and response size

Janitor AI has its own generation controls, and they directly affect cost and quality.

Context

The context window is 100,000 tokens, including prompt and response. There is no need (nor is it cheap) to fill it up. In roleplay conversations, the history is resent with each message, so a large context means a large input for each response. A value between 8,000 and 16,000 tokens is usually a good starting point.

Response size

If responses come out short or cut off, increase the output token limit in the site settings. The max_tokens parameter is optional in the API, and the response can use the rest of the window.

Temperature

Higher values give more varied responses, and lower values give more predictable ones. The temperature, top_p, stop, seed parameters and penalties are passed through to the model.

How much does each message cost

The price is US$ 0,15 per 1M input tokens and US$ 0,50 per 1M output tokens. In roleplay, the input weighs more because it includes the character sheet, instructions, and history. Two scenarios, with a 300-token response:

Sent contextInput costOutput costTotal per messageMessages with US$ 0.50
8,000 tokensUS$ 0,0012US$ 0,00015$0.00135about 370
16,000 tokensUS$ 0.0024US$ 0.00015US$ 0.00255about 196

A US$ 20 top-up yields, in the first scenario, about 14,800 messages (20 divided by 0.00135). Doubling the context almost doubles the cost, so only increase it if the story really needs long-term memory. See the top-up and bonus table at prices.

Common errors and how to fix them

  • "Network error" or connection error. Check the URL: typo, missing https:// or /v1. Test the same URL using curl.
  • Authentication error. The key is incomplete or contains a space. The format is Bearer followed by the key, and the site handles this when you fill in the correct field.
  • Model error. The only ID is uncensored. Model names from other companies do not exist on this endpoint.
  • HTTP 429. The rate_limited code indicates too many requests per minute, and concurrency indicates too many simultaneous requests. The test key limit is 2 concurrent requests and 60 per minute; the full key allows 8 and 300. Avoid opening multiple chats that generate simultaneously. If you receive Retry-After: 5, wait 5 seconds.
  • Zero balance. Check the X-Balance-USD header or the GET /v1/balance endpoint.
  • Slow chats or occasional failures. Very large contexts increase response time. Reduce the context and, if there is a 429 with Retry-After: 5, try again after a few seconds instead of resending in sequence.
  • Response that does not respect the character. This is usually due to the prompt, not the connection. Refine the character description and instructions.

Security and usage limits

You will paste an API key into a third-party site. Therefore, use the balance you are willing to risk and do not reuse the same key in other projects. Also read the Janitor AI privacy policy, as conversations pass through their service. On this API, prompts are not used for training.

A simple practice helps: use one key only for Janitor AI and top up small amounts. Top-ups range from US$ 20 to US$ 500, in USDT on the TRC20 network or USDC on the Base network, and the credit never expires, so idle balance is not lost. If the key leaks, the loss is limited to the balance that was there.

The model is open, hosted by an independent provider, and responds without content refusals for legal adult use. Sexual content involving minors is prohibited, without exception. The API generates text only. For production configuration of any app, read the production checklist, and for the details of each endpoint, the documentation.

More guides

Frequently asked questions

Do I need my own proxy to use Janitor AI with this API?

No. In Janitor AI, "proxy" is the name of the option to provide an OpenAI-compatible endpoint. You enter the API URL, the key, and the model name.

What model name do I put in Janitor AI?

Use uncensored, in lowercase. It is the only model ID available on this endpoint.

Can I test without paying?

Yes. After registration, the key page allows you to redeem US$ 0.50 of free trial credit with one click, valid for 7 days.

The connection fails even when everything is correct. What do I check?

Test the key and URL with curl. If curl works, adjust the URL format in the Janitor AI field and check their help, as the interface may change.

Your key is just one form away

Create an account, copy the key, and change the base URL. That is all the configuration.