How to Add ATXP to n8n
n8n is one of the most widely used platforms for building agent workflows — and like most workflow automation tools, it has no native concept of a spending budget. Your API keys sit in credential storage and get used without limits until you notice the bill.
ATXP fixes that. This is how to wire it up.
What This Integration Does
When you add ATXP to an n8n workflow:
- Each workflow (or set of workflows) gets its own agent account with a real credit balance
- You set a spending limit — the workflow can’t exceed it
- Every API call generates a receipt you can inspect
- Your primary API keys stay out of the workflow entirely
The pattern is: fund an ATXP agent account → use that account’s credentials in your HTTP Request nodes → inspect spend via ATXP dashboard.
Prerequisites
- An ATXP account (atxp.ai)
- n8n (Cloud or self-hosted)
- A workflow that makes paid API calls
Step 1: Create an Agent Account
In ATXP, an “agent account” is an isolated identity with its own credit balance. Create one per workflow or per workflow category — the granularity is up to you.
curl -X POST https://api.atxp.ai/v1/agents \
-H "Authorization: Bearer $ATXP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "n8n-research-workflow",
"budget": 5.00,
"currency": "usd"
}'
This returns an agent ID and an agent API key. The agent key is what your n8n workflow will use — not your primary ATXP key.
Step 2: Store the Agent Key in n8n Credentials
In n8n:
- Go to Settings → Credentials → Add New
- Select Header Auth
- Name it something like
ATXP Agent — Research Workflow - Header name:
Authorization, Value:Bearer [your-agent-key]
Step 3: Route API Calls Through ATXP
For each paid API call in your workflow, use the HTTP Request node with your ATXP agent credentials. ATXP supports pass-through routing for common APIs — you call the ATXP endpoint instead of the API directly.
For LLM calls (OpenAI, Anthropic, etc.):
POST https://api.atxp.ai/v1/proxy/openai/chat/completions
Authorization: Bearer [agent-key]
The request body is identical to the native API. ATXP proxies the call, records the cost, and deducts from the agent’s balance.
For arbitrary APIs, wrap the call using ATXP’s execution endpoint:
POST https://api.atxp.ai/v1/execute
Authorization: Bearer [agent-key]
{
"service": "openai",
"method": "chat.completions.create",
"params": { ... }
}
Step 4: Add Budget Enforcement Logic (Optional)
ATXP will stop calls when the agent balance hits zero. If you want n8n to handle this gracefully — instead of getting a rejected call mid-workflow — add a balance check at the start of your workflow:
GET https://api.atxp.ai/v1/agents/{agent-id}/balance
Authorization: Bearer [your-primary-ATXP-key]
Use an IF node to check the balance and route to an error handler if it’s below a threshold.
Step 5: Inspect Spend
After any workflow run, check what it spent:
curl https://api.atxp.ai/v1/agents/{agent-id}/transactions \
-H "Authorization: Bearer $ATXP_API_KEY"
Returns a log of every call: timestamp, service, cost, and status.
Common n8n + ATXP Patterns
Research workflow with bounded LLM spend: One ATXP agent account per research job. Fund it with $2. Workflow researches the topic, synthesizes a report. When the $2 is gone, it stops — no surprise bills.
Content generation pipeline: Fund an agent with credits for a batch run. Pipeline generates content until budget exhausted. Refill to run again. Cost per piece of content becomes predictable.
Data enrichment at scale: Each enrichment job (e.g., “enrich 500 contacts”) gets its own agent account. Cost-per-record is auditable. You can compare cost across different enrichment workflows.
Multi-workflow agent system: A parent workflow creates and funds child agent accounts for subworkflows, then collects spending reports. See how to build a multi-agent system for the broader pattern.
Why This Matters
n8n makes it easy to build powerful workflows. It does not make it easy to control what those workflows cost or what they have access to. Shared credentials mean a misconfigured workflow can use unlimited resources. No spending records means no debugging cost spikes.
ATXP gives each workflow a clean identity, a hard budget, and an audit trail — the three things you need to run production agent workflows with confidence.
Get started with ATXP — agent accounts, spending limits, and audit logs in one API.