구글 한도: 429 응답에서 대기시간·일일한도를 읽어 즉시 대체 모델로 전환(하드코딩 500회 가정 제거), 시스템 프롬프트에 현재 백엔드 모델명 주입

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
kimandClaude Sonnet 5.5 committed 2026-10-17 19:32:58 +09:00
1 parent ea2f9dccc4
commit feeed87f47
6 files changed
+101 -7

No files matched your search

+6
View File
@@ -179,8 +179,11 @@ def _chat_openai_compat(base, key, model, messages, timeout):
tcs.append(item)
return {"content": msg.get("content") or "", "tool_calls": tcs}
CALL_DELAY = 0.0 # --delay: 분당 호출 제한(RPM)이 있는 무료 등급용
def chat(endpoint, model, messages, timeout=150):
"""model 표기: 'anthropic:claude-...' / 'google:gemini-...' / 그 외는 Ollama."""
if CALL_DELAY: time.sleep(CALL_DELAY)
t = time.time()
if model.startswith("anthropic:"):
msg = _chat_anthropic(model.split(":", 1)[1], messages, timeout)
@@ -240,7 +243,10 @@ def main():
ap.add_argument("--out", default="")
ap.add_argument("--workers", type=int, default=4)
ap.add_argument("--repeat", type=int, default=2)
ap.add_argument("--delay", type=float, default=0.0, help="호출 사이 대기(초)")
a = ap.parse_args()
global CALL_DELAY
CALL_DELAY = a.delay
models = [m for m in a.models.split(",") if m]
results = []
with cf.ThreadPoolExecutor(max_workers=a.workers) as ex: