EN ▾
Get API key

NsfwAiApiGuide

SillyTavern OpenAI Compatible API: Step-by-Step Setup

A SillyTavern OpenAI compatible API connection works through its custom Chat Completion source. This page shows the fields to fill in, the values to use for this service, and the settings worth changing for roleplay.

Updated

A plug connecting a chat interface to a server cube with slider dials, representing SillyTavern API setup
Isometric illustration comparing a local GPU box and a hosted server cluster joined by chat bubbles

Before you start

You need three things: a running SillyTavern install, an API key, and the endpoint details. For the key, sign up on the API key page with Google or email, then claim the $0.50 trial credit with one click. It needs no payment method and lasts 7 days. Full top-ups are paid in crypto (USDT on TRC20 or USDC on Base), starting at $20.

The values you will paste:

FieldValue
Base URLhttps://api.nsfwaiapi.com/v1
Model IDuncensored
AuthBearer key sent as the API key

Do not add /chat/completions to the base URL. SillyTavern appends the path itself.

The model is tuned to answer without content refusals for lawful adult use. Sexual content involving minors is never allowed, so keep your character definitions to adults.

Check the key outside the app

A two-minute test saves a lot of guessing. If curl works, any later failure is a SillyTavern setting, not your key.

curl https://api.nsfwaiapi.com/v1/models \
  -H "Authorization: Bearer YOUR_KEY"

A JSON list that includes uncensored means the key and URL are right. Then try a real completion:

curl https://api.nsfwaiapi.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"uncensored","messages":[{"role":"user","content":"Say hi in five words."}]}'

A reply with a choices array confirms generation works. The X-Balance-USD response header shows your remaining credit. More endpoint detail is in the docs.

Connect SillyTavern step by step

  1. Open the plug icon (API Connections) in the top bar.
  2. Set the API type to Chat Completion.
  3. In the source dropdown, choose Custom (OpenAI-compatible).
  4. In the custom endpoint field, paste https://api.nsfwaiapi.com/v1.
  5. Paste your key into the API key field and save it.
  6. In the model ID field, type uncensored. If the app offers a model list after connecting, pick the same name.
  7. Press Connect. A green status line means the app reached the endpoint.

Menu labels shift a little between SillyTavern releases, so if a field has a different name, look for the one that holds the endpoint URL. The idea is the same in every version: the app sends standard OpenAI-format requests to the URL you give it.

Context size and response length

This model has a 100,000-token context window, shared by the prompt and the reply. SillyTavern sends your character definition, world info, chat history and system prompt each turn, and you decide how much history to include with the context size slider.

Bigger is not automatically better. Input is billed at $0.15 per 1M tokens, so a request that fills 32,000 tokens of context costs 32,000 / 1,000,000 x $0.15 = $0.0048 before the reply. At 100,000 tokens it is $0.015 per request. Over a 200-message evening that gap is real money relative to a $20 balance: 200 x $0.0048 = $0.96 versus 200 x $0.015 = $3.00 in input alone, assuming the context is full from the first message, which overstates it for a new chat.

A practical start is 16,000 to 32,000 tokens of context and a response length of 300 to 500 tokens. Raise the context only when the character forgets things that matter. The roleplay model guide goes into how long contexts affect scenes.

Sampler settings to try

With the chat completion source, SillyTavern sends the sampler values the API accepts. This service passes through temperature, top_p, stop, seed and the frequency and presence penalties.

  • Temperature: 0.85 to 1.0 for creative scenes, 0.6 to 0.7 if the character wanders.
  • Top P: 0.9 to 0.95.
  • Frequency and presence penalty: 0.2 to 0.5 to cut repeated phrasing in long chats.
  • Streaming: turn it on. Replies appear word by word and feel faster. A streamed request holds a concurrency slot until the stream ends, which matters only if you run several chats at once.

Settings that belong to other backends, such as top_k, min_p or repetition penalty from local engines, may be ignored. If a slider has no visible effect, do not spend time on it.

Fixing common errors

401 or an authentication failure

The key was pasted with a space or the wrong value. Paste it again and press save before Connect.

404 or a model error

Check the base URL ends in /v1 and the model ID is exactly uncensored, lowercase.

429 with code rate_limited or concurrency

A full key allows 300 requests per minute and 8 at once; a trial key allows 60 per minute and 2 at once. If you have several tabs or a group chat generating together, you can hit the concurrency cap. Wait a moment and retry. A 429 with a Retry-After: 5 header means temporary overload, so waiting five seconds is the right move.

Reply cut off mid-sentence

Raise the response length in SillyTavern. The API itself lets a completion use the rest of the window.

Balance runs out

Failed or refused requests are not charged, but successful ones are. Check pricing for top-up amounts and bonuses.

Prompts, presets and group chats

Chat Completion mode builds each request from a list of prompt blocks: main prompt, character description, scenario, example dialogue, world info and chat history. You can reorder or switch them off in the prompt manager. Two habits pay off.

  • Keep the main prompt short. A few lines on voice, length and the rule that the model never writes the user's lines. Long, repeated instructions use input tokens on every turn.
  • Trim example dialogue. The model copies the length and style it sees. Two short examples beat six long ones.

Group chats send one request per speaking character. With a trial key limited to 2 concurrent requests, a group of four that generates in parallel may trigger a concurrency 429. Set the group to generate one reply at a time, or move to a full key with 8 concurrent slots.

When you swap characters, remember the chat history is resent each time. A new chat starts with a small context and a small bill, so open a fresh chat for a new scene instead of dragging a 60,000-token history along.

What a session costs

Take an evening of 100 messages. Say the average request carries 12,000 tokens of input and returns 350 tokens. Input: 100 x 12,000 = 1,200,000 tokens, which is 1.2 x $0.15 = $0.18. Output: 100 x 350 = 35,000 tokens, which is 0.035 x $0.50 = $0.0175. The total is about $0.20 for the whole evening.

Credit never expires and there is no subscription, so a $20 top-up covers roughly 100 evenings at that rate. Bonuses apply on larger top-ups: +5% from $50, +10% from $100, +15% from $200. The numbers move with your context size, which is the main lever you control.

Questions and answers

Which source do I pick in SillyTavern?

Chat Completion, then the Custom (OpenAI-compatible) source. Enter the base URL, your key and the model ID uncensored.

Do I add /chat/completions to the URL?

No. Use the base URL ending in /v1 and let SillyTavern add the path.

What context size should I set?

Start at 16,000 to 32,000 tokens. The window is 100,000, but filling it on every turn raises input cost.

Can I use the free trial?

Yes. New users can claim $0.50 of trial credit with one click after sign-up. It lasts 7 days and has lower rate limits.

Your key is one form away

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

Get API key

NsfwAiApiUncensored LLM API for NSFW text generation