Unable to change to a new api key; the old key is persisting

I changed my openAI api key. When I make a post request, I get the error message:

error:
code: “invalid_api_key”
message: “Incorrect API key provided: sk-fA1L6***************************************FFa3. You can find your API key at https://platform.openai.com/account/api-keys.
param: null
type: “invalid_request_error”

The incorrect API key printed in the error statement is the old key. The program functioned well until I switched to a different api key. I don’t know why I’m not able to get the program to switch to the new key.

I found a solution. I needed to add the api key to my environment variables in docker-compose.yml.

1 Like