Wild West API

Fixing a 401 "Invalid or disabled API key" error

A 401 means the API could not match the key you sent to a live key on an account. Nothing was generated and nothing was charged.

What the error says

When the key is present but does not match, the API answers with HTTP 401 and this body:

{
  "error": {
    "message": "Invalid or disabled API key.",
    "type": "invalid_request_error",
    "code": null,
    "param": null
  }
}

Keys are looked up by their hash, and only keys that are not disabled are matched. So "invalid" and "disabled" give the same answer on purpose: a typo, a deleted key and a key you switched off in the dashboard all look identical from the outside.

Exact causes on this API

  • A typo or a truncated paste. Keys start with sk-ww-. A missing last character or a trailing space inside quotes is enough.
  • The key was disabled or deleted in the dashboard at /dashboard/.
  • A key from a different provider. An OpenAI, OpenRouter or other key pasted into the Wild West slot will never match.
  • The key is not attached to an account. This is rare and returns 401 with Key is not attached to an account.

How it shows up

In SillyTavern the Connect button can still show a green status, because the model list at GET /v1/models is public and needs no key. The 401 only appears when you send a message, as an error toast quoting the message above. In the OpenAI Python SDK it raises openai.AuthenticationError; the Node SDK throws AuthenticationError. Neither SDK retries it.

Step by step fix

  1. Sign in at /signup/ with the six digit code sent to your email.
  2. Open /dashboard/ and check the key is listed and switched on. If unsure, create a new one; the full key is shown once, so copy it then.
  3. Paste it into SillyTavern's Custom API key field, or set OPENAI_API_KEY for SDK code. Make sure the value starts with sk-ww- and has no spaces around it.
  4. Confirm the base URL is https://wildwestapi.com/v1 so the key reaches the right service.
  5. Send a short test message.

For reference, the working SillyTavern setup is: API set to Chat Completion, source set to Custom (OpenAI-compatible), endpoint https://wildwestapi.com/v1, your sk-ww- key in the API key field, and a model id such as outlaw-1. The full walkthrough is on the SillyTavern setup page.

Telling it apart from similar errors

If the response says Missing Authorization header, no key was sent at all; see the missing header page. A 402 means the key is fine but the money behind it is not; see 402 Payment Required. A 404 with No route for POST is a wrong URL, not a wrong key.

FAQ

Why does SillyTavern say connected but every message fails with 401?

Connecting only fetches the model list, which is public. The key is checked when you actually generate, so a bad key passes Connect and fails on the first message.

Can I recover a key I lost?

No. Keys are stored as a hash, so the full value cannot be shown again. Create a new key in the dashboard and disable the old one.

Related

Uncensored AI models on one key

OpenAI and Anthropic compatible, pay as you go. New to it? Start with uncensored AI, explained.