feat: Portal Chat - Implement controlled demo pricing model
Resolved 💬 3 comments Opened Jan 11, 2026 by manpro Closed Feb 25, 2026
Summary
Portal chat currently uses admin API key (CONTROL_LAYER_ADMIN_API_KEY) which means users are NOT charged for chat usage. This needs to be fixed to use proper billing while positioning chat as a demo/onboarding tool.
Current Problem
// chat.controller.ts:364-365
const adminApiKey = process.env.CONTROL_LAYER_ADMIN_API_KEY || '';
const completion = await controlLayer.createCompletion({...}, adminApiKey);
- All chat costs go to admin/system account
- User's balance is NOT affected
ChatConversation.totalCostis just metadata, not actual billing
Proposed Solution
Positioning
Chat is not a product - it's a demo instrument for:
- Lowering threshold to understand Qwen3 30B VL (text + vision)
- Showing latency, quality, multimodality without SDK
- Reducing support friction during onboarding
Pricing Model
- 10% of standard token price (not a discount - it's positioning)
- Same wallet/credits as API
- All usage visible in usage dashboard
Technical Implementation
- Use user's API key (not admin key)
- Require user to select/create an API key for chat
- Or auto-create a "portal-chat" key per org
- Apply chat discount in Control Layer
- New pricing tier:
chat_demoat 10% of standard - Or apply multiplier in Portal BFF before calling CL
- Guardrails
- Max context: 16k tokens
- Rate limit per user/session
- No streaming burst
- No batch operations
UI Changes
- Label chat as: "Interactive demo — not intended for production workloads"
- Position as "Try the model" not "Chat with AI"
- Signal: "Inference provider, not chat app"
Files to Modify
portal-bff/src/controllers/chat.controller.ts- Use user API key, apply pricingportal-bff/src/controllers/streaming-chat.controller.ts- Same changesportal-ui/app/(dashboard)/chat/page.tsx- Add demo disclaimer- Control Layer: Add
chat_demopricing tier (optional)
Acceptance Criteria
- [ ] Chat uses user's org balance, not admin account
- [ ] Chat priced at 10% of standard API rate
- [ ] Clear "demo/playground" labeling in UI
- [ ] Rate limits and context limits enforced
- [ ] Usage appears in user's usage dashboard
Priority
Medium - Current setup works but has incorrect billing model
---
Created from portal code analysis 2026-01-11
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗