見出し画像

OpenAIのAPIでリクエストが失敗してもしっかり料金は取られる件

まーくん | 西見 公宏

何か今日はOpenAIへのAPIコールがめちゃくちゃ失敗する日でして・・・

何かにつけて以下のようなログが出続ける始末です。

[ WARNING] before_sleep.py:65 - Retrying langchain.llms.openai.completion_with_retry.<locals>._completion_with_retry in 4.0 seconds as it raised APIConnectionError: Error communicating with OpenAI: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')).
[ WARNING] before_sleep.py:65 - Retrying langchain.llms.openai.completion_with_retry.<locals>._completion_with_retry in 4.0 seconds as it raised APIConnectionError: Error communicating with OpenAI: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')).
[ WARNING] before_sleep.py:65 - Retrying langchain.llms.openai.completion_with_retry.<locals>._completion_with_retry in 4.0 seconds as it raised APIConnectionError: Error communicating with OpenAI: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')).
[ WARNING] before_sleep.py:65 - Retrying langchain.llms.openai.completion_with_retry.<locals>._completion_with_retry in 8.0 seconds as it raised APIConnectionError: Error communicating with OpenAI: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')).
[ WARNING] before_sleep.py:65 - Retrying langchain.llms.openai.completion_with_retry.<locals>._completion_with_retry in 10.0 seconds as it raised APIConnectionError: Error communicating with OpenAI: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')).
APIConnectionError: Error communicating with OpenAI: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

基本的にLangChainを使っているので、デフォルトで6回リトライする設定なのですが、大体6回とも失敗してしまうという。

大して使ってないけどAPIキーをロックされたのかな?と思って新しいAPIキーで試してみるものの、上手くいかない。

OpenAIのDiscordを覗いてみると何人か同じ現象になっているようだけど、そんなに大事にはなっていないみたい。運の問題か。

そんなこんなで今日はほぼレスポンスがまともに返ってきていないんですが、何となくアカウントの利用量の画面を見てみると・・・

あっ、請求されてる
失敗したリトライ分もしっかりリクエスト回数に含まれる模様

微少な金額ですが、リクエスト失敗した分もしっかり請求カウントされているんや・・・という話でした。

この記事が気に入ったら、サポートをしてみませんか?
気軽にクリエイターの支援と、記事のオススメができます!