feat(chat): OpenClaw 改用 Gemini 2.0 Flash-Lite (最便宜)
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled

Input $0.075/1M, Output $0.30/1M (比 Flash 便宜 25%)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-04-03 19:35:13 +08:00
parent 6cd4280168
commit b62d7d3eb0

View File

@@ -105,8 +105,8 @@ class ChatManager:
logger.warning("openclaw_gemini_monthly_limit_reached", current_usd=current_cost, limit_usd=MONTHLY_LIMIT_USD)
return f"🔴 OpenClaw 本月 Gemini 用量已達上限 ${MONTHLY_LIMIT_USD} USD已用 ${current_cost:.4f}"
# Gemini 2.0 Flash: 快速、便宜 (與 models.json 對齊)
model = "gemini-2.0-flash"
# Gemini 2.0 Flash-Lite: 最便宜 (2026-04-03 老闆指示)
model = "gemini-2.0-flash-lite"
try:
async with httpx.AsyncClient(timeout=30.0) as client:
resp = await client.post(
@@ -125,8 +125,8 @@ class ChatManager:
usage = data.get("usageMetadata", {})
in_tok = usage.get("promptTokenCount", 0)
out_tok = usage.get("candidatesTokenCount", 0)
# Gemini 2.0 Flash: Input $0.10/1M, Output $0.40/1M
cost = (in_tok * 0.0000001) + (out_tok * 0.0000004)
# Gemini 2.0 Flash-Lite: Input $0.075/1M, Output $0.30/1M
cost = (in_tok * 0.000000075) + (out_tok * 0.0000003)
new_total = current_cost + cost
try: