#[βœ… Solved] bad request js error code 400

1 messages Β· Page 1 of 1 (latest)

frigid shoreBOT
#

It looks like you're getting a Bad Request (400) error due to an "Invalid API key" message from the system you’re testing with. Here are the most common reasons and step-by-step solutions:

1. Double-check Your API Key

  • Ensure you generated your Pawan.Krd API key in our Discord server’s #πŸ€–ππ¨π­ channel by running /key.
  • Copy the key exactly as shownβ€”no extra spaces before or after.
  • Do NOT share your API key.

2. Confirm Your Endpoint

  • Make sure the endpoint matches the model you want to use; for example:
    https://api.pawan.krd/cosmosrp/v1/chat/completions
    
    Don’t use backticks, emojis, or extra characters!

3. Set Your Authorization Header Correctly

  • Use this header in your JS code:
    Authorization: Bearer YOUR_API_KEY
    
    Replace YOUR_API_KEY with your actual key.

4. Ensure JSON Payload is Valid

  • You must structure your request correctly. Example:
    {
      "model": "cosmosrp",
      "messages": [{"role": "user", "content": "Hello"}]
    }
    
    Adjust "model" field to match the endpoint you're using.

5. Common Mistakes to Avoid

  • API key is not valid (expired, revoked, mistyped, or not yet claimed).
  • Incorrect endpoint.
  • Request payload in the wrong shape.
  • API key used on a different IP than originally locked to.

6. Check Your Credits

#

If you checked all the above and still get the error, please provide:

  • The full request (excluding your API key for safety)
  • Confirm you claimed your daily credits with /claim
  • Your model/endpoint selection

If your setup still fails after these checks, you can create a ticket in Create Ticket Channel with your request details for further help.

Please note: This is an automated response from @frigid shore. While it strive to provide accurate assistance, It may occasionally make mistakes. If you find any inaccuracies or need further clarification, feel free to wait for our community helpers to give you further guidance. Thank you.

#

[βœ… Solved] bad request js error code 400