Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (seongtaejeong at gmail.com)
홈페이지
첨부 파일
 
(연관된 글이 1개 있습니다.)

OpenAI - The API request of HOST_AGENT failed: OpenAI API request exceeded rate limit: Error code: 429

OpenAI API 키 사용 시 이런 오류가 발생한다면?

Round 1, Step 1, HostAgent: Analyzing the user intent and decomposing the request...
The API request of HOST_AGENT failed: OpenAI API request exceeded rate limit: Error code: 429 - {'error': {'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.', 'type': 'insufficient_quota', 'param': None, 'code': 'insufficient_quota'}}.
Switching to use the backup engine...
Error Occurs at get_response
Traceback (most recent call last):
  File "D:\temp\UFO\ufo\llm\openai.py", line 89, in _chat_completion
    response: Any = self.client.chat.completions.create(
  File "%USERPROFILE%\AppData\Local\Programs\Python\Python310\lib\site-packages\openai\_utils\_utils.py", line 279, in wrapper
    return func(*args, **kwargs)
  File "%USERPROFILE%\AppData\Local\Programs\Python\Python310\lib\site-packages\openai\resources\chat\completions\completions.py", line 914, in create
    return self._post(
  File "%USERPROFILE%\AppData\Local\Programs\Python\Python310\lib\site-packages\openai\_base_client.py", line 1242, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
  File "%USERPROFILE%\AppData\Local\Programs\Python\Python310\lib\site-packages\openai\_base_client.py", line 919, in request
    return self._request(
  File "%USERPROFILE%\AppData\Local\Programs\Python\Python310\lib\site-packages\openai\_base_client.py", line 1023, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\temp\UFO\ufo\agents\processors\basic.py", line 192, in wrapper
    func(self, *args, **kwargs)
  File "D:\temp\UFO\ufo\agents\processors\basic.py", line 174, in wrapper
    result = func(self, *args, **kwargs)
  File "D:\temp\UFO\ufo\agents\processors\host_agent_processor.py", line 189, in get_response
    self._response, self.cost = self.host_agent.get_response(
  File "D:\temp\UFO\ufo\agents\agent\basic.py", line 164, in get_response
    response_string, cost = llm_call.get_completion(
  File "D:\temp\UFO\ufo\llm\llm_call.py", line 25, in get_completion
    responses, cost = get_completions(
  File "D:\temp\UFO\ufo\llm\llm_call.py", line 85, in get_completions
    return get_completions(
  File "D:\temp\UFO\ufo\llm\llm_call.py", line 89, in get_completions
    raise e
  File "D:\temp\UFO\ufo\llm\llm_call.py", line 75, in get_completions
    response, cost = service(configs, agent_type=agent_type).chat_completion(
  File "D:\temp\UFO\ufo\llm\openai.py", line 478, in chat_completion
    return super()._chat_completion(
  File "D:\temp\UFO\ufo\llm\openai.py", line 164, in _chat_completion
    raise Exception(f"OpenAI API request was not authorized: {e}")
Exception: OpenAI API request was not authorized: Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}

Markdown file saved to logs/my_test//output.md.
Cost is not available for the model gpt-4o or gpt-4o.

보통 마지막 오류 메시지에 따라 "OpenAI API request was not authorized: Error code: 401"만 보고 API 키가 잘못되었다고 생각할 수 있는데, 그 상위의 메시지에 좀 더 정확한 오류 메시지가 포함돼 있으니 스크롤을 좀 하셔야 합니다. ^^ 즉, 위의 경우 진짜 오류는 "The API request of HOST_AGENT failed: OpenAI API request exceeded rate limit"입니다.

그나저나 ^^ 개인적으로도 처음엔 ChatGPT 유료 사용자라면 API 사용료까지 어느 정도는 기본요금제에 포함됐을 거라고 인식했었습니다. 그런데, 실제 정책은 API 사용료의 경우 완전히 별개로 운영되는데요, 아마도 이런 차이점과 함께 쓰는 만큼 나오는 요금제라서 자칫 실수하면 엄청난 요금 폭탄을 맞게 될 수 있는 여지가 있습니다.

이런 식의 사연 때문인지 OpenAI 측은 기본적으로 API 요금 상한을 0원으로 설정해 두고 있어 "... exceeded rate limit" 오류가 발생한 것입니다. 따라서 이를 사용자가 직접 다음의 화면을 통해 높여주면 됩니다.

openai_recharge_bill_1.png

Settings / Billing
; https://platform.openai.com/settings/organization/billing/overview

위의 화면에서 "Add to credit balance"를 클릭해 가격을 충전해 안전하게 사용할 수 있습니다. ^^




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]

[연관 글]






[최초 등록일: ]
[최종 수정일: 5/15/2025]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




1  2  [3]  4  5  6  7  8  9  10  11  12  13  14  15  ...
NoWriterDateCnt.TitleFile(s)
13879정성태2/5/20254088오류 유형: 946. Ubuntu - N: Updating from such a repository can't be done securely, and is therefore disabled by default.
13878정성태2/3/20254077오류 유형: 945. Windows - 최대 절전 모드 시 DRIVER_POWER_STATE_FAILURE 발생 (pacer.sys)
13877정성태1/25/20253755닷넷: 2315. C# - PCI 장치 열거 (레지스트리, SetupAPI)파일 다운로드1
13876정성태1/25/20254458닷넷: 2314. C# - ProcessStartInfo 타입의 Arguments와 ArgumentList파일 다운로드1
13875정성태1/24/20253494스크립트: 69. 파이썬 - multiprocessing 패키지의 spawn 모드로 동작하는 uvicorn의 workers
13874정성태1/24/20254250스크립트: 68. 파이썬 - multiprocessing Pool의 기본 프로세스 시작 모드(spawn, fork)
13873정성태1/23/20253372디버깅 기술: 217. WinDbg - PCI 장치 열거파일 다운로드1
13872정성태1/23/20253254오류 유형: 944. WinDbg - 원격 커널 디버깅이 연결은 되지만 Break (Ctrl + Break) 키를 눌러도 멈추지 않는 현상
13871정성태1/22/20253672Windows: 278. Windows - 윈도우를 다른 모니터 화면으로 이동시키는 단축키 (Window + Shift + 화살표)
13870정성태1/18/20254153개발 환경 구성: 741. WinDbg - 네트워크 커널 디버깅이 가능한 NIC 카드 지원 확대
13869정성태1/18/20253778개발 환경 구성: 740. WinDbg - _NT_SYMBOL_PATH 환경 변수에 설정한 경로로 심벌 파일을 다운로드하지 않는 경우
13868정성태1/17/20253469Windows: 277. Hyper-V - Windows 11 VM의 Enhanced Session 모드로 로그인을 할 수 없는 문제
13867정성태1/17/20254443오류 유형: 943. Hyper-V에 Windows 11 설치 시 "This PC doesn't currently meet Windows 11 system requirements" 오류
13866정성태1/16/20254626개발 환경 구성: 739. Windows 10부터 바뀐 device driver 서명 방법
13865정성태1/15/20254319오류 유형: 942. C# - .NET Framework 4.5.2 이하의 버전에서 HttpWebRequest로 https 호출 시 "System.Net.WebException" 예외 발생
13864정성태1/15/20254267Linux: 114. eBPF를 위해 필요한 SELinux 보안 정책
13863정성태1/14/20253674Linux: 113. Linux - 프로세스를 위한 전용 SELinux 보안 문맥 지정
13862정성태1/13/20253998Linux: 112. Linux - 데몬을 위한 SELinux 보안 정책 설정
13861정성태1/11/20254268Windows: 276. 명령행에서 원격 서비스를 동기/비동기로 시작/중지
13860정성태1/10/20253950디버깅 기술: 216. WinDbg - 2가지 유형의 식 평가 방법(MASM, C++)
13859정성태1/9/20254378디버깅 기술: 215. Windbg - syscall 이후 실행되는 KiSystemCall64 함수 및 SSDT 디버깅
13858정성태1/8/20254511개발 환경 구성: 738. PowerShell - 원격 호출 시 "powershell.exe"가 아닌 "pwsh.exe" 환경으로 명령어를 실행하는 방법
13857정성태1/7/20254623C/C++: 187. Golang - 콘솔 응용 프로그램을 Linux 데몬 서비스를 지원하도록 변경파일 다운로드1
13856정성태1/6/20254015디버깅 기술: 214. Windbg - syscall 단계까지의 Win32 API 호출 (예: Sleep)
13855정성태12/28/20245167오류 유형: 941. Golang - os.StartProcess() 사용 시 오류 정리
13854정성태12/27/20245133C/C++: 186. Golang - 콘솔 응용 프로그램을 NT 서비스를 지원하도록 변경파일 다운로드1
1  2  [3]  4  5  6  7  8  9  10  11  12  13  14  15  ...