n8n Nodes
Alephant provides two n8n community node packages for workflow automation:
Install both packages when you want a workflow to make an AI request and then inspect its usage or request-log details. Both nodes use the same Alephant Virtual Key credential.
Installation
In n8n:
- Go to Settings > Community nodes.
- Select Install.
- Install
@alephantai/n8n-nodes-alephant-ai. - Install
@alephantai/n8n-nodes-alephant-analytics. - Restart n8n if your deployment requires a restart after community node installation.
For self-hosted n8n deployments, make sure community packages are enabled:
If your deployment installs community packages with npm, install both packages:
Credential
Both packages register and use the Alephant Virtual Key credential.
Create a Virtual Key in Alephant before configuring n8n:
- Open the Alephant dashboard and sign in to your workspace.
- Add an upstream provider API key as a Master Key.
- Create an Agent for the n8n workflow or application that will send AI traffic.
- Copy the Agent’s Virtual Key.
- In n8n, create a new Alephant Virtual Key credential and paste the key into Virtual Key.
Keep the default base URLs for production. Override them only for staging, local, self-hosted, or dedicated Alephant deployments.
The credential test calls the Alephant Gateway /models endpoint with your Virtual Key. A successful test means n8n can authenticate to the gateway.
Alephant Cost Control
The Alephant Cost Control node is provided by @alephantai/n8n-nodes-alephant-ai.
It sends POST /chat/completions requests through Alephant. The request can use an OpenAI-compatible shape, but Alephant’s role is broader than proxying the model call: it handles Virtual Key authentication, routing, budget enforcement, usage logging, and request attribution for the workflow or agent run.
Operation
Parameters
Prompt Example
Messages JSON Example
Output
The node returns a normalized object with the raw provider response and convenient top-level fields:
requestId and requestLogId are generated by the node and sent to Alephant Gateway as x-request-id. Pass requestLogId into Alephant AI Analytics to look up the matching request log.
Alephant AI Analytics
The Alephant AI Analytics node is provided by @alephantai/n8n-nodes-alephant-analytics.
It reads Virtual Key-scoped usage and request-log data from Alephant. The node is also marked as usable as an n8n tool, so agent workflows can call it when they need usage or request context.
Operations
Period supports 24 Hours, 7 Days, 30 Days, and 90 Days.
Request Log Detail
Use Request Log Detail after an AI request when you need request-level cost, latency, token, model, or provider data.
The default Request Log ID expression is:
Workspace ID is resolved in this order:
- The node’s Workspace ID parameter.
- The incoming item’s
workspaceId,workspace_id, orxWorkspaceId. - The Workspace ID saved in the Alephant Virtual Key credential.
- The Alephant Scope API.
If none of those sources returns a workspace ID, the node errors because the Analytics request-log endpoint needs workspace scope. Add a Wait node before request-log detail lookups if your workflow queries immediately after an AI request and log ingestion has not completed yet.
Example Workflow Templates
Use these workflow JSON files to try the nodes quickly after installing both packages. Each template can be imported into n8n and then configured with your own Alephant Virtual Key credential.
Alephant Cost Control + AI Analytics Examples
This template is the quickest way to confirm that the installed community nodes can connect to Alephant. It starts from a manual trigger and runs two independent Alephant nodes:
- Alephant Cost Control - Chat Completion: sends a sample prompt to Alephant Gateway with
gpt-4o-mini. - Alephant AI Analytics - 7 Day Summary: reads recent Virtual Key usage data for the last 7 days.
Alephant Cost Control Request Cost Tracking
This template demonstrates how to connect an AI request to its matching Alephant request log and extract cost information after the request completes. The workflow runs in this order:
- Build AI Request creates a prompt and model payload.
- Alephant Cost Control - Chat Completion sends the request through Alephant Gateway.
- Wait for Request Log pauses briefly so the gateway request log can be written.
- Alephant AI Analytics - Request Log Detail fetches the matching request log by
requestLogIdorrequestId. - Summarize Cost returns a compact object with the request log ID, model, prompt, response text, token usage, cost, currency, and raw request log.
Use this template when you want to build budget-aware workflows, cost dashboards, approval flows, or alerts around individual AI requests. Select the same Alephant Virtual Key credential on both Alephant nodes. If the workflow does not receive a workspace ID from the prior node, the analytics node resolves workspace scope from the configured credential or the Scope API.
To use a template in n8n:
- Install
@alephantai/n8n-nodes-alephant-ai. - Install
@alephantai/n8n-nodes-alephant-analytics. - Import the workflow JSON file into n8n.
- Open each Alephant node and choose the required Alephant Virtual Key credential.
- Run the workflow with Test workflow or execute the nodes one at a time.
Typical Workflows
- Route AI tasks through Alephant Gateway from n8n with the Alephant Cost Control node.
- Run Alephant AI Analytics before expensive workflow branches to inspect recent spend or budget status.
- Join an AI node’s
requestLogIdwith Request Log Detail to create cost-aware notifications, audit trails, approval flows, or dashboards.