#sillytavern 401“unauthorized”
6 messages · Page 1 of 1 (latest)
A 401 "unauthorized" error in SillyTavern after configuring request headers usually means the API key is missing, incorrect, or not authorized for the model or endpoint you're accessing. Double-check that your OpenRouter API key is correctly set and has the necessary permissions. Also, ensure the API key is included properly in the headers (usually as Authorization: Bearer <API_KEY>). If the key and headers are correct, verify your account status and API key validity on OpenRouter.
For more details on proper header configuration and API key usage, see the OpenRouter request headers documentation Request headers.
Are you using a specific model or provider with SillyTavern?
Why does SillyTavern show an error 400 "API key invalid" when using an authorized API key?
SillyTavern may show a 400 "API key invalid" error even if the API key is authorized due to these common issues:
- The API key might be incorrectly formatted or have extra spaces.
- The API key is not properly included in the request headers (should be
Authorization: Bearer <API_KEY>). - The base URL or endpoint in SillyTavern is set incorrectly for OpenRouter API.
- The model or provider requested is not supported or mismatched with the API key permissions.
- There might be a typo or case sensitivity issue in the API key.
Double-check your API key formatting, header setup, and endpoint configuration to ensure they match OpenRouter's requirements.
If the problem persists, regenerate your API key from your OpenRouter account Create API key.
Which model are you trying to use with SillyTavern?
-# This is an automated response. Use !mute to stop the bot from responding.
Why does this situation occur?
This situation occurs because SillyTavern requires the API key to be correctly formatted and included in the request headers for authentication. Even if the key is authorized, a 400 "API key invalid" error can happen due to:
- Incorrect API key formatting or extra spaces.
- Improper inclusion of the API key in headers (
Authorization: Bearer <API_KEY>). - Using the wrong base URL or API endpoint.
- Requesting unsupported models or mismatched permissions.
- Typos or case sensitivity issues in the API key.
Make sure your API key is copied exactly from OpenRouter, included properly in the request headers, and that your endpoint matches OpenRouter's API (https://openrouter.ai/api/v1). Regenerate your API key if needed in your OpenRouter account Create API key.
Which model are you trying to use with SillyTavern? This can help pinpoint the issue.
-# This is an automated response. Use !mute to stop the bot from responding.