updates Mar6

This commit is contained in:
belviskhoremk
2026-03-06 22:37:40 +00:00
parent 2ed998058e
commit 9dccc83293
23 changed files with 2257 additions and 74 deletions

View File

@@ -31,7 +31,8 @@ class Settings(BaseSettings):
stripe_secret_key: str = ""
stripe_webhook_secret: str = ""
stripe_starter_price_id: str = ""
stripe_pro_price_id: str = ""
stripe_business_price_id: str = ""
stripe_agency_price_id: str = ""
# Redis
redis_url: str = "redis://localhost:6379"
@@ -42,6 +43,25 @@ class Settings(BaseSettings):
# Files
max_file_size_mb: int = 50
# App URL (for widget embedding)
app_url: str = "http://localhost:5173"
# Backend API URL (used for Telegram webhook registration)
api_url: str = "http://localhost:8000"
# n8n Handoff webhook
n8n_handoff_webhook_url: Optional[str] = None
# Supabase Storage
supabase_storage_url: str = ""
# WhatsApp Cloud API
whatsapp_access_token: str = ""
whatsapp_phone_number_id: str = ""
whatsapp_verify_token: str = "contexta_whatsapp_verify"
whatsapp_app_secret: str = ""
whatsapp_display_number: str = "" # E.164 without '+', e.g. "15551234567"
@property
def allowed_origins_list(self) -> List[str]:
return [o.strip() for o in self.allowed_origins.split(",")]
@@ -161,13 +181,14 @@ MODEL_PROVIDERS = {
DEFAULT_MODELS = {
"free": "accounts/fireworks/models/llama-v3p3-70b-instruct",
"starter": "accounts/fireworks/models/qwen3-235b-a22b",
"pro": "gpt-4o",
"business": "gpt-4o",
"agency": "gpt-4o",
"enterprise": "gpt-4o",
}
# ═══════════════════════════════════════════════════════════════════════════════
# PLAN LIMITS — Pricing: Starter $3/mo, Pro $20/mo
# PLAN LIMITS — Pricing: Starter $12/mo, Business $29/mo, Agency $79/mo
# ═══════════════════════════════════════════════════════════════════════════════
#
# Cost analysis (per 1M tokens approx):
@@ -185,87 +206,102 @@ DEFAULT_MODELS = {
# Avg conversation: ~2K tokens input + 1K output = ~3K tokens
# Fireworks models: ~$0.001-$0.004 per conversation
# GPT-4o: ~$0.015 per conversation
# GPT-4o Mini: ~$0.001 per conversation
# Claude Haiku: ~$0.006 per conversation
# Gemini Flash: ~$0.001 per conversation
# Gemini Pro: ~$0.013 per conversation
#
# Starter at $3/mo with 500 convos: max cost ~$2/mo (fireworks) → margin OK
# Pro at $20/mo with 2,000 convos: max cost ~$12/mo (if all GPT-4o) → margin OK
# Typical mix: ~$5-8/mo actual cost → healthy margin
# Starter $12/mo, 1500 convos: max cost ~$6/mo (fireworks mix) → margin OK
# Business $29/mo, 5000 convos: max cost ~$15/mo (mixed models) → margin OK
# Agency $79/mo, 20000 convos: max cost ~$30/mo (fireworks) → healthy margin
# ═══════════════════════════════════════════════════════════════════════════════
_ALL_FIREWORKS = [
"accounts/fireworks/models/llama-v3p3-70b-instruct",
"accounts/fireworks/models/qwen3-235b-a22b",
"accounts/fireworks/models/deepseek-v3p1",
"accounts/fireworks/models/kimi-k2-instruct-0905",
]
_ALL_PREMIUM = [
"gpt-4o", "gpt-4o-mini",
"claude-haiku-4-5-20251001",
"gemini-2.5-flash", "gemini-2.5-lite", "gemini-2.5-pro",
]
PLAN_LIMITS = {
# ── Free ─────────────────────────────────────────────────────────────────
# Build, test, and go live with one chatbot — no card needed.
"free": {
"max_chatbots": 999999, # unlimited creation
"max_published": 0, # cannot publish
"max_chatbots": 999999,
"max_published": 1, # can publish 1 chatbot
"max_documents_per_chatbot": 3,
"max_document_size_mb": 5,
"models": [
"accounts/fireworks/models/llama-v3p3-70b-instruct",
],
"conversations_limit": 50, # 50 preview conversations/month
"models": ["accounts/fireworks/models/llama-v3p3-70b-instruct"],
"conversations_limit": 100, # 100 real conversations/month
"code_export": False,
"analytics": False,
"features": ["preview_mode", "testing"],
"channels": [], # no messaging channels
"url_sources": 0,
"leads_per_month": 0,
"show_branding": True, # cannot remove badge
},
# ── Starter $12/mo ───────────────────────────────────────────────────────
# For individuals and solo businesses going live.
"starter": {
"max_chatbots": 999999,
"max_published": 1,
"max_documents_per_chatbot": 10,
"max_document_size_mb": 10,
"models": [
"accounts/fireworks/models/llama-v3p3-70b-instruct",
"accounts/fireworks/models/qwen3-235b-a22b",
"accounts/fireworks/models/deepseek-v3p1",
"accounts/fireworks/models/kimi-k2-instruct-0905",
],
"conversations_limit": 500, # 500 conversations/month
"models": _ALL_FIREWORKS,
"conversations_limit": 1500,
"code_export": False,
"analytics": True,
"features": ["marketplace", "analytics", "branding"],
"channels": ["telegram"],
"url_sources": 5,
"leads_per_month": 500,
"show_branding": True, # badge stays
},
"pro": {
"max_chatbots": 5,
"max_published": 5,
# ── Business $29/mo ──────────────────────────────────────────────────────
# For growing businesses that need more chatbots and WhatsApp reach.
"business": {
"max_chatbots": 999999,
"max_published": 3,
"max_documents_per_chatbot": 50,
"max_document_size_mb": 50,
"models": [
# Fireworks (included)
"accounts/fireworks/models/llama-v3p3-70b-instruct",
"accounts/fireworks/models/qwen3-235b-a22b",
"accounts/fireworks/models/deepseek-v3p1",
"accounts/fireworks/models/kimi-k2-instruct-0905",
# OpenAI
"gpt-4o",
"gpt-4o-mini",
# Anthropic
"claude-haiku-4-5-20251001",
# Google
"gemini-2.5-flash",
"gemini-2.5-lite",
"gemini-2.5-pro",
],
"conversations_limit": 2000, # 2,000 conversations/month
"code_export": True,
"models": _ALL_FIREWORKS + _ALL_PREMIUM,
"conversations_limit": 5000,
"code_export": False,
"analytics": True,
"features": [
"marketplace",
"code_export",
"advanced_analytics",
"priority_support",
"custom_domain",
],
"channels": ["telegram", "whatsapp"],
"url_sources": 999999,
"leads_per_month": 999999,
"show_branding": False, # can remove badge
},
"enterprise": {
# ── Agency $79/mo ────────────────────────────────────────────────────────
# For agencies and large businesses managing many chatbots.
"agency": {
"max_chatbots": 999999,
"max_published": 999999,
"max_documents_per_chatbot": 999999,
"max_document_size_mb": 200,
"models": ["*"], # resolves to all MODEL_CATALOG keys
"models": _ALL_FIREWORKS + _ALL_PREMIUM,
"conversations_limit": 20000,
"code_export": True,
"analytics": True,
"channels": ["telegram", "whatsapp"],
"url_sources": 999999,
"leads_per_month": 999999,
"show_branding": False,
},
# ── Enterprise (custom) ───────────────────────────────────────────────────
"enterprise": {
"max_chatbots": 999999,
"max_published": 999999,
"max_documents_per_chatbot": 999999,
"max_document_size_mb": 999999,
"models": ["*"],
"conversations_limit": 999999,
"code_export": True,
"analytics": True,
"features": ["*"],
"channels": ["telegram", "whatsapp"],
"url_sources": 999999,
"leads_per_month": 999999,
"show_branding": False,
},
}