workspace: initial clean commit

This commit is contained in:
Stream
2026-04-12 21:55:33 +03:00
commit 0fc86ac3ae
220 changed files with 31657 additions and 0 deletions

View File

@@ -0,0 +1,91 @@
import json
import glob
from datetime import datetime
def parse_iso(timestamp):
try:
return datetime.fromisoformat(timestamp.replace('Z', '+00:00'))
except:
return None
today = datetime(2026, 3, 22).date()
sessions_dir = '/home/node/.openclaw/agents/main/sessions'
jsonl_files = glob.glob(sessions_dir + '/*.jsonl')
claude_input = 0
claude_output = 0
claude_cost = 0.0
deepseek_input = 0
deepseek_output = 0
deepseek_cost = 0.0
for file_path in jsonl_files:
with open(file_path, 'r') as f:
for line in f:
line = line.strip()
if not line:
continue
try:
data = json.loads(line)
except:
continue
if data.get('type') != 'message':
continue
msg = data.get('message', {})
if msg.get('role') != 'assistant' or 'usage' not in msg:
continue
timestamp = data.get('timestamp')
if not timestamp:
continue
dt = parse_iso(timestamp)
if not dt or dt.date() != today:
continue
usage = msg['usage']
inp = usage.get('input', 0)
out = usage.get('output', 0)
cost = usage.get('cost', {}).get('total', 0.0)
model = msg.get('model', '')
if 'claude' in model.lower():
claude_input += inp
claude_output += out
claude_cost += cost
elif 'deepseek' in model.lower():
deepseek_input += inp
deepseek_output += out
deepseek_cost += cost
total_input = claude_input + deepseek_input
total_output = claude_output + deepseek_output
total_cost = claude_cost + deepseek_cost
print('=== Сводка использования OpenRouter за 22 марта 2026 ===')
print()
print('📊 По моделям:')
print('1. Claude Sonnet 4.6')
print(' • Входные токены:', f'{claude_input:,}')
print(' • Выходные токены:', f'{claude_output:,}')
print(' • Стоимость: $' + f'{claude_cost:.6f}')
print()
print('2. DeepSeek V3.2')
print(' • Входные токены:', f'{deepseek_input:,}')
print(' • Выходные токены:', f'{deepseek_output:,}')
print(' • Стоимость: $' + f'{deepseek_cost:.6f}')
print()
print('📈 ИТОГО:')
print(' Всего входных токенов:', f'{total_input:,}')
print(' Всего выходных токенов:', f'{total_output:,}')
print(' Общая стоимость: $' + f'{total_cost:.6f}')
print()
print('💎 Средняя стоимость за 1 тыс. входных токенов:')
if total_input > 0:
avg = total_cost / total_input * 1000
print(' $' + f'{avg:.6f}')
else:
print(' N/A')
print()
print('🔄 Переход на DeepSeek:')
print(' • Claude использовался до ~06:30 UTC')
print(' • DeepSeek используется с ~06:30 UTC')
print()
print('💡 Примечание: входные токены включают контекст всей сессии,')
print(' который пересылается при каждом запросе. Выходные токены — ответы модели.')