mirror of
http://88.130.71.182:3000/BlitTech/contexta_be.git
synced 2026-06-12 23:23:21 +00:00
added analytics
This commit is contained in:
182
app/config.py
182
app/config.py
@@ -66,69 +66,72 @@ settings = Settings()
|
||||
|
||||
MODEL_CATALOG = {
|
||||
# ── Free tier (Fireworks - lightweight) ────────────────────────────────────
|
||||
"accounts/fireworks/models/kimi-k2-instruct-0905": {
|
||||
"name": "Kimi K2",
|
||||
"accounts/fireworks/models/llama-v3p3-70b-instruct": {
|
||||
"name": "Llama 3.3 70B",
|
||||
"provider": "Fireworks AI",
|
||||
"badge": "Free",
|
||||
"description": "Free model for building and testing chatbots",
|
||||
},
|
||||
|
||||
# ── Starter tier (Fireworks - powerful) ────────────────────────────────────
|
||||
"accounts/fireworks/models/llama-v3p1-70b-instruct": {
|
||||
"name": "Llama 3.1 70B",
|
||||
# ── Starter tier (Fireworks - powerful serverless models) ──────────────────
|
||||
"accounts/fireworks/models/qwen3-235b-a22b": {
|
||||
"name": "Qwen3 235B",
|
||||
"provider": "Fireworks AI",
|
||||
"badge": "Fast",
|
||||
"description": "Fast open-source model, great for most tasks",
|
||||
"badge": "Powerful",
|
||||
"description": "High-capability open model with great reasoning",
|
||||
},
|
||||
"accounts/fireworks/models/mixtral-8x7b-instruct": {
|
||||
"name": "Mixtral 8x7B",
|
||||
"accounts/fireworks/models/deepseek-v3p1": {
|
||||
"name": "DeepSeek V3.1",
|
||||
"provider": "Fireworks AI",
|
||||
"badge": "Balanced",
|
||||
"description": "Balanced speed and quality",
|
||||
"badge": "Smart",
|
||||
"description": "Cost-effective and highly capable model",
|
||||
},
|
||||
"accounts/fireworks/models/qwen2p5-72b-instruct": {
|
||||
"name": "Qwen 2.5 72B",
|
||||
"accounts/fireworks/models/kimi-k2-instruct-0905": {
|
||||
"name": "Kimi K2",
|
||||
"provider": "Fireworks AI",
|
||||
"badge": "Multilingual",
|
||||
"description": "Excellent multilingual capabilities",
|
||||
"description": "Strong multilingual and coding capabilities",
|
||||
},
|
||||
|
||||
# ── Pro tier (Premium providers) ───────────────────────────────────────────
|
||||
# OpenAI
|
||||
"gpt-4o": {
|
||||
"name": "GPT-4o",
|
||||
"provider": "OpenAI",
|
||||
"badge": "Powerful",
|
||||
"description": "Most capable OpenAI model",
|
||||
},
|
||||
"gpt-4-turbo": {
|
||||
"name": "GPT-4 Turbo",
|
||||
"provider": "OpenAI",
|
||||
"badge": "Smart",
|
||||
"description": "Fast and capable with large context",
|
||||
},
|
||||
"gpt-3.5-turbo": {
|
||||
"name": "GPT-3.5 Turbo",
|
||||
"gpt-4o-mini": {
|
||||
"name": "GPT-4o Mini",
|
||||
"provider": "OpenAI",
|
||||
"badge": "Efficient",
|
||||
"description": "Cost-effective for simpler tasks",
|
||||
"description": "Fast and cost-effective OpenAI model",
|
||||
},
|
||||
"claude-3-5-sonnet-20241022": {
|
||||
"name": "Claude 3.5 Sonnet",
|
||||
# Anthropic
|
||||
"claude-haiku-4-5-20251001": {
|
||||
"name": "Claude Haiku 4.5",
|
||||
"provider": "Anthropic",
|
||||
"badge": "Reasoning",
|
||||
"description": "Excellent at analysis and reasoning",
|
||||
"badge": "Fast",
|
||||
"description": "Fast and affordable Anthropic model",
|
||||
},
|
||||
"claude-3-opus-20240229": {
|
||||
"name": "Claude 3 Opus",
|
||||
"provider": "Anthropic",
|
||||
"badge": "Advanced",
|
||||
"description": "Most capable Anthropic model",
|
||||
},
|
||||
"gemini-1.5-pro": {
|
||||
"name": "Gemini 1.5 Pro",
|
||||
# Google Gemini
|
||||
"gemini-2.5-flash": {
|
||||
"name": "Gemini 2.5 Flash",
|
||||
"provider": "Google",
|
||||
"badge": "Long Context",
|
||||
"description": "Handles very long documents well",
|
||||
"badge": "Fast",
|
||||
"description": "Fast and efficient Google model",
|
||||
},
|
||||
"gemini-2.5-lite": {
|
||||
"name": "Gemini 2.5 Lite",
|
||||
"provider": "Google",
|
||||
"badge": "Lightweight",
|
||||
"description": "Cost-effective Google model",
|
||||
},
|
||||
"gemini-2.5-pro": {
|
||||
"name": "Gemini 2.5 Pro",
|
||||
"provider": "Google",
|
||||
"badge": "Advanced",
|
||||
"description": "Most capable Google model with long context",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -136,86 +139,133 @@ MODEL_CATALOG = {
|
||||
# ─── Model ID → LLM provider mapping (used by llm_client.py for routing) ─────
|
||||
|
||||
MODEL_PROVIDERS = {
|
||||
# Fireworks
|
||||
"accounts/fireworks/models/llama-v3p3-70b-instruct": "fireworks",
|
||||
"accounts/fireworks/models/qwen3-235b-a22b": "fireworks",
|
||||
"accounts/fireworks/models/deepseek-v3p1": "fireworks",
|
||||
"accounts/fireworks/models/kimi-k2-instruct-0905": "fireworks",
|
||||
"accounts/fireworks/models/llama-v3p1-70b-instruct": "fireworks",
|
||||
"accounts/fireworks/models/mixtral-8x7b-instruct": "fireworks",
|
||||
"accounts/fireworks/models/qwen2p5-72b-instruct": "fireworks",
|
||||
# OpenAI
|
||||
"gpt-4o": "openai",
|
||||
"gpt-4-turbo": "openai",
|
||||
"gpt-3.5-turbo": "openai",
|
||||
"claude-3-5-sonnet-20241022": "anthropic",
|
||||
"claude-3-opus-20240229": "anthropic",
|
||||
"gemini-1.5-pro": "google",
|
||||
"gpt-4o-mini": "openai",
|
||||
# Anthropic
|
||||
"claude-haiku-4-5-20251001": "anthropic",
|
||||
# Google
|
||||
"gemini-2.5-flash": "google",
|
||||
"gemini-2.5-lite": "google",
|
||||
"gemini-2.5-pro": "google",
|
||||
}
|
||||
|
||||
|
||||
# ─── Default model per plan (pre-selected in the frontend) ────────────────────
|
||||
|
||||
DEFAULT_MODELS = {
|
||||
"free": "accounts/fireworks/models/kimi-k2-instruct-0905",
|
||||
"starter": "accounts/fireworks/models/llama-v3p1-70b-instruct",
|
||||
"free": "accounts/fireworks/models/llama-v3p3-70b-instruct",
|
||||
"starter": "accounts/fireworks/models/qwen3-235b-a22b",
|
||||
"pro": "gpt-4o",
|
||||
"enterprise": "gpt-4o",
|
||||
}
|
||||
|
||||
|
||||
# ─── Plan limits ──────────────────────────────────────────────────────────────
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
# PLAN LIMITS — Pricing: Starter $3/mo, Pro $20/mo
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
#
|
||||
# Cost analysis (per 1M tokens approx):
|
||||
# Fireworks Llama 3.3 70B: $0.90/M
|
||||
# Fireworks Qwen3 235B: $0.22 in / $0.88 out
|
||||
# Fireworks DeepSeek V3.1: $0.56 in / $1.68 out
|
||||
# Fireworks Kimi K2: $0.60 in / $2.50 out
|
||||
# GPT-4o: $2.50 in / $10.00 out
|
||||
# GPT-4o Mini: $0.15 in / $0.60 out
|
||||
# Claude Haiku 4.5: $0.80 in / $4.00 out
|
||||
# Gemini 2.5 Flash: ~$0.15 in / $0.60 out
|
||||
# Gemini 2.5 Lite: ~$0.075 in / $0.30 out
|
||||
# Gemini 2.5 Pro: ~$1.25 in / $10.00 out
|
||||
#
|
||||
# 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
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
PLAN_LIMITS = {
|
||||
"free": {
|
||||
"max_chatbots": 999999, # unlimited creation
|
||||
"max_published": 0, # cannot publish
|
||||
"max_published": 0, # cannot publish
|
||||
"max_documents_per_chatbot": 3,
|
||||
"max_document_size_mb": 5,
|
||||
"models": [
|
||||
"accounts/fireworks/models/kimi-k2-instruct-0905",
|
||||
"accounts/fireworks/models/llama-v3p3-70b-instruct",
|
||||
],
|
||||
"conversations_limit": 999999, # unlimited preview
|
||||
"conversations_limit": 50, # 50 preview conversations/month
|
||||
"code_export": False,
|
||||
"analytics": False,
|
||||
"features": ["preview_mode", "testing"],
|
||||
},
|
||||
"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",
|
||||
"accounts/fireworks/models/llama-v3p1-70b-instruct",
|
||||
"accounts/fireworks/models/mixtral-8x7b-instruct",
|
||||
"accounts/fireworks/models/qwen2p5-72b-instruct",
|
||||
],
|
||||
"conversations_limit": 5000,
|
||||
"conversations_limit": 500, # 500 conversations/month
|
||||
"code_export": False,
|
||||
"analytics": True,
|
||||
"features": ["marketplace", "analytics", "branding"],
|
||||
},
|
||||
"pro": {
|
||||
"max_chatbots": 3,
|
||||
"max_published": 3,
|
||||
"max_chatbots": 5,
|
||||
"max_published": 5,
|
||||
"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",
|
||||
"accounts/fireworks/models/llama-v3p1-70b-instruct",
|
||||
"accounts/fireworks/models/mixtral-8x7b-instruct",
|
||||
# OpenAI
|
||||
"gpt-4o",
|
||||
"gpt-4-turbo",
|
||||
"gpt-3.5-turbo",
|
||||
"claude-3-5-sonnet-20241022",
|
||||
"claude-3-opus-20240229",
|
||||
"gemini-1.5-pro",
|
||||
"gpt-4o-mini",
|
||||
# Anthropic
|
||||
"claude-haiku-4-5-20251001",
|
||||
# Google
|
||||
"gemini-2.5-flash",
|
||||
"gemini-2.5-lite",
|
||||
"gemini-2.5-pro",
|
||||
],
|
||||
"conversations_limit": 20000,
|
||||
"conversations_limit": 2000, # 2,000 conversations/month
|
||||
"code_export": True,
|
||||
"analytics": True,
|
||||
"features": [
|
||||
"marketplace",
|
||||
"code_export",
|
||||
"advanced_analytics",
|
||||
"priority_support",
|
||||
"custom_domain",
|
||||
"ab_testing",
|
||||
],
|
||||
},
|
||||
"enterprise": {
|
||||
"max_chatbots": 999999,
|
||||
"max_published": 999999,
|
||||
"max_documents_per_chatbot": 999999,
|
||||
"max_document_size_mb": 200,
|
||||
"models": ["*"], # resolves to all MODEL_CATALOG keys
|
||||
"conversations_limit": 999999,
|
||||
"code_export": True,
|
||||
"analytics": True,
|
||||
"features": ["*"],
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user