Cover image for project: NEXUS IA Control IN PROGRESS

Technical summary

NEXUS plugin for centralized management of accounts, credentials, tokens and authentication for AI providers, with usage monitoring (CHEIA/FINAL/ESGOTADA), automatic monthly cycle refresh, email and browser alerts and MCP sync with smart account switching in the IDE.

Executed scope

  • plugin.json: v1.0.0, slug nexus-ia-control (no legacy_slugs), name "NEXUS IA Control", "Integrations" category, is_core: false, public author_url and website (perciocastelo.com.br).
  • Schema: preexisting MySQL table ai_accounts (the plugin creates no DDL — requires the core schema with id, email, provider, plan_type, ai_type, token_limit, token_used, status, refresh_date, special_notes, last_notified, last_notified_browser, origin, is_active, updated_at).
  • Plugin (plugin.php): "Controle de IA" tab (brain-circuit icon), "Controle de IAs" doc (cpu icon), 3 modals (ia-account, ia-engines, ia-chat-test), assets/ia-control-v2.js JS and 10 actions (ia_list, ia_save, ia_delete, ia_alerts, ia_accounts_list, ia_accounts_save, ia_accounts_delete, ia_sync_account, ia_engines_list, ia_engines_save).
  • Dashboard (ia_accounts_counts) — total, used_tokens, total_limit, status counts (cheia/final/esgotada) and energy_percent (rounded via Math_round helper).
  • CRUD (ia_account_save) — UPSERT by id (UPDATE) or INSERT + lastInsertId: email, provider, plan_type, ai_type, token_limit, token_used, status, refresh_date, special_notes.
  • Automatic +1 day refresh (ia_check_refresh_alerts) — accounts with refresh_date <= today and last_notified != refresh_date are reset (token_used = 0, status = CHEIA, next cycle = same day next month) firing styled HTML email (violet #7c3aed theme, "CHEIA (Resetado)" badge, next refresh and "Abrir Controle de IA →" CTA with SITE_URL).
  • Browser alerts (ia_check_browser_alerts) — renewable accounts returned for native browser notification via silent polling (ia_alerts action).
  • MCP sync (ia_account_sync) — email-based upsert with origin='mcp', is_active=1 and note "[Sincronizada automaticamente via MCP Server]"; new accounts get refresh_date +30 days; existing accounts preserve protected statuses (CHEIA/ESGOTADA/FINAL — MCP always sends 'ATIVO' from the provider API, but NEXUS keeps the manual state) and smart account switch: automatically deactivates other MCP accounts (is_active = 0), detecting IDE account switching.
  • No cron — cronjob.json v1 with jobs: [] and note "Plugin sob demanda; nenhuma rotina periódica segura ou necessária." (refresh is triggered by polling/usage).
  • Fastr — /ia-control command (arg_required: false, pass_task_id: false) running the ia_list action (AI accounts summary).
  • UI (tab.php, 241 lines, violet #7c3aed + slate theme) — Stats Grid v4.1 with 6 clickable/filterable high-density cards (Total violet/users, Usados pink/zap, CHEIA emerald/battery-low, FINAL amber/alert-circle, ESGOTADA rose/battery-warning, Eficiência indigo/activity) with animated progress line and active-filter overlay; Ultra-Rounded toolbar (rounded-[2.5rem], Glassmorphism backdrop-blur-xl) with violet-600 "Nova Conta", Provider/IA/Show (10/50/100/all) filters and search; premium table (Provider Email, Type/Intelligence, Token Usage with semantic bar — emerald <70%, amber 70–90%, rose >90% or terminal status —, State badges, Origin with pulsing emerald "ATIVA NA IDE" badge for active MCP, Cycle End with relative dates "Hoje"/"em X dias" and "(NOTIFICAÇÃO +1 DIA)" note, Manage with edit/delete); contextual empty state (onboarding "Comece agora!" vs filters "Ambiente Silencioso"); icons via Lucide sprite (icons.svg#) with lucide.createIcons() watchers on AJAX mutations.
  • Modals — ia-account (unified CRUD "Gerenciar IA"/"Nova IA" with "Configurar provedores" link), ia-engines (custom AI engines — name, lucide icon, delete/add; persisted in the ai_engines setting), ia-chat-test (chat test with currentChatURL, test message and "Refinar Prompt (IA Magic)").
  • i18n via $t('ia.*')/__() keys with PT fallbacks.
  • No install.sql and no migrations in the plugin.

Stack and tools

  • PHP 8 (no framework)
  • MySQL 8 (preexisting ai_accounts)
  • Alpine.js + Tailwind CSS (premium light, violet/slate) + Lucide (sprite)
  • MCP Server (automatic account sync)
  • NEXUS plugin system (PluginManager: tabs, docs, modals, API actions, Fastr)

Operational tags

  • Inteligência Artificial
  • Tokens
  • Credenciais
  • MCP
  • Autenticação
  • Gestão de Contas
  • Alertas
  • Plugin NEXUS

Operational result

  • Centralized view: all AI accounts (Google, OpenAI, Anthropic etc.) in one panel with aggregated and per-account usage.
  • Usage posture: CHEIA/FINAL/ESGOTADA status with semantic bars (<70% green, 70–90% amber, >90% rose) and aggregated efficiency %.
  • Automatic renewal: monthly cycle reset at maturity with styled HTML confirmation email and native browser notification (+1 day).
  • MCP sync: accounts auto-detected and synced by the IDE; IDE account switching is detected (smart account switch).
  • Manual state preserved: manually marked CHEIA/ESGOTADA/FINAL accounts are not overwritten by the provider API.
  • Zero periodic routines: on-demand plugin (cronjob.json with empty jobs).
  • /ia-control chat command (accounts summary).

GitHub progress (issues)

Real-time panel with latest repository issues.

abertas (amostra): -- fechadas (amostra): -- base: -- ultimas issues

carregando andamento...

Real results

Centralized management hub for accounts, API keys, and quotas across multiple AI providers. Enables real-time model switching, automated limit renewal tracking, and IDE agent health monitoring.

Architecture and organization

Execution and operations

The project follows reproducible execution flow with technical validation in production-like environments.

Screenshots

Talk about this project

Apply this implementation pattern in your environment and accelerate delivery with technical consistency.