SillyTavern "API Returned an Error: Bad Request" | 400 Causes and Fixes
Bad Request means the provider rejected a parameter, and SillyTavern hides the reason unless Streaming is on. With ULK Cloud, check five settings: Request token probabilities, Logit Bias, Multiple swipes per generation, Send inline media, and Include Body Parameters.
When SillyTavern shows "API returned an error" with only "Bad Request" underneath, the provider behind your Custom (OpenAI-compatible) connection rejected something in the request, and SillyTavern hid the reason. The reason is still there. It is printed in the terminal window that runs SillyTavern, and it shows up in the error popup once Streaming is on. The fix is almost always one setting: a parameter the provider does not accept (on ULK Cloud, one of five SillyTavern settings adds it), or, on some other providers, the order of the messages, which Prompt Post-Processing fixes.
This article was checked against the SillyTavern 1.19.1 source code and the ULK Cloud API on November 30, 2026.
Why the message only says "Bad Request"
With Streaming turned off, which is SillyTavern's default for Chat Completion, the SillyTavern server receives the provider's error but passes only the HTTP status text to the browser. The popup gets the title "API returned an error" and the text "Bad Request". The provider's own message, which names the problem, never reaches the screen.
With Streaming turned on, the server forwards the provider's error body as it is. The popup is titled "Chat Completion API" and shows the provider's message, for example Unsupported parameter: 'logprobs'.
Find the cause in two ways
- Read the terminal. Look at the window where you started SillyTavern (the console of
Start.batorstart.sh). Each failed request prints a line that begins withChat completion request error:, followed by the status text and the provider's full error. - Turn on Streaming and send again. Open AI Response Configuration (the sliders icon), check Streaming, and regenerate. The popup now shows the provider's message.
ULK Cloud's error always names the field it rejected in param:
{
"error": {
"message": "Unsupported parameter: 'logprobs'.",
"type": "invalid_request_error",
"param": "logprobs",
"code": "unsupported_parameter"
}
}
The five settings that cause a 400 on ULK Cloud
ULK Cloud rejects any parameter it does not support, instead of silently dropping it. With a fresh Custom connection, SillyTavern sends only parameters that ULK Cloud accepts. The 400 appears after one of these settings is turned on.
| Setting | What gets sent | ULK Cloud's error |
|---|---|---|
| Request token probabilities | logprobs, top_logprobs | Unsupported parameter: 'logprobs'. |
| Logit Bias | logit_bias | Unsupported parameter: 'logit_bias'. |
| Multiple swipes per generation | n of 2 or more | Invalid value for 'n' |
| Send inline media | An image inside messages | Invalid value for 'messages.0.content' |
| Include Body Parameters | What you typed there, such as min_p | Unsupported parameter: 'min_p'. |
Where each setting is and how to fix it:
- Request token probabilities (User Settings → Chat/Message Handling). Uncheck it. ULK Cloud does not return token probabilities.
- Logit Bias (AI Response Configuration). It is sent only when the selected preset has entries. Remove the entries, or switch to a preset with none.
- Multiple swipes per generation (AI Response Configuration). Set it to
1. ULK Cloud returns one answer per request, so swipe one at a time. - Send inline media (AI Response Configuration). It fails only when an image is attached. Remove the image from the message, or uncheck the setting. ULK Cloud accepts text only.
- Include Body Parameters (API Connections → Additional Parameters). Delete the lines for parameters ULK Cloud does not take, such as
min_portop_a. Supported sampling parameters aretemperature,top_p,presence_penalty,frequency_penalty,stop, andseed, and SillyTavern already sends the ones it has sliders for.
The error is returned before the request reaches a model, so a rejected request is not charged.
Bad Request on other providers: Prompt Post-Processing
Some providers other than ULK Cloud return 400 when the roles (system, user, assistant) come in an order they do not accept, for example two user messages in a row or a system message in the middle of the chat. In the connection settings, set Prompt Post-Processing to Merge consecutive roles or Strict (user first, alternating roles). SillyTavern then joins messages with the same role before sending, and Strict also makes the first message a user message. Choose the "(no tools)" variant unless you use function calling. ULK Cloud does not reject requests for their role order, so with ULK Cloud you can leave it at None.
Errors that are not "Bad Request"
With Streaming off, the popup shows the status text. Each one points to a different cause.
| Text in the popup | ULK Cloud code | What to do |
|---|---|---|
| Unauthorized (401) | invalid_api_key | Paste the key again into Custom API Key. ULK Cloud keys start with sk-ulk-. |
| Payment Required (402) | insufficient_balance, monthly_limit_reached | Add credit, or raise the key's monthly limit in the console. |
| Not Found (404) | model_not_found | Pick the model from Available Models instead of typing it. IDs are listed on the models page. |
| Too Many Requests (429) | rate_limit_exceeded | Wait a moment. One key can send 1,000 requests per minute. |
| Bad Gateway (502) | upstream_error | Send again. It was not charged. |
| Gateway Timeout (504) | upstream_timeout | Send again. It was not charged. |
Why ULK Cloud rejects instead of ignoring
Many OpenAI-compatible APIs accept a parameter they do not support and drop it. The request works, so you never learn that your min_p had no effect. ULK Cloud returns the error so that a setting you rely on cannot quietly stop working. The cost is the one-time fix above.
There are three exceptions: top_k, repetition_penalty, and transforms. ULK Cloud accepts them and ignores them, because Janitor AI sends them in its requests: top_k and repetition_penalty come from its sampling settings, and transforms is added automatically. Setting them has no effect on the output.
FAQ
Does "Bad Request" mean my API key is wrong?
No. A wrong key gives "Unauthorized" when Streaming is off. With Streaming on, SillyTavern changes the provider's 401 into a 400 (a 401 would reset the browser's login for SillyTavern itself), and the popup shows ULK Cloud's message Incorrect API key provided.
Can I use top_k, min_p, or repetition penalty with ULK Cloud?
No. min_p is rejected with unsupported_parameter. top_k and repetition_penalty are accepted but ignored, so they do not cause an error and do not change the output. Use frequency_penalty and presence_penalty to reduce repetition, and temperature and top_p for sampling. SillyTavern shows all four as sliders for a Custom source.
Am I charged for requests that fail with 400?
No. ULK Cloud checks the request before it reaches a model, and a rejected request costs nothing.
Will the same fix work with other providers?
The first step works everywhere: the terminal line Chat completion request error: shows what any provider returned. Which parameters a provider rejects differs from provider to provider.