In the Community Edition, SynthStack ships with credit‑metered AI chat and generation endpoints backed by the TypeScript ML service (packages/ts-ml-service). These power the in-app pages:
http://localhost:3050/app/chat(AI Chat)http://localhost:3050/app/generate(Text Generation)http://localhost:3050/app/images(Image Generation)
Pro-only: RAG indexing, multi-agent orchestration, and the full “Copilot Hub” UI. See
docs/PORTAL_COPILOT_ARCHITECTURE.md.
All endpoints require auth and deduct credits on success.
POST /api/v1/chat/completionsPOST /api/v1/chat/completions/stream(SSE)
POST /api/v1/generation/textPOST /api/v1/generation/image
GET /api/v1/users/me(includescredits_remaining+ tier)GET /api/v1/users/me/history(credit transactions)GET /api/v1/credits/unified(unified credit status)
OpenAPI: http://localhost:3003/docs
- Insufficient balance returns 402 with
{ required, remaining }. - Credit transactions are recorded in
credit_transactionswithtype='generation'andtransaction_type='deduction'. - Plan defaults are defined in
packages/api-gateway/src/services/stripe.ts(TIER_CONFIG).
ML_SERVICE_URL(defaulthttp://localhost:8001)OPENAI_API_KEY/ANTHROPIC_API_KEY/OPENROUTER_API_KEY(depending on routing)
VITE_API_URL(defaulthttp://localhost:3003)
- If chat/generation returns 500, confirm
ML_SERVICE_URLis reachable and the ML service is running. - If you always get 402, verify your user row exists in
app_usersand your tier has credits (TIER_CONFIG). - If auth fails, see
docs/AUTHENTICATION.md.