Introducing Alephant n8n Nodes: AI Gateway Cost Control, Usage Analytics, and Agent Tools
If you’ve been building AI agents in n8n, you’ve probably hit this failure mode: a workflow runs fine for weeks, then one bad prompt template or a runaway tool-call loop turns into a five-figure surprise on next month’s provider invoice and there’s no way to tell which workflow, which agent, or which session burned the spend.
We built Alephant to close that gap, and we recently shipped community nodes that bring the same cost control and observability directly into n8n.
What we shipped
Three nodes, one shared credential (Alephant Virtual Key):
| Node | Package | Purpose |
|---|---|---|
| Alephant Cost Control | @alephantai/n8n-nodes-alephant-ai |
Send OpenAI-compatible chat completions through Alephant AI Gateway as a normal workflow step. Full cost attribution per workflow, agent, session, and member. |
| Alephant AI Analytics | @alephantai/n8n-nodes-alephant-analytics |
Read-only: query usage, cost, budget status, daily breakdowns, request logs, and scope-level data. |
| Alephant AI Analytics Tool | (auto-dropped) | Same operations as Analytics, surfaced as a Tool for AI Agent nodes — agents can answer questions about their own spend. |
The gateway behind these nodes is open source under GPL v3 (github.com/AlephantAI/Alephant-AI-Gateway). Your credential can point at Alephant Cloud or your own self-hosted instance — the nodes work the same either way.
The Virtual Key is BYO-Key on every plan: you bring your own provider keys (OpenAI, Anthropic, Gemini, Bedrock, Groq, DeepSeek, xAI, OpenRouter, and 40+ others), and the provider bills you directly. Alephant adds the cost attribution, routing, caching, and policy layer on top — it never holds your provider keys.
Quick setup

- Open the node picker in any workflow and search
alephant— both nodes are verified on the n8n community registry, so no manual package install is needed. - Create an
Alephant Virtual Keycredential. From the Alephant dashboard: workspace → Agent → copy Virtual Key → paste into n8n. - Drop the nodes into your workflow.
Prefer manual install? Settings → Community nodes → Install → paste either package name.
Featured workflow: Cost-Aware AI Agent + Daily Spend Alert
One workflow, two entry points. Demonstrates the Tool node, the standalone Analytics node, an IF threshold check, and a notification step.
Branch A — self-service spend agent. A chat-triggered AI Agent uses an OpenAI-compatible chat model and the Alephant AI Analytics Tool as a function call. Users chat normally, and when they ask “what did we spend on gpt-4o this week?” or “how close are we to budget?”, the agent calls the Analytics tool and answers with real numbers. The agent reports on its own cost without any custom code.
Branch B — daily spend guardrail. A schedule trigger runs every morning, fetches yesterday’s cost breakdown via the Alephant AI Analytics node, and pipes it into an IF node. If yesterday’s total clears the configured threshold, a Slack notification fires with the breakdown attached. If not, the branch exits cleanly.
On import: n8n will prompt you to re-attach credentials at the three REPLACE_WITH_YOUR_* markers — Alephant Virtual Key (used by both Analytics nodes), the OpenAI-compatible credential for the chat model, and Slack. Set the Slack channel ID and adjust the cost threshold to match your setup.
What else these nodes are good for
- Alephant Cost Control as a regular workflow step. Drop it anywhere a chat completion would make sense — content classification, extraction, summarization — and get the same cost attribution as your agent traffic, in the same dashboard.
- Pre-flight budget circuit breakers. Run Budget Status before an expensive AI step, and use IF to fall back to a cheaper model (or stop the workflow entirely) when you’re over a configured spend.
- Request-log inspection. When something looks off in production, the Request Log Detail operation pulls full request-level data for any
requestLogId— useful as a downstream step in incident workflows. - Multi-tool agents that act and report. Stack the Alephant Analytics Tool with your other agent tools (calendar, Notion, Postgres, whatever), so the agent can both do work and tell you what it cost.
Links
- Docs / quickstart: Quickstart Guide | Alephant Documentation
- Cost Control node on npm: https://www.npmjs.com/package/@alephantai/n8n-nodes-alephant-ai
- AI Analytics node on npm: https://www.npmjs.com/package/@alephantai/n8n-nodes-alephant-analytics
- Gateway repo: https://github.com/AlephantAI/Alephant-AI-Gateway
- Discord: Alephant AI
— The Alephant team. Questions or feedback welcome in this thread or in our Discord.
