Run a margin-aware paid AI agent with Alephant x402 and Discord
UnknownWhat 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.
- Budget Guard (deterministic) (Alephant Usage): budget status
- Budget OK? (If): checks a condition and branches into true / false
- AI Agent: runs an AI agent, with model: Agent Brain (routed through Alephant); 1 tool (UsageSummary analytics in Alephant); memory: Run Memory
- Respond (Respond to Webhook): sends the response back to the webhook caller
- Parse Decision (Code): runs custom JavaScript code
- Run Chosen Model (Cost Control) (Alephant Ai): uses Alephant Ai
- Per-Call P&L (Code): runs custom JavaScript code
- Respond to Buyer (Respond to Webhook): sends the response back to the webhook caller
- Margin Thin? (If): checks a condition and branches into true / false
- Margin Feed (Discord) (Discord): uses Discord
…plus 1 more step. See the full node list below.
Services it uses
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)
- Webhook
n8n-nodes-base.webhook - Alephant Usage
@alephantai/n8n-nodes-alephant-analytics.alephantUsage - If
n8n-nodes-base.if - Respond to Webhook
n8n-nodes-base.respondToWebhook - AI Agent
@n8n/n8n-nodes-langchain.agent - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Alephant Tool
@alephantai/n8n-nodes-alephant.alephantTool - Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow - Code
n8n-nodes-base.code - Alephant Ai
@alephantai/n8n-nodes-alephant-ai.alephantAi - HTTP Request
n8n-nodes-base.httpRequest - Discord
n8n-nodes-base.discord
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…