EN ▾
Get API key

OpenRouter API + SillyTavern: Use a Custom Endpoint

If you run an openrouter api + sillytavern setup and want another endpoint behind it, SillyTavern's custom OpenAI-compatible source does the job. These steps cover the fields, a test message, sensible settings and the usual errors.

Updated

Speech bubbles and a stage mask connected by one cable to a glowing model cube

Key points

  1. In SillyTavern, choose the Chat Completion API with the Custom (OpenAI-compatible) source, then paste the base URL, key and model ID.
  2. Use https://api.openrouterapi.top/v1 as the endpoint and uncensored as the model.
  3. A roleplay chat of 100 replies with an 8,000-token context costs roughly $0.14 at current prices.
  4. The model has a 100,000-token window, so you set the context size in SillyTavern yourself.

What you are connecting

SillyTavern is a self-hosted front end for chatting with language models, popular for roleplay, character cards and long-running stories. It does not ship a model. It talks to whatever API you give it. OpenRouter is one of the sources people use, since it offers many models behind a single key. SillyTavern also lets you add any server that speaks the OpenAI chat format, and that is the route used here.

The endpoint on this site serves one open-weight model, run by an independent provider and tuned to answer without content refusals for lawful adult use. For fiction, roleplay and companion apps for adults, that means the model does not stop a story because a scene turns dark or mature. The hard limit stays: no sexual content involving minors, and requests that cross it are not supported. The service is text only, so SillyTavern features that produce images or speech need their own, separate providers.

You do not have to give up OpenRouter to try this. SillyTavern keeps API connection profiles per source, so you can switch between them from the same screen.

Step by step in SillyTavern

Menu names change between releases, so treat the labels below as a guide. Recent versions follow this order.

  1. Create a key. Sign up on the API key page with Google or with email and password, then copy the key. New accounts can claim $0.50 of trial credit with one click on that page; it is valid for 7 days and needs no card.
  2. Open the connection panel. In SillyTavern, click the plug icon (API Connections).
  3. Select the API type. Set API to Chat Completion.
  4. Select the source. Set Chat Completion Source to Custom (OpenAI-compatible). This is the option for third-party OpenAI-style servers, and it is a different entry from the built-in OpenRouter source.
  5. Endpoint. Enter https://api.openrouterapi.top/v1 in the custom endpoint field. Do not add /chat/completions unless your version asks for the full route.
  6. Key. Paste the API key into the custom API key field.
  7. Model. Type uncensored into the model ID field. If your version offers a model dropdown filled from the server, press the connect button first and pick it from the list.
  8. Connect. Click Connect. A green status with the model name means the key and URL are accepted.

If you prefer to verify outside SillyTavern first, this request should return a short reply:

curl https://api.openrouterapi.top/v1/chat/completions   -H "Authorization: Bearer $API_KEY"   -H "Content-Type: application/json"   -d '{"model":"uncensored","messages":[{"role":"user","content":"Reply with OK."}],"max_tokens":5}'

When curl works and SillyTavern does not, the problem is almost always a typo in the endpoint, a stray space in the key, or a trailing route added twice.

Settings that matter for long chats

Two numbers control most of your experience: how much history is sent with every message, and how long a reply may be.

Context size

The model accepts up to 100,000 tokens, prompt plus completion. SillyTavern keeps its own Context Size slider, and it decides how much of the chat plus the character card plus lorebook entries gets resent each turn. A larger value gives the character a longer memory but costs more per message and makes each request slower to start. For most chats a value between 8,000 and 16,000 tokens is a comfortable range; raise it only when you notice the story forgetting things that matter.

Response length

Set Max Response Length to match the style you want, for example 300 tokens for conversational replies or 800 for scene writing. The API does not require max_tokens, but a cap keeps replies from running long and keeps cost predictable.

Sampling

Temperature, top-p, stop sequences, seed and the frequency and presence penalties are passed through to the model. A temperature around 0.7 to 0.9 suits creative writing; lower it if the character starts to ramble or contradict the card. Change one control at a time, otherwise you will not know which one fixed the problem.

Streaming

Turn on streaming in SillyTavern so words appear as they are generated. The API supports server-sent events. Keep in mind that a streamed request holds a concurrency slot until the stream ends. On a trial key that allows 2 requests at once, so avoid regenerating while a reply is still coming in.

What it costs for a typical chat

Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens. Roleplay is input heavy because the whole context is sent again with each reply, so the input side deserves the attention. Take a context of 8,000 tokens and a reply of 300 tokens:

  • Input: 8,000 / 1,000,000 x $0.15 = $0.0012.
  • Output: 300 / 1,000,000 x $0.50 = $0.00015.
  • One message: $0.00135.
  • One hundred messages: $0.135.

Doubling the context to 16,000 tokens raises the input part to $0.0024 and the message to $0.00255, so a hundred messages cost $0.255. Failed or refused requests are not charged, and credit never expires, so an unused balance simply waits for you. Top-ups start at $20 and go up to $500 in whole dollars, with a 5% bonus from $50, 10% from $100 and 15% from $200. Pay with crypto (USDT on TRC20, USDC on Base). See the pricing page for the full table.

The trial credit of $0.50 covers about 370 messages at the 8,000-token example above (0.50 / 0.00135), which is enough for an honest test of a few characters.

Differences from using OpenRouter directly

Some habits from the built-in OpenRouter source do not carry over. There is no model browser listing dozens of options, because there is one model. There are no per-model provider choices and no fallback model. If you used one OpenRouter model for narration and another for dialogue, you will now have the same model for both, which you can steer with the system prompt and the character card instead.

The limits are also your own to manage. A full key allows 8 concurrent requests and 300 requests per minute, which is far above what a single person chatting will reach. Group chats and automatic swipes can send several requests at once, so keep an eye on them if you use a trial key. For a comparison of token pricing with another provider, our page on DeepSeek API pricing and alternatives sets another provider next to this one, and you should always check that provider's current pricing yourself.

Fixing common errors

The response headers help with diagnosis: X-Request-Id identifies the call, and X-Balance-USD shows your credit. Common situations:

  • 401 or authentication error. The key is wrong or has a trailing space. Paste it again, and check that the key field belongs to the custom source, not to the OpenRouter source.
  • 404 or "model not found". The model ID must be exactly uncensored, lowercase.
  • Status stays red on Connect. Check the endpoint spelling and that it ends with /v1.
  • 429 with concurrency. Too many requests are running at once. Wait for the current reply to finish.
  • 429 with rate_limited. You exceeded the per-minute limit; pause briefly.
  • 429 with Retry-After: 5. Temporary overload. Wait five seconds and send again.
  • Request too large. The body limit is 8 MB; a very large lorebook or an oversized context can hit it. Lower the context size.

The quick-start docs list the same errors with request examples, in case you want to reproduce one outside SillyTavern.

Questions and answers

Which source do I pick in SillyTavern?

Use Chat Completion as the API and Custom (OpenAI-compatible) as the source. Then enter the endpoint https://api.openrouterapi.top/v1, your key and the model ID uncensored.

Does it work with character cards and lorebooks?

Yes. SillyTavern builds the prompt itself and sends it as chat messages, so cards and lorebooks work as usual within the 100,000-token window.

Is this the real OpenRouter API?

No. It is a separate OpenAI-compatible service with one open-weight model, run by an independent provider. It is neither a router nor an official vendor API.

Are my chats used for training?

No. Prompts are not used for training.

Can I try it without paying?

Yes. After sign-up you can claim $0.50 of trial credit with one click on the API key page. It lasts 7 days, needs no card and is one per person.

Your key is one form away

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

Get API keyRead the docs

$0.50trial credit