openai.api_key = ‘■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■gTG2jqP8’
openai api fine_tunes.create -t “info_prepared.jsonl” -m davinci
Error: No API key provided. You can set your API key in code using ‘openai.api_key = ’, or you can set the environment variable OPENAI_API_KEY=). If your API key is stored in a file, you can point the openai module at it with ‘openai.api_key_path = ’. You can generate API keys in the OpenAI web interface.
import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
response = openai.Completion.create(
model="text-davinci-003",
prompt="Hello everyone.\nCan Anyone help me ?\n\nWhen I run this code, I am getting error. =>\n\nopenai.api_key = ‘■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■gTG2jqP8’\nopenai api fine_tunes.create -t “info_prepared.jsonl” -m davinci\n\nError: No API key provided. You can set your API key in code using ‘openai.api_key = ’, or you can set the environment variable OPENAI_API_KEY=). If your API key is stored in a file, you can point the openai module at it with ‘openai.api_key_path = ’. You can generate API keys in the OpenAI web interface.\n\nHow can I provide the api_key ?\n\n\n\n\n###\n\nAnswer:\n\nYou can provide the API key by setting it in code using the syntax 'openai.api_key = <your_api_key>', or you can set the environment variable OPENAI_API_KEY. If your API key is stored in a file, you can point the openai module at it with 'openai.api_key_path = <path_to_your_file>'. You can generate API keys in the OpenAI web interface.\n\nFor Example:\nopenai.api_key = 'abcdefghijklmnopqrstuvwxyz1234567890'\nor\nexport OPENAI_API_KEY=abcdefghijklmnopqrstuvwxyz1234567890\n\nYou can test if you have set the api key correctly by running the command openai.list() to list the fine-tuned models associated with your account.\n\nFor Exaample:\nopenai.list()\n\nTry this code:\n\nimport openai\nopenai.api_key = '■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■gTG2jqP8'\nopenai.api.fine_tunes.create -t “info_prepared.jsonl” -m davinci\n\nOr try this code to list the fine-tuned models associated with your account:\nopenai.list()\n\nimport openai\nopenai.api_key = '■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■gTG2jqP8'\nopenai.list()",
temperature=0.7,
max_tokens=256,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
It would be helpful if you provided some context around the question - “When I run this code…” Where are you running the code, and is that exactly how you’re inputting it? openai.api_key = ‘■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■gTG2jqP8’ openai api fine_tunes.create -t “info_prepared.jsonl” -m davinci
If you’re doing this in the CLI (I assume you are because of syntax), you’re not entering the command in properly it appears. Try:
openai api --api-key ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■gTG2jqP8 api fine_tunes.create -t "info_prepared.jsonl" -m davinci
!openai api fine_tunes.create -t /content/drive/My\ Drive/trainingPromptsAndCompletions1.jsonl -m davinci
I have tried both ways, still getting same error:
Error: No API key provided. You can set your API key in code using ‘openai.api_key = ’, or you can set the environment variable OPENAI_API_KEY=). If your API key is stored in a file, you can point the openai module at it with ‘openai.api_key_path = ’. You can generate API keys in the OpenAI web interface. See https://onboard.openai.com for details, or email support@openai.com if you have any questions.
running into the exact same issue here.
Tried creating new keys, also didn’t work.
Deleting browser cache didn’t work.
+1 if someone finds the problem and solution
Hey @brandontaul . Did you find a solution to this, I am also facing this error “Incorrect API key provided: undefined. You can find your API key at OpenAI API” I am trying to build text to image genrator.
Thank you, that does not work either for me. Seems to be a sustaining issue for many of us… There is a problem with API KEY environment variables in Python, it works for me only in powershell… What does #Add mean?