Halftonex / npc-generator-gpt

Foundry VTT module - NPC generator for D&D5e powered by ChatGPT
Creative Commons Attribution 4.0 International
7 stars 6 forks source link

[BUG]: "Request Denied" #8

Closed Stormthirst closed 8 months ago

Stormthirst commented 8 months ago

Bug Description

I'm always getting "request denied: Wait a few seconds and try again" I have generated an API key, and entered it into the appropriate box.

The console error however says:

{
    "error": {
        "message": "You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.",
        "type": "invalid_request_error",
        "param": null,
        "code": null
    }
}

Followed by: Error: 429 | Message: You exceeded your current quota, please check your plan and billing details.

Does this only work on paid-for-subscriptions?

Steps To Reproduce

Followed procedure described here

Foundry Version

11.314 and 11.313

Additional Information

No response

Halftonex commented 8 months ago

Does this only work on paid-for-subscriptions?

More or less, OpenAI's APIs are not free but require a credit that will be used each time you make an API call. My module uses the GPT-3.5 model, you can check the costs at https://openai.com/pricing. As you can see, although not free, it is quite affordable. The error you're encountering is due to the fact that you haven't entered your private key in the module settings, which is my fault for not providing a specific guide. I'll take care of that right away. The second error, as you presumed, is because the account associated with that key doesn't have any credit.

Halftonex commented 8 months ago

You can find a cost estimate of the API in the updated readme of the module. Additionally, with the latest version of the module, you can check the cost of each call from the logs in the console.