AI Overview
Sosyabot's AI is provider-agnostic at the gateway layer. Most text generation flows through Qevron, an OpenAI-compatible router; image and video generation talk to direct providers (OpenAI, Stability AI, fal.ai, Runway). Admins control which models users see at Models.
Providers and ENV keys
| Surface | Default provider | Override mechanism | ENV |
|---|---|---|---|
| Text generation (prompts, inline, suggestions, agents) | Qevron gateway | Per-request modelId from active models | QEVRON_API_BASE_URL, QEVRON_API_KEY |
| Image generation | OpenAI (dall-e-3) or Stability (stable-diffusion-xl-1024-v1-0) | Per-request provider field | OPENAI_API_KEY, STABILITY_API_KEY |
| Video generation | fal.ai (fal-ai/veo3/fast) | AI_VIDEO_PROVIDER env or per-request provider field; alternatives: Runway (gen3a_turbo) | FAL_API_KEY, RUNWAY_API_KEY |
Qevron talks to its base URL via /v1/chat/completions with a Bearer header. Per-model API key overrides are stored in the Options table under ai-model-<modelId>_api-key and selected before the global key.
Credits
Every metered AI action debits the workspace's monthly ai_credits counter:
| Action | Cost (credits) |
|---|---|
| Inline text (rewrite / shorten / expand / translate) | 1 |
| Image generation | 5 |
| Video generation | 20 |
| Stored prompts, templates, suggestions, agents | not metered per call |
Plan defaults (from backend/src/scripts/seed-default-plans.ts): Free 50, Pro 1 000, Business 10 000, Enterprise 50 000 — per calendar month, reset on the 1st. See Credits.
Queues
Three BullMQ queues:
ai-generation— synchronous per-call generation (prompts, inline). 3 retry attempts with 2 s exponential backoff.ai-video— async video jobs. 1 attempt, removes completed jobs after 100. Polls the provider every 5 s; total job timeout 10 min.ai-agents— autonomous agent runs. 1 attempt, removes completed after 200.
Frontend surfaces
/app/ai-publishing— prompt library, campaign-style bulk generation./app/ai-contents— saved AI outputs, inline editor./app/ai-agents/<id>— autonomous agent CRUD and run history.