yihong0618 / bilingual_book_maker

Make bilingual epub books Using AI translate
MIT License
6.91k stars 1k forks source link

使用非直连的KEY,也就是指定--api_base那种,访问时会报错 。 #363

Open iou3344 opened 6 months ago

iou3344 commented 6 months ago

python make_book.py --book_name test_books/example.srt --openai_key sk-** --api_base 'https://openkey.cloud/v1' --language zh-hans

Connection error. local variable 'completion' referenced before assignment will sleep 60 seconds Connection error. local variable 'completion' referenced before assignment will sleep 60 seconds Connection error. local variable 'completion' referenced before assignment will sleep 60 seconds Get 3 consecutive exceptions local variable 'completion' referenced before assignment Something is wrong when translate you can resume it next time

而使用5$那种账号生成key时,也就是不需要指定--api_base 'https://openkey.cloud/v1'时,则是可以正常工作的

yihong0618 commented 6 months ago

可能有 bug 我今天看一下,谢谢

iou3344 commented 6 months ago

谢谢您的关注,直连的key一个是容易被封号,一个是每分钟只能3次,所以真的要使用起来,大概率还是需要使用这种转发的key,所以还请解决一下呢。谢谢!

yihong0618 commented 6 months ago

@iou3344 我这里用 api_base 没有问题。。。 猜测是你的那个不支持 16k 的model

iou3344 commented 6 months ago

那我加上--model chatgptapi

python make_book.py --book_name test_books/example.srt --openai_key sk-QKRuxy45Rg78SfND7dugU02JPwhLxtWk2Gg98NdWeAQOy7Kh --model chatgptapi --api_base 'https://openkey.cloud/v1' --language zh-hans local variable 'completion' referenced before assignment will sleep 60 seconds

iou3344 commented 6 months ago

是我这个环境用不了api_base 吗?

iou3344 commented 6 months ago

为什么这样不行 --api_base 'https://openkey.cloud/v1' 这样又可以了呢 --api_base https://openkey.cloud/v1 也就是不带引号就可以 不是说——请注意,此处你输入的api应该是'https://xxxx/v1'的字样,域名需要用引号包裹

iou3344 commented 6 months ago

模型 提示 补全 消耗额度 gpt-3.5-turbo 64 20 $0.000520 gpt-3.5-turbo-0301 77 29 $0.000868 gpt-3.5-turbo-16k-0613 49 7 $0.000876 gpt-3.5-turbo-0613 51 16 $0.000544 gpt-3.5-turbo-16k 57 12 $0.001216 gpt-3.5-turbo-1106 57 18 $0.000466 gpt-3.5-turbo 55 10 $0.000376 gpt-3.5-turbo-0301 58 13 $0.000566 gpt-3.5-turbo-16k-0613 54 12 $0.001050 gpt-3.5-turbo-0613 54 8 $0.000486 gpt-3.5-turbo-16k 57 12 $0.001216 gpt-3.5-turbo-1106 52 11 $0.000370 gpt-3.5-turbo 52 8 $0.000340 gpt-3.5-turbo-0301 55 13 $0.000544 gpt-3.5-turbo-16k-0613 52 8 $0.000940 gpt-3.5-turbo-0613 51 11 $0.000494 gpt-3.5-turbo-16k 59 21 $0.001516 gpt-3.5-turbo-1106 57 9 $0.000376 gpt-3.5-turbo 57 15 $0.000436 gpt-3.5-turbo-0301 51 11 $0.000494 gpt-3.5-turbo-16k-0613 67 12 $0.001246 gpt-3.5-turbo-0613 53 8 $0.000478 gpt-3.5-turbo-16k 55 16 $0.001306 gpt-3.5-turbo-1106 53 12 $0.000386 gpt-3.5-turbo 62 13 $0.000440 gpt-3.5-turbo-0301 56 14 $0.000560 gpt-3.5-turbo-16k-0613 70 33 $0.001710 gpt-3.5-turbo-0613 64 20 $0.000680 gpt-3.5-turbo-16k 54 10 $0.001110 gpt-3.5-turbo-1106 54 11 $0.000380 gpt-3.5-turbo 57 19 $0.000476 gpt-3.5-turbo-0301 50 8 $0.000456 gpt-3.5-turbo-16k-0613 57 13 $0.001116 gpt-3.5-turbo-0613 58 16 $0.000596 gpt-3.5-turbo-16k 59 12 $0.001246 gpt-3.5-turbo-1106 46 7 $0.000300 gpt-3.5-turbo 58 15 $0.000440 gpt-3.5-turbo-0301 59 11 $0.000554 gpt-3.5-turbo-16k-0613 54 12 $0.001050 gpt-3.5-turbo-0613 50 8 $0.000456 gpt-3.5-turbo-16k 61 13 $0.001306 gpt-3.5-turbo-1106 55 14 $0.000416 gpt-3.5-turbo 48 7 $0.000310 gpt-3.5-turbo-0301 58 17 $0.000606 gpt-3.5-turbo-16k-0613 47 5 $0.000806 gpt-3.5-turbo-0613 58 21 $0.000646 gpt-3.5-turbo-16k 55 8 $0.001066 gpt-3.5-turbo-1106 60 13 $0.000430 gpt-3.5-turbo 58 11 $0.000400 gpt-3.5-turbo-0301 52 8 $0.000470 为什么每一次访问使用的模型不一样呢?

iou3344 commented 6 months ago

python make_book.py --book_name test_books/example.srt --openai_key sk-*** --api_base https://openkey.cloud/v1 --language zh-hans

yihong0618 commented 6 months ago

因为要避免limit 这么设计的。