New Model & tokens/credits updates
This commit is contained in:
119
backend/seed_ai_models.py
Normal file
119
backend/seed_ai_models.py
Normal file
@@ -0,0 +1,119 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Seed AI model configurations
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import django
|
||||
|
||||
# Setup Django
|
||||
sys.path.insert(0, '/app')
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'igny8_core.settings')
|
||||
django.setup()
|
||||
|
||||
from django.db import transaction
|
||||
from igny8_core.business.billing.models import AIModelConfig
|
||||
|
||||
models_data = [
|
||||
{
|
||||
'model_name': 'gpt-4o-mini',
|
||||
'provider': 'openai',
|
||||
'model_type': 'text',
|
||||
'cost_per_1k_input_tokens': 0.000150,
|
||||
'cost_per_1k_output_tokens': 0.000600,
|
||||
'tokens_per_credit': 50,
|
||||
'display_name': 'GPT-4o Mini',
|
||||
'is_active': True,
|
||||
'is_default': True,
|
||||
},
|
||||
{
|
||||
'model_name': 'gpt-4-turbo-2024-04-09',
|
||||
'provider': 'openai',
|
||||
'model_type': 'text',
|
||||
'cost_per_1k_input_tokens': 0.010000,
|
||||
'cost_per_1k_output_tokens': 0.030000,
|
||||
'tokens_per_credit': 30,
|
||||
'display_name': 'GPT-4 Turbo',
|
||||
'is_active': True,
|
||||
'is_default': False,
|
||||
},
|
||||
{
|
||||
'model_name': 'gpt-3.5-turbo',
|
||||
'provider': 'openai',
|
||||
'model_type': 'text',
|
||||
'cost_per_1k_input_tokens': 0.000500,
|
||||
'cost_per_1k_output_tokens': 0.001500,
|
||||
'tokens_per_credit': 200,
|
||||
'display_name': 'GPT-3.5 Turbo',
|
||||
'is_active': True,
|
||||
'is_default': False,
|
||||
},
|
||||
{
|
||||
'model_name': 'claude-3-5-sonnet-20241022',
|
||||
'provider': 'anthropic',
|
||||
'model_type': 'text',
|
||||
'cost_per_1k_input_tokens': 0.003000,
|
||||
'cost_per_1k_output_tokens': 0.015000,
|
||||
'tokens_per_credit': 40,
|
||||
'display_name': 'Claude 3.5 Sonnet',
|
||||
'is_active': True,
|
||||
'is_default': False,
|
||||
},
|
||||
{
|
||||
'model_name': 'claude-3-haiku-20240307',
|
||||
'provider': 'anthropic',
|
||||
'model_type': 'text',
|
||||
'cost_per_1k_input_tokens': 0.000250,
|
||||
'cost_per_1k_output_tokens': 0.001250,
|
||||
'tokens_per_credit': 150,
|
||||
'display_name': 'Claude 3 Haiku',
|
||||
'is_active': True,
|
||||
'is_default': False,
|
||||
},
|
||||
{
|
||||
'model_name': 'runware-flux-1.1-pro',
|
||||
'provider': 'runware',
|
||||
'model_type': 'image',
|
||||
'cost_per_1k_input_tokens': 0.000000,
|
||||
'cost_per_1k_output_tokens': 0.040000,
|
||||
'tokens_per_credit': 1,
|
||||
'display_name': 'Runware FLUX 1.1 Pro',
|
||||
'is_active': True,
|
||||
'is_default': True,
|
||||
},
|
||||
{
|
||||
'model_name': 'dall-e-3',
|
||||
'provider': 'openai',
|
||||
'model_type': 'image',
|
||||
'cost_per_1k_input_tokens': 0.000000,
|
||||
'cost_per_1k_output_tokens': 0.040000,
|
||||
'tokens_per_credit': 1,
|
||||
'display_name': 'DALL-E 3',
|
||||
'is_active': True,
|
||||
'is_default': False,
|
||||
},
|
||||
]
|
||||
|
||||
print('Seeding AI model configurations...')
|
||||
created_count = 0
|
||||
updated_count = 0
|
||||
|
||||
with transaction.atomic():
|
||||
for data in models_data:
|
||||
model, created = AIModelConfig.objects.update_or_create(
|
||||
model_name=data['model_name'],
|
||||
defaults=data
|
||||
)
|
||||
|
||||
if created:
|
||||
created_count += 1
|
||||
print(f'✓ Created: {model.display_name}')
|
||||
else:
|
||||
updated_count += 1
|
||||
print(f'↻ Updated: {model.display_name}')
|
||||
|
||||
print('\n' + '='*60)
|
||||
print(f'✓ Successfully processed {len(models_data)} AI models')
|
||||
print(f' - Created: {created_count}')
|
||||
print(f' - Updated: {updated_count}')
|
||||
print('='*60)
|
||||
Reference in New Issue
Block a user