@extends('layouts.admin') @section('title', __('AI Dashboard')) @section('page-title', __('AI Dashboard')) @section('content')
{{ __('Admin AI usage aggregated from successful AI generations that used admin keys.') }}
{{ __('Range:') }} {{ $rangeLabel ?? __('This month') }}
{{ __('Total tokens used') }}
{{ number_format((int) ($totalTokensUsed ?? 0)) }}
@php $tl = $totalLimit; $tp = $totalPercent; @endphp
{{ __('Monthly limit') }} @if(is_numeric($tl)) {{ number_format((int) $tl) }} @else {{ __('Unlimited') }} @endif
@if(is_numeric($tp))
@else
@endif
@if(is_numeric($tp)) {{ number_format((float) $tp, 1) }}% @else {{ __('No limit configured') }} @endif
{{ __('Tokens used today') }}
{{ number_format((int) ($totalTokensUsedToday ?? 0)) }}
@php $dl = $totalDailyLimit; $dp = $totalDailyPercent; @endphp
{{ __('Daily limit') }} @if(is_numeric($dl)) {{ number_format((int) $dl) }} @else {{ __('Unlimited') }} @endif
@if(is_numeric($dp))
@else
@endif
@if(is_numeric($dp)) {{ number_format((float) $dp, 1) }}% @else {{ __('No limit configured') }} @endif
{{ __('Estimated total cost') }}
${{ number_format(((int) ($totalCostCents ?? 0)) / 100, 2) }}
{{ __('Based on the configured cost per 1M tokens in Settings > AI.') }}
{{ __('Providers tracked') }}
{{ is_array($providerStats ?? null) ? count($providerStats) : 0 }}
{{ __('ChatGPT, Gemini, Claude') }}
{{ __('Usage by provider') }}
@foreach(($providerStats ?? []) as $key => $stat) @php $used = (int) ($stat['tokens_used'] ?? 0); $limit = (int) ($stat['token_limit'] ?? 0); $percent = $stat['percent'] ?? null; $estimatedCostCents = (int) ($stat['estimated_cost_cents'] ?? 0); $daily = is_array($providerDailyStats ?? null) ? ($providerDailyStats[$key] ?? null) : null; $dailyUsed = (int) (($daily['tokens_used'] ?? null) ?? 0); $dailyLimit = (int) (($daily['token_limit'] ?? null) ?? 0); @endphp
{{ $stat['label'] ?? $key }}
{{ number_format($used) }} / {{ $limit > 0 ? number_format($limit) : __('Unlimited') }} ยท ${{ number_format($estimatedCostCents / 100, 2) }}
{{ __('Today:') }} {{ number_format($dailyUsed) }} / {{ $dailyLimit > 0 ? number_format($dailyLimit) : __('Unlimited') }}
@if(is_numeric($percent))
@else
@endif
@endforeach
{{ __('Breakdown by provider / model') }}
@forelse(($breakdownRows ?? []) as $row) @php $tokens = (int) ($row['tokens'] ?? 0); $costCents = (int) ($row['estimated_cost_cents'] ?? 0); @endphp @empty @endforelse
{{ __('Provider') }} {{ __('Model') }} {{ __('Tokens') }} {{ __('Est. Cost') }}
{{ $row['provider_label'] ?? ($row['provider'] ?? '') }} {{ $row['model'] ?? __('Default') }} {{ number_format($tokens) }} ${{ number_format($costCents / 100, 2) }}
{{ __('No AI usage yet for the selected range.') }}
{{ __('Tokens by provider') }}
{{ __('Tokens by provider / model') }}
{{ __('Estimated cost by provider') }}
{{ __('Estimated cost by provider / model') }}
@endsection @push('scripts') @endpush