Skip to content

Improve error message when OPENAI_API_KEY env variable is not set. #17

Closed
@sangee2004

Description

@sangee2004

Executing any gptscript without having OPENAI_API_KEY env set results in the following error message:

Sent content:
<content>

Waiting for model response...
2024/02/09 15:35:25 error, status code: 401, 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.

This error message can be improved to instruct user to set OPENAI_API_KEY env variable.
Also this error message can be presented to the user even before making an OpenAPI call.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions