@php $pricingRules = $pricingRules ?? collect(); $models = $models ?? collect(); $policy = $policy ?? null; $defaultImageModelId = $defaultImageModelId ?? null; $usdKrwRate = $usdKrwRate ?? 1400; $usdKrwRateUpdatedAt = $usdKrwRateUpdatedAt ?? null; $modeLabels = [ 'token_rates' => 'Token', 'unit_rates' => '단위', 'image' => '이미지', 'megapixel' => 'Megapixel', 'duration' => 'Duration', ]; $pricingRuleModalMap = $pricingRules->mapWithKeys(function ($rule) { return [ $rule->id => [ 'id' => $rule->id, 'action' => route('platform.ai-credits.pricing.update', $rule), 'provider' => $rule->provider, 'model' => $rule->model, 'type' => $rule->type, 'calculation_mode' => $rule->calculation_mode, 'active' => (bool) $rule->active, 'sort_order' => (int) $rule->sort_order, 'pricing_data' => (array) ($rule->pricing_data ?? []), ], ]; })->all(); $modelModalMap = $models->mapWithKeys(function ($model) { return [ $model->id => [ 'id' => $model->id, 'action' => route('platform.ai-credits.models.update', $model), 'provider' => $model->provider, 'model' => $model->model, 'type' => $model->type, 'label' => $model->label, 'active' => (bool) $model->active, 'sort_order' => (int) $model->sort_order, ], ]; })->all(); $imageModels = $models->where('type', 'image')->values(); $typeLabels = [ 'text' => '텍스트', 'image' => '이미지', ]; $formatUsd = static function (float $value): string { $precision = $value >= 0.01 ? 2 : 4; return '$' . number_format($value, $precision, '.', ','); }; $estimateCredits = static function (?float $providerCostUsd) use ($usdPerCredit, $defaultMarkup): int { $providerCostUsd = $providerCostUsd ?? 0.0; $billableUsd = max(0.0, $providerCostUsd) * max(0.0, (float) $defaultMarkup); return $billableUsd <= 0 ? 0 : (int) ceil($billableUsd / max(0.00000001, (float) $usdPerCredit)); }; @endphp
@if (session('status')) {{ session('status') }} @endif @if ($errors->any())
    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif 1 Credit = ${{ rtrim(rtrim(number_format((float) $usdPerCredit, 3, '.', ''), '0'), '.') }} 기본 마크업 {{ number_format((float) $defaultMarkup, 1) }}x 1 USD = {{ number_format((float) $usdKrwRate) }} KRW 플랜관리
AI Credit 정책

환산 기준

현재 정책값이 실제 AI 과금 계산에 사용되며, 상품 마진 계산에도 참고됩니다.

1 Credit당 USD와 기본 Markup은 새 요청부터 적용됩니다. 환율은 아래 버튼으로 최신화할 수 있습니다.

1 Credit당 USD
${{ rtrim(rtrim(number_format((float) $usdPerCredit, 3, '.', ''), '0'), '.') }}
기본 Markup
{{ number_format((float) $defaultMarkup, 1) }}x
현재 기준 환율
1 USD = {{ number_format((float) $usdKrwRate) }} KRW
최근 업데이트 시간
{{ $usdKrwRateUpdatedAt?->format('Y.m.d H:i') ?? '-' }}
@csrf 최신 환율 불러오기
AI links

AI 정보 링크

관리자가 모델 정책과 외부 가격 정보를 빠르게 확인할 수 있는 참고 영역입니다.

Model catalog

Provider / Model 관리

텍스트와 이미지 모델을 같은 카탈로그에서 관리하고, 기본 이미지 모델은 별도 설정으로 지정합니다.

모델 추가
@csrf
기본 이미지 모델

활성화된 이미지 모델만 기본값으로 지정할 수 있습니다.

저장
@forelse ($models as $model) @empty @endforelse
Provider / Model Type Label 상태 기본값 관리
{{ $model->provider }}/{{ $model->model }}
sort {{ (int) $model->sort_order }}
{{ $typeLabels[$model->type] ?? $model->type }}
{{ $model->label ?: '-' }}
{{ $model->active ? '활성' : '비활성' }} @if ((int) $defaultImageModelId === (int) $model->id) 기본 @else - @endif 수정
등록된 모델이 없습니다.
Provider pricing

Provider / Model 가격표

활성화된 가격표만 계산에 반영되며, JSON은 관리자에게 노출하지 않습니다.

가격표 추가
@forelse ($pricingRules as $rule) @php $pricingData = (array) ($rule->pricing_data ?? []); $inputRate = null; $cachedInputRate = null; $outputRate = null; if ($rule->calculation_mode === 'token_rates') { $inputRate = (float) data_get($pricingData, 'input_usd_per_million_tokens', 0); $cachedInputRate = data_get($pricingData, 'cached_input_usd_per_million_tokens'); $outputRate = (float) data_get($pricingData, 'output_usd_per_million_tokens', 0); } elseif ($rule->calculation_mode === 'unit_rates') { $inputRate = (float) data_get($pricingData, 'unit_usd', 0); } elseif ($rule->calculation_mode === 'image') { $inputRate = (float) data_get($pricingData, 'price_per_image_usd', 0); } elseif ($rule->calculation_mode === 'megapixel') { $inputRate = (float) data_get($pricingData, 'price_per_first_megapixel_usd', data_get($pricingData, 'price_per_megapixel_usd', 0)); $cachedInputRate = (float) data_get($pricingData, 'price_per_additional_megapixel_usd', data_get($pricingData, 'price_per_megapixel_usd', 0)); $outputRate = (float) data_get($pricingData, 'price_per_reference_image_megapixel_usd', data_get($pricingData, 'price_per_megapixel_usd', 0)); } elseif ($rule->calculation_mode === 'duration') { $inputRate = (float) data_get($pricingData, 'price_per_second_usd', 0); } @endphp @empty @endforelse
Provider / Model 과금 방식 Input Cached input Output 상태 관리
{{ $rule->provider }}/{{ $rule->model }}
@if ($rule->type !== 'text')
{{ $rule->type }}
@endif
{{ $modeLabels[$rule->calculation_mode] ?? $rule->calculation_mode }} @if ($inputRate !== null) @if ($rule->calculation_mode === 'megapixel')
First MP
@endif
{{ $formatUsd((float) $inputRate) }}
(≈ {{ number_format($estimateCredits((float) $inputRate)) }} Credit)
@else
-
@endif
@if ($rule->calculation_mode === 'token_rates') @if (is_numeric($cachedInputRate))
{{ $formatUsd((float) $cachedInputRate) }}
(≈ {{ number_format($estimateCredits((float) $cachedInputRate)) }} Credit)
@else
-
@endif @elseif ($rule->calculation_mode === 'megapixel') @if (is_numeric($cachedInputRate))
Additional MP
{{ $formatUsd((float) $cachedInputRate) }}
(≈ {{ number_format($estimateCredits((float) $cachedInputRate)) }} Credit)
@else
-
@endif @else
-
@endif
@if ($outputRate !== null) @if ($rule->calculation_mode === 'megapixel')
Reference Image MP
@endif
{{ $formatUsd((float) $outputRate) }}
(≈ {{ number_format($estimateCredits((float) $outputRate)) }} Credit)
@else
-
@endif
{{ $rule->active ? '활성' : '비활성' }} 수정
등록된 가격표가 없습니다.
@csrf
Provider / Model 관리

모델 추가

이미지 모델은 여기서 등록하고, 가격은 아래 가격표에서 연결합니다.

비활성화된 모델은 기본 이미지 모델로 선택할 수 없습니다.

저장
@csrf
Provider / Model 가격표

가격표 추가

관리자는 JSON 없이 일반 입력으로만 수정하면 됩니다.

과금 방식

선택한 방식에 맞는 가격 입력만 노출됩니다.

활성 상태

비활성화하면 새 요청에서 사용되지 않습니다.

Token rates
고급 설정
저장