Skip to content

More info for error "Failed to get a response. Have you set the OPENAI_API_KEY variable?" #2

Closed

Description

@dylang

Hi, looking forward to trying this, getting an error though and I'm not sure how to debug it.

The key is freshly made from https://beta.openai.com/account/api-keys.
I'm using fish shell 3.5.1 in MacOS.

 ❯ echo $OPENAI_API_KEY
sk-<key hidden>
 ❯ plz "list files"
✖ Failed to get a response. Have you set the OPENAI_API_KEY variable?

I've yet to try to code in Rust so I'm not set up to try to modify the source and see what's happening.

Activity

  1. yorhodes commented on Dec 14, 2022

    @yorhodes

    have the same issue @m1guelpf

  2. omeb commented on Dec 14, 2022

    @omeb

    Having the same issue as well...
    image

  3. raulsanzmontrull commented on Dec 14, 2022

    @raulsanzmontrull

    Same here (KDE Neon). Also having OPENAI_API_KEY variable persisted

    I think that it does not depend on setting OPENAI_API_KEY variable because plz do not let you run a request to OPENAI API without KEY variable. It shows the next message:
    This program requires an OpenAI API key to run. Please set the OPENAI_API_KEY environment variable.
    IDK if it is related to API permissions or whatever.

  4. jcortejoso commented on Dec 15, 2022

    @jcortejoso

    I had problems with API_KEYS from my personal account as my account had not enough credit to make any request. You can confirm if you are able to make requests at https://beta.openai.com/playground (just make a dummy request there).

    An API for accessing new AI models developed by OpenAI
  5. raulsanzmontrull commented on Dec 15, 2022

    @raulsanzmontrull

    I tried to provide billing details and set my credit card at OpenAI. Then, I repeated the steps and it worked for me:

    image

    Thanks to @jcortejoso for the message!

  6. m1guelpf commented on Dec 15, 2022

    @m1guelpf
    Owner

    Would be really helpful if anyone experiencing this issue could share a copy of the response returned, so I can improve the error message on the CLI

  7. markkucler commented on Dec 15, 2022

    @markkucler

    I had the same problem, billing/playground showed "You've reached your usage limit." and it started working once I provided billing details. Thanks @jcortejoso and @llunasanz!

  8. yorhodes commented on Dec 15, 2022

    @yorhodes

    also was just a billing issue for me

  9. added
    help wanted
    on Dec 16, 2022
  10. added a commit that references this issue on Nov 12, 2025
    e9551cb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions