- Task 1: Admin endpoints for wallet management (balance, ledger, adjust, reconcile) - Task 2: AI Credits admin UI (pricing.tsx, credit.tsx) - Task 3: Ollama security (NetworkPolicy, prompt validation, audit logging) - Task 4: LiteLLM integration (litellm.rs, migrated AI feature handlers) - Task 5: Refund architecture (ai_refunds table, endpoints) - Task 6: Coupons, promotions, referrals (order creation with coupon validation) - Task 7: Subscription lifecycle (plan upgrades/downgrades/cancellations, cron jobs) - Task 8: Credit expiration enforcement (daily cron task) - Task 9: Token cost engine (ai_model_cost_config, margin view) - Task 10: Observability (metrics tables, aggregation function) New files: - apps/users/src/litellm.rs (LiteLLM client) - apps/users/src/ai_credits.rs (Charging primitives) - apps/users/src/ai_subscription.rs (Plan lifecycle) - apps/users/src/handlers/ai_credits.rs (Admin endpoints) - apps/payments/src/ai_credits.rs (Package purchase) - apps/payments/src/payu.rs (PayU integration) - apps/cron/src/tasks/ai_credits.rs (Cron jobs) - 9 SQL migrations for schema - crates/db/src/models/ai_credits.rs (Repository) - tests for ai_credits
20 lines
875 B
PL/PgSQL
20 lines
875 B
PL/PgSQL
-- A first batch of real feature costs so the wallet primitives (Phase 1)
|
|
-- have something concrete to charge against once wired into handlers.
|
|
-- Model aliases match the real LiteLLM deployment
|
|
-- (nxtgauge-gitops/apps/litellm/base/configmap.yaml): askash-fast /
|
|
-- askash-main. Costs are illustrative starting points, not a pricing
|
|
-- decision -- see Appendix Q4 of the architecture doc.
|
|
|
|
BEGIN;
|
|
|
|
INSERT INTO ai_feature_costs (feature_code, display_name, default_model, credit_cost, timeout_ms) VALUES
|
|
('help_answer', 'Help Answer', 'askash-fast', 1, 10000),
|
|
('jd_generate', 'Job Description Generate', 'askash-main', 5, 20000),
|
|
('cover_letter_generate', 'Cover Letter Generate', 'askash-main', 5, 20000),
|
|
('resume_improve', 'Resume Improve', 'askash-main', 8, 20000);
|
|
|
|
UPDATE ai_plans
|
|
SET allowed_features = '["help_answer", "jd_generate"]'
|
|
WHERE code = 'free';
|
|
|
|
COMMIT;
|