M09

AI Models, Prompts, Agents, Avatars

Multi-provider LLM routing, prompt versioning, agent orchestration, and HeyGen AI avatar video production.

Centralized AI operations layer: multi-provider LLM routing across 6 vendors (OpenAI, Gemini, Cloudflare AI, RunPod, Together AI, OpenRouter) with real-time utilization percentage assignment per use case, 3-step fallback chains, prompt versioning with history restore, dynamic prompt execution, AI agent lifecycle management, and direct HeyGen integration for AI avatar video creation with scene and camera-angle configuration.

AIPromptStudio.jsxtsx
import { useState } from 'react';
import { AiWidget, AiInput, AiTextarea, CardIcon } from '@cleen/cleen-components';
import { useAgentChain, usePrompts } from '@/hooks/useAi';

export function AIPromptStudio({ agentChainId }) {
  const { chain, steps, runStep } = useAgentChain(agentChainId);
  const { prompts } = usePrompts();
  const [input, setInput] = useState('');

  return (
    <div className="ai-studio">
      <h1>{chain?.name}</h1>
      <div className="ai-prompt-grid">
        {prompts.map((p) => (
          <CardIcon key={p.id} icon={p.icon} title={p.name} description={p.summary} />
        ))}
      </div>
      <AiWidget chain={chain} steps={steps} />
      <AiTextarea
        value={input}
        onChange={setInput}
        onSubmit={() => runStep({ stepId: chain.firstStepId, payload: input })}
      />
    </div>
  );
}

Capabilities

  • Multi-provider LLM routing across 6 vendors with real-time utilization percentage control
  • 3-step provider fallback chain — automatic failover on model unavailability
  • AI model type and platform configuration via DB-driven registry
  • Prompt save/filter/delete with full version history and one-click restore
  • Dynamic prompt runtime execution with variable injection
  • Call-history outcomes tracking per prompt and model
  • AI agent filter/save/detail/delete with execution diagnostics
  • HeyGen AI avatar video creation (direct API integration)
  • Scene creation with multiple camera angles per avatar collection

Benefits

  • Controls AI spend with percentage-based utilization allocation
  • Eliminates vendor lock-in across 6 LLM providers
  • Enables safe prompt experimentation without redeployment
  • Adds AI video capability without building HeyGen infrastructure

Flow of work

  1. 01Configure models and platform
  2. 02Allocate utilization % by use case
  3. 03Author and version prompts
  4. 04Execute and track outcomes
  5. 05Manage agents
  6. 06Create HeyGen avatars and scenes
  7. 07Generate AI video

Subfeatures

  • Model type filter/save
  • Platform filter/save
  • Utilization % save/assignment
  • Provider fallback config
  • Prompt CRUD
  • Prompt version history
  • Prompt restore
  • Dynamic prompt run
  • Outcome tracking
  • Agent CRUD
  • Execution diagnostics
  • Avatar CRUD
  • Avatar video create/sync
  • Scene save/config
  • Camera angle CRUD
Source surfaces (technical reference)

Internal code areas in the licensed Full-Stack codebase that back this module.

  • ApiAI model/platform/utilization endpoints
  • ApiAI prompt and version endpoints
  • ApiAI agent endpoints
  • ApiAI HeyGen avatar and scene endpoints
  • cleenLLM — vendor-agnostic LLM abstraction library (background services)
In the stack

Where it lives. What it exposes.

A quick visual of how AI Models, Prompts, Agents, Avatars participates across the CleenUI stack, alongside the named operations it adds to the API surface.

M09 · architecture
Frontend
React · TailwindCSS · 60+ components
Prompt editorModel configUtilization dashboardAgent panelAvatar galleryScene builderVideo preview
API
C# Web API · production-ready · role-aware
Model CRUDPlatform configUtilization rulesPrompt runAgent CRUDAvatar CRUDScene CRUD
Database
AzureSQL · 300+ tables · 700+ procedures
AIModelsAIProvidersUtilizationRulesPromptsPromptVersionsAgentsAvatarsAvatarScenesCameraAngles
Async Services and Batch Jobs
WebJobs & Functions · queue-backed
cleenLLM router (6 providers)3-step fallback chainPrompt executorHeyGen API clientAvatar video dispatcher
All four layers ship together as the Full-Stack license. M09 blocks are highlighted.
API operations

Named operations on this surface

15
Try these in Postman
  • POSTModel type filter/save/ai/model-type-filter-save
  • POSTPlatform filter/save/ai/platform-filter-save
  • POSTUtilization % save/assignment/ai/utilization-save-assignment
  • POSTProvider fallback config/ai/provider-fallback-config
  • POSTPrompt CRUD/ai/prompt-crud
  • POSTPrompt version history/ai/prompt-version-history
  • POSTPrompt restore/ai/prompt-restore
  • POSTDynamic prompt run/ai/dynamic-prompt-run
  • POSTOutcome tracking/ai/outcome-tracking
  • POSTAgent CRUD/ai/agent-crud
  • POSTExecution diagnostics/ai/execution-diagnostics
  • POSTAvatar CRUD/ai/avatar-crud
  • POSTAvatar video create/sync/ai/avatar-video-create-sync
  • POSTScene save/config/ai/scene-save-config
  • POSTCamera angle CRUD/ai/camera-angle-crud

Each operation maps to an endpoint in the licensed C# Web API surface.