@extends('crm.layouts.master') @section('title', 'AI Usage') @section('main-content')
Costs are application estimates calculated from provider-reported token and tool usage. Use the OpenAI billing dashboard for invoice reconciliation.
@foreach([ ['Requests', number_format($totals['requests']), 'ti-message-code'], ['Tokens', number_format($totals['tokens']), 'ti-currency-dollar'], ['Web searches', number_format($totals['searches']), 'ti-world-search'], ['Estimated cost', '$'.number_format($totals['cost'], 4), 'ti-cash'], ['Failures', number_format($totals['failures']), 'ti-alert-triangle'], ] as [$label,$value,$icon])
{{ $label }}
{{ $value }}
@endforeach
By surface
@forelse($bySurface as $row)@empty@endforelse
SurfaceRequestsCost
{{ str_replace('_',' ',ucfirst($row->surface)) }}{{ number_format($row->requests) }}${{ number_format($row->cost, 4) }}
No usage
By model
@forelse($byModel as $row)@empty@endforelse
ModelTokensCost
{{ $row->model }}{{ number_format($row->tokens) }}${{ number_format($row->cost, 4) }}
No usage
Highest-consuming actors
@forelse($byActor as $row)@empty@endforelse
ActorRequestsCost
{{ $actorLabel($row) }}{{ number_format($row->requests) }}${{ number_format($row->cost, 4) }}
No usage
Request audit
@forelse($audits as $audit)@empty@endforelse
UTC timeActorSurfaceModelStatusTokensSearchesEst. costRequest ID
{{ $audit->created_at?->utc()->format('Y-m-d H:i:s') }} {{ $actorLabel($audit) }}@if($audit->impersonator_user_id)
Impersonated by user #{{ $audit->impersonator_user_id }}
@endif
{{ str_replace('_',' ',ucfirst($audit->surface)) }}{{ $audit->model }} {{ ucfirst($audit->status) }}@if($audit->error_code)
{{ $audit->error_code }}
@endif
{{ number_format($audit->total_tokens) }}
{{ number_format($audit->input_tokens) }} in / {{ number_format($audit->output_tokens) }} out
{{ number_format($audit->web_search_calls) }}${{ number_format((float)$audit->estimated_cost_usd, 6) }} {{ $audit->provider_request_id ?: '—' }}
No AI requests for this period.
@endsection