Templates / Run a margin-aware paid AI agent with Alephant x402 and Discord

Run a margin-aware paid AI agent with Alephant x402 and Discord

Unknown

by alephantAI ✓ · 24 views · created 2026-06-11 · CRM, AI Chatbot

Unknown. This template uses community nodes we can't verify statically. Uses community nodes that can't be verified statically (unverified community packages are off by default in 3.0). Static check, last run 2026-10-19.

What this workflow does

This AI workflow has 15 nodes and runs when an HTTP POST request hits its webhook URL. Along the way it connects OpenAI Chat Model, Discord, Alephant Analytics (community) and Alephant (community) and 1 more. It also calls ai.alephant.io over HTTP.

How it runs

Trigger: When an HTTP POST request hits its webhook URL.

  1. Budget Guard (deterministic) (Alephant Usage): budget status
  2. Budget OK? (If): checks a condition and branches into true / false
  3. AI Agent: runs an AI agent, with model: Agent Brain (routed through Alephant); 1 tool (UsageSummary analytics in Alephant); memory: Run Memory
  4. Respond (Respond to Webhook): sends the response back to the webhook caller
  5. Parse Decision (Code): runs custom JavaScript code
  6. Run Chosen Model (Cost Control) (Alephant Ai): uses Alephant Ai
  7. Per-Call P&L (Code): runs custom JavaScript code
  8. Respond to Buyer (Respond to Webhook): sends the response back to the webhook caller
  9. Margin Thin? (If): checks a condition and branches into true / false
  10. Margin Feed (Discord) (Discord): uses Discord

…plus 1 more step. See the full node list below.

Services it uses

OpenAI Chat ModelDiscordAlephant Analytics (community)Alephant (community)Alephant Ai (community)

HTTP calls to: ai.alephant.io

Before you upgrade to n8n 3.0

We can't fully verify this one: it relies on 3 community packages, and n8n 3.0 turns unverified community packages off by default (N8N_UNVERIFIED_PACKAGES_ENABLED=false).

  • Check that @alephantai/n8n-nodes-alephant-analytics is verified or supports 3.0 (used in Budget Guard (deterministic)).
  • Check that @alephantai/n8n-nodes-alephant is verified or supports 3.0 (used in UsageSummary analytics in Alephant).
  • Check that @alephantai/n8n-nodes-alephant-ai is verified or supports 3.0 (used in Run Chosen Model (Cost Control)).

Nodes used (12)

From the author

Quick overview This workflow exposes a paid webhook endpoint, verifies budget via Alephant usage analytics, routes the request through an OpenAI-based agent to pick the most cost-effective model, runs the chosen model through Alephant for cost tracking, then…

Excerpt from alephantAI's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.