machinewrapped / gpt-subtrans

Open Source project using LLMs to translate SRT subtitles
Other
347 stars 40 forks source link

Can't translate and can't locate the right api key #17

Closed wuzimi closed 1 year ago

wuzimi commented 1 year ago

I ran the program with below result: Thursday, 19:03:04 - GPT-Subtrans v0.1.7 Thursday, 19:03:10 - Project file C:/Users/Administrator/Documents/GitHub/gpt-subtrans/test.subtrans does not exist Thursday, 19:03:10 - Executing BatchSubtitlesCommand Thursday, 19:03:10 - Writing project data to C:/Users/Administrator/Documents/GitHub/gpt-subtrans/test.subtrans Thursday, 19:03:16 - Translating scene number 1 Thursday, 19:03:17 - error_code=invalid_api_key error_message='Incorrect API key provided: sk-ELPOc***qg63. You can find your API key at https://platform.openai.com/account/api-keys.' error_param=None error_type=invalid_request_error message='OpenAI API error received' stream_error=False Thursday, 19:03:17 - Failed to translate scene 1 (Unexpected error communicating with OpenAI)... finishing Thursday, 19:03:17 - No subtitles translated Thursday, 19:03:17 - Writing project data to C:/Users/Administrator/Documents/GitHub/gpt-subtrans/test.subtrans

According to above result the api key is an old one, but it can't be deleted even I have created the right .env file with the right key in it. How should I replace the api key with the right one? I even deleted the whole program and installed it again. But every time I ran the program it is still the wrong key....

machinewrapped commented 1 year ago

Hi, the error there is that OpenAI is rejecting the sk-ELPOc... api key, so if that's the one you're using you will need to generate a new api key. If you're using a different API key then... it's hard to say what the problem is.

If you're running via the command-line the only places it should be looking for an api key are the .env file and the command line. Command line arguments have priority so try adding --apikey _your_api_key_ and see if you get a different result.

If you're comfortable modifying the code then you could also try editing the __init__ method in SubtitleTranslator.py , replace openai.api_key = _..._ with openai.api_key = "_your_api_key_", which should force it to use that one under all circumstances.

wuzimi commented 1 year ago

Thanks and I will give it a try following your instructions.

machinewrapped @.***> 于 2023年5月6日周六 04:26写道:

Hi, the error there is that OpenAI is rejecting the sk-ELPOc... api key, so if that's the one you're using you will need to generate a new api key. If you're using a different API key then... it's hard to say what the problem is.

If you're running via the command-line the only places it should be looking for an api key are the .env file and the command line. Command line arguments have priority so try adding --apikey _your_apikey and see if you get a different result.

If you're comfortable modifying the code then you could also try editing the init method in SubtitleTranslator.py , replace openai.apikey = ..._ with openai.api_key = "_your_apikey", which should force it to use that one under all circumstances.

— Reply to this email directly, view it on GitHub https://github.com/machinewrapped/gpt-subtrans/issues/17#issuecomment-1536741263, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4ZON2DQ5LVQ732H52C45ETXEVO6XANCNFSM6AAAAAAXVUGYYU . You are receiving this because you authored the thread.Message ID: @.***>