From 544a397e3de415563e4bdd7f08336e56a420814b Mon Sep 17 00:00:00 2001 From: "IGNY8 VPS (Salman)" Date: Fri, 26 Dec 2025 01:25:25 +0000 Subject: [PATCH] tokens ocnifg 1000 per credit adn fix --- PRICING-SIMPLIFICATION-ANALYSIS.md | 179 ++++++++++++++++++ backend/igny8_core/business/billing/models.py | 5 + backend/igny8_core/modules/billing/admin.py | 13 ++ ...reditcostconfig_operation_type_and_more.py | 28 +++ ...22_fix_historical_calculation_mode_null.py | 18 ++ 5 files changed, 243 insertions(+) create mode 100644 PRICING-SIMPLIFICATION-ANALYSIS.md create mode 100644 backend/igny8_core/modules/billing/migrations/0021_alter_creditcostconfig_operation_type_and_more.py create mode 100644 backend/igny8_core/modules/billing/migrations/0022_fix_historical_calculation_mode_null.py diff --git a/PRICING-SIMPLIFICATION-ANALYSIS.md b/PRICING-SIMPLIFICATION-ANALYSIS.md new file mode 100644 index 00000000..bbe03753 --- /dev/null +++ b/PRICING-SIMPLIFICATION-ANALYSIS.md @@ -0,0 +1,179 @@ +# IGNY8 Pricing System - Final Plan + +**Date:** December 26, 2025 +**Status:** APPROVED + +--- + +## 1. Pricing Foundation + +### 1.1 Credit Pricing + +| Item | User Pays | +|------|-----------| +| **1 Credit** | **$0.10** | +| 1 Basic Image | 1 credit ($0.10) | +| 1 Premium Image | 4 credits ($0.40) | + +*Everything is credits. Images consume credits.* + +### 1.2 Our Costs + +| Item | Our Cost | User Pays | Margin | +|------|----------|-----------|--------| +| 1 Credit (AI tokens) | $0.01 | $0.10 | 90% | +| 1 Basic Image | $0.02 | $0.10 | 80% | +| 1 Premium Image | $0.08 | $0.40 | 80% | + +--- + +## 2. Plan Structure + +### 2.1 Credits per Plan + +| Plan | Total Credits | Image Allocation | AI Credits | Plan Price | +|------|---------------|------------------|------------|------------| +| **Starter** | 1,000 | 200 basic (or 50 premium) | 800 | **$100** | +| **Growth** | 2,000 | 800 basic (or 200 premium) | 1,200 | **$200** | +| **Scale** | 5,000 | 2,000 basic (or 500 premium) | 3,000 | **$500** | + +*Price = Total Credits × $0.10* + +### 2.2 Other Plan Limits (from screenshot) + +| Plan | Price | Sites | Users | Keywords | Articles* | +|------|-------|-------|-------|----------|-----------| +| **Starter** | $100 | 2 | 2 | 500 | ~50 | +| **Growth** | $200 | 5 | 3 | 2,000 | ~200 | +| **Scale** | $500 | 99 | 5 | 5,000 | ~500 | + +*Approximate based on credit allocation + +--- + +## 3. Credit Cost per Operation + +| Operation | Credits | Notes | +|-----------|---------|-------| +| Clustering | 5 | Per cluster batch | +| Idea Generation | 10 | Per idea | +| Content Writing (Short ~800w) | 20 | Minimum | +| Content Writing (Medium ~1500w) | 30 | Average | +| Content Writing (Long ~2500w) | 40 | Long-form | +| Image Prompt Extraction | 10 | Per article | +| Basic Image | 1 | Per image | +| Premium Image | 4 | Per image | +| Linking | 3 | Per article | +| Optimization | 5 | Per article | + +--- + +## 4. Use Case Scenarios (Full Plan Consumption) + +### 4.1 Starter Plan (1000 credits) + +| Scenario | Clustering | Ideas | Content | Img Prompts | Images | Link/Opt | Total | Fits? | +|----------|------------|-------|---------|-------------|--------|----------|-------|-------| +| **Heavy Images** | 5×5=25 | 10×10=100 | 10×25=250 | 10×10=100 | 200×1=200 | 10×8=80 | **755** | ✅ | +| **Premium Images** | 5×5=25 | 10×10=100 | 10×25=250 | 10×10=100 | 50×4=200 | 10×8=80 | **755** | ✅ | +| **Content Heavy** | 10×5=50 | 30×10=300 | 20×30=600 | 0 | 0 | 0 | **950** | ✅ | +| **Balanced** | 5×5=25 | 15×10=150 | 15×25=375 | 15×10=150 | 100×1=100 | 15×8=120 | **920** | ✅ | +| **Long Articles** | 3×5=15 | 8×10=80 | 8×40=320 | 8×10=80 | 150×1=150 | 8×8=64 | **709** | ✅ | + +**Starter delivers: 8-20 articles depending on usage pattern** + +### 4.2 Growth Plan (2000 credits) + +| Scenario | Clustering | Ideas | Content | Img Prompts | Images | Link/Opt | Total | Fits? | +|----------|------------|-------|---------|-------------|--------|----------|-------|-------| +| **Heavy Images** | 10×5=50 | 25×10=250 | 25×25=625 | 25×10=250 | 500×1=500 | 25×8=200 | **1875** | ✅ | +| **Premium Focus** | 10×5=50 | 30×10=300 | 30×25=750 | 30×10=300 | 100×4=400 | 30×8=240 | **2040** | ⚠️ | +| **Content Heavy** | 15×5=75 | 50×10=500 | 40×30=1200 | 0 | 0 | 0 | **1775** | ✅ | +| **Balanced** | 10×5=50 | 40×10=400 | 35×25=875 | 35×10=350 | 250×1=250 | 0 | **1925** | ✅ | +| **Agency Mix** | 15×5=75 | 60×10=600 | 30×30=900 | 30×10=300 | 100×1=100 | 0 | **1975** | ✅ | + +**Growth delivers: 25-50 articles depending on usage pattern** + +### 4.3 Scale Plan (5000 credits) + +| Scenario | Clustering | Ideas | Content | Img Prompts | Images | Link/Opt | Total | Fits? | +|----------|------------|-------|---------|-------------|--------|----------|-------|-------| +| **Heavy Images** | 20×5=100 | 80×10=800 | 80×25=2000 | 80×10=800 | 800×1=800 | 80×8=640 | **5140** | ⚠️ | +| **Premium Focus** | 25×5=125 | 100×10=1000 | 100×25=2500 | 100×10=1000 | 100×4=400 | 0 | **5025** | ⚠️ | +| **Content Heavy** | 30×5=150 | 150×10=1500 | 100×30=3000 | 0 | 0 | 0 | **4650** | ✅ | +| **Balanced** | 25×5=125 | 100×10=1000 | 80×30=2400 | 80×10=800 | 400×1=400 | 0 | **4725** | ✅ | +| **Full Pipeline** | 20×5=100 | 80×10=800 | 70×30=2100 | 70×10=700 | 600×1=600 | 70×8=560 | **4860** | ✅ | + +**Scale delivers: 70-150 articles depending on usage pattern** + +--- + +## 5. Cost vs Pricing Analysis + +### 5.1 Our Cost per Plan (Worst Case - Max Images) + +| Plan | AI Credits Cost | Image Cost | Total Our Cost | Plan Price | Margin | +|------|-----------------|------------|----------------|------------|--------| +| **Starter** | 800 × $0.01 = $8 | 200 × $0.02 = $4 | **$12** | $100 | **88%** | +| **Growth** | 1200 × $0.01 = $12 | 800 × $0.02 = $16 | **$28** | $200 | **86%** | +| **Scale** | 3000 × $0.01 = $30 | 2000 × $0.02 = $40 | **$70** | $500 | **86%** | + +### 5.2 Our Cost per Plan (Premium Images) + +| Plan | AI Credits Cost | Image Cost | Total Our Cost | Plan Price | Margin | +|------|-----------------|------------|----------------|------------|--------| +| **Starter** | 800 × $0.01 = $8 | 50 × $0.08 = $4 | **$12** | $100 | **88%** | +| **Growth** | 1200 × $0.01 = $12 | 200 × $0.08 = $16 | **$28** | $200 | **86%** | +| **Scale** | 3000 × $0.01 = $30 | 500 × $0.08 = $40 | **$70** | $500 | **86%** | + +### 5.3 Cost per Article + +| Plan | Plan Price | ~Articles | Price/Article | +|------|------------|-----------|---------------| +| **Starter** | $100 | 15 | **$6.67** | +| **Growth** | $200 | 40 | **$5.00** | +| **Scale** | $500 | 100 | **$5.00** | + +--- + +## 6. Final Plan Summary + +| Plan | Price | Credits | Image Allocation | Sites | Users | Keywords | +|------|-------|---------|------------------|-------|-------|----------| +| **Starter** | **$100/mo** | 1,000 | 200 basic / 50 premium | 2 | 2 | 500 | +| **Growth** | **$200/mo** | 2,000 | 800 basic / 200 premium | 5 | 3 | 2,000 | +| **Scale** | **$500/mo** | 5,000 | 2,000 basic / 500 premium | 99 | 5 | 5,000 | + +### What User Gets + +| Metric | Starter | Growth | Scale | +|--------|---------|--------|-------| +| **~Articles/month** | 15 | 40 | 100 | +| **~Images/month** | 200 | 800 | 2,000 | +| **Our Margin** | 88% | 86% | 86% | + +--- + +## 7. Simplified System + +### 7.1 Remove All Monthly Limits + +**Keep only:** +- ✅ Credits (single pool) +- ✅ Keywords (storage limit) +- ✅ Sites, Users (account limits) + +**Remove:** +- ❌ max_content_ideas +- ❌ max_content_words +- ❌ max_images_basic / max_images_premium +- ❌ max_image_prompts +- ❌ All usage tracking fields + +### 7.2 How Images Work + +Images just consume credits from the same pool: +- Basic image = 1 credit +- Premium image = 4 credits + +User decides how to spend their credits (AI or images). diff --git a/backend/igny8_core/business/billing/models.py b/backend/igny8_core/business/billing/models.py index d08f93cd..7950dd18 100644 --- a/backend/igny8_core/business/billing/models.py +++ b/backend/igny8_core/business/billing/models.py @@ -75,7 +75,12 @@ class CreditUsageLog(AccountBaseModel): ('idea_generation', 'Content Ideas Generation'), ('content_generation', 'Content Generation'), ('image_generation', 'Image Generation'), + ('image_prompt_extraction', 'Image Prompt Extraction'), + ('linking', 'Internal Linking'), + ('optimization', 'Content Optimization'), ('reparse', 'Content Reparse'), + ('site_page_generation', 'Site Page Generation'), + ('site_structure_generation', 'Site Structure Generation'), ('ideas', 'Content Ideas Generation'), # Legacy ('content', 'Content Generation'), # Legacy ('images', 'Image Generation'), # Legacy diff --git a/backend/igny8_core/modules/billing/admin.py b/backend/igny8_core/modules/billing/admin.py index a7a2471f..32ec906b 100644 --- a/backend/igny8_core/modules/billing/admin.py +++ b/backend/igny8_core/modules/billing/admin.py @@ -566,6 +566,7 @@ class CreditCostConfigAdmin(SimpleHistoryAdmin, Igny8ModelAdmin): list_filter = ['is_active', 'updated_at'] search_fields = ['operation_type', 'display_name', 'description'] + actions = ['bulk_activate', 'bulk_deactivate'] fieldsets = ( ('Operation', { @@ -625,6 +626,18 @@ class CreditCostConfigAdmin(SimpleHistoryAdmin, Igny8ModelAdmin): """Track who made the change""" obj.updated_by = request.user super().save_model(request, obj, form, change) + + @admin.action(description='Activate selected configurations') + def bulk_activate(self, request, queryset): + """Bulk activate credit cost configurations""" + updated = queryset.update(is_active=True) + self.message_user(request, f'{updated} configuration(s) activated.', messages.SUCCESS) + + @admin.action(description='Deactivate selected configurations') + def bulk_deactivate(self, request, queryset): + """Bulk deactivate credit cost configurations""" + updated = queryset.update(is_active=False) + self.message_user(request, f'{updated} configuration(s) deactivated.', messages.WARNING) class PlanLimitUsageResource(resources.ModelResource): diff --git a/backend/igny8_core/modules/billing/migrations/0021_alter_creditcostconfig_operation_type_and_more.py b/backend/igny8_core/modules/billing/migrations/0021_alter_creditcostconfig_operation_type_and_more.py new file mode 100644 index 00000000..08428f10 --- /dev/null +++ b/backend/igny8_core/modules/billing/migrations/0021_alter_creditcostconfig_operation_type_and_more.py @@ -0,0 +1,28 @@ +# Generated by Django 5.2.9 on 2025-12-26 01:13 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('billing', '0020_create_ai_model_config'), + ] + + operations = [ + migrations.AlterField( + model_name='creditcostconfig', + name='operation_type', + field=models.CharField(choices=[('clustering', 'Keyword Clustering'), ('idea_generation', 'Content Ideas Generation'), ('content_generation', 'Content Generation'), ('image_generation', 'Image Generation'), ('image_prompt_extraction', 'Image Prompt Extraction'), ('linking', 'Internal Linking'), ('optimization', 'Content Optimization'), ('reparse', 'Content Reparse'), ('site_page_generation', 'Site Page Generation'), ('site_structure_generation', 'Site Structure Generation'), ('ideas', 'Content Ideas Generation'), ('content', 'Content Generation'), ('images', 'Image Generation')], help_text='AI operation type', max_length=50, unique=True), + ), + migrations.AlterField( + model_name='creditusagelog', + name='operation_type', + field=models.CharField(choices=[('clustering', 'Keyword Clustering'), ('idea_generation', 'Content Ideas Generation'), ('content_generation', 'Content Generation'), ('image_generation', 'Image Generation'), ('image_prompt_extraction', 'Image Prompt Extraction'), ('linking', 'Internal Linking'), ('optimization', 'Content Optimization'), ('reparse', 'Content Reparse'), ('site_page_generation', 'Site Page Generation'), ('site_structure_generation', 'Site Structure Generation'), ('ideas', 'Content Ideas Generation'), ('content', 'Content Generation'), ('images', 'Image Generation')], db_index=True, max_length=50), + ), + migrations.AlterField( + model_name='historicalcreditcostconfig', + name='operation_type', + field=models.CharField(choices=[('clustering', 'Keyword Clustering'), ('idea_generation', 'Content Ideas Generation'), ('content_generation', 'Content Generation'), ('image_generation', 'Image Generation'), ('image_prompt_extraction', 'Image Prompt Extraction'), ('linking', 'Internal Linking'), ('optimization', 'Content Optimization'), ('reparse', 'Content Reparse'), ('site_page_generation', 'Site Page Generation'), ('site_structure_generation', 'Site Structure Generation'), ('ideas', 'Content Ideas Generation'), ('content', 'Content Generation'), ('images', 'Image Generation')], db_index=True, help_text='AI operation type', max_length=50), + ), + ] diff --git a/backend/igny8_core/modules/billing/migrations/0022_fix_historical_calculation_mode_null.py b/backend/igny8_core/modules/billing/migrations/0022_fix_historical_calculation_mode_null.py new file mode 100644 index 00000000..31ffb7aa --- /dev/null +++ b/backend/igny8_core/modules/billing/migrations/0022_fix_historical_calculation_mode_null.py @@ -0,0 +1,18 @@ +# Generated manually +# Fix historical table to allow NULL in calculation_mode column + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('billing', '0021_alter_creditcostconfig_operation_type_and_more'), + ] + + operations = [ + migrations.RunSQL( + sql='ALTER TABLE billing_historicalcreditcostconfig ALTER COLUMN calculation_mode DROP NOT NULL;', + reverse_sql='ALTER TABLE billing_historicalcreditcostconfig ALTER COLUMN calculation_mode SET NOT NULL;', + ), + ]