Documentation

@ascerta/n8n-nodes-ascerta

n8n community node for Ascerta — add cost tracking, budget enforcement, and usage attribution to every LLM call in your n8n workflows.

What is Ascerta?

Ascerta is an AI cost management platform. It sits as a transparent proxy between your application and LLM providers (OpenAI, Anthropic, Azure OpenAI, AWS Bedrock, Databricks, and more), giving you:

  • Real-time cost visibility — See the dollar cost of every LLM request as it happens, broken down by input/output tokens
  • Budget enforcement — Set hard spending limits per user, team, use case, or workflow so costs never run away
  • Usage attribution — Know exactly who and what is driving your AI spend with per-user and per-use-case tracking
  • Zero code changes — Ascerta is a drop-in proxy. Your prompts, models, and provider API keys stay the same. Just route through Ascerta and you're tracked.

Learn more at ascerta.com or read the Ascerta documentation.

Nodes

This package provides provider-specific chat model nodes and a generic proxy node:

Chat Model Nodes (LangChain-compatible)

These nodes plug directly into n8n's AI Agent node as a chat model input. Each uses the provider's native n8n credential type — no need to re-enter API keys.

Node Provider Credential Docs
Ascerta OpenAI (Proxy) OpenAI openAiApi docs/providers/openai.md
Ascerta Anthropic (Proxy) Anthropic anthropicApi docs/providers/anthropic.md
Ascerta Azure AI Foundry (Proxy) Azure OpenAI azureOpenAiApi docs/providers/azure.md
Ascerta Amazon Bedrock (Proxy) AWS Bedrock aws docs/providers/bedrock.md
Ascerta Databricks (Proxy) Databricks ascertaDatabricksApi docs/providers/databricks.md

Generic Proxy Node

Node Description
Ascerta Proxy Direct HTTP proxy for any supported provider. Full control over the request body, provider, and model. Supports OpenAI, Anthropic, Azure OpenAI, AWS Bedrock, and Databricks.

Installation

Community Node (Recommended)

  1. In your n8n instance, go to Settings > Community Nodes
  2. Select Install a community node
  3. Enter @ascerta/n8n-nodes-ascerta
  4. Agree to the risks and click Install

Manual Installation

cd ~/.n8n/nodes
npm install @ascerta/n8n-nodes-ascerta

Restart n8n after installing.

AI Agent usage: To use the Ascerta Chat Model nodes with n8n's AI Agent node, start n8n with N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true.

Prerequisites

  • An Ascerta account and API key
  • An API key or credential for at least one supported LLM provider

Setup

Self-hosted deployment? For detailed instructions including Docker installation, dedicated Ascerta instance configuration, and troubleshooting, see the Deployment & Configuration Guide.

1. Configure Ascerta Credentials

When you first add an Ascerta node to a workflow, n8n will prompt you to configure credentials:

  • API Key — Your Ascerta API key (found in the Ascerta dashboard)
  • Base URL — Enter your dedicated Ascerta instance URL, such as https://api.yourcompany.ascerta.com.

2. Configure Provider Credentials

Each chat model node uses the provider's native n8n credential type. If you already have credentials configured for the native provider nodes (OpenAI, Anthropic, Azure, etc.), you can reuse them directly — no duplicate credential setup needed.

3. Add the Node to Your Workflow

For AI Agent workflows:

  1. Add a Chat Trigger or Manual Chat Trigger node
  2. Add an AI Agent node
  3. Add the appropriate Ascerta [Provider] (Proxy) node and connect it to the AI Agent's "Chat Model" input
  4. Configure the model parameters (model ID, endpoint name, etc.)

Tracking Headers

Ascerta uses custom HTTP headers to associate requests with users, Use Cases, and Limits. All tracking fields are optional and have smart defaults.

Field Default Description
xProxy-User-ID (empty) User identifier for per-user cost attribution
xProxy-UseCase-Name Workflow name Use Case Name for tracking and KPI scoring
xProxy-UseCase-ID {nodeId} (UUID) Stable per-node ID — all runs of one canvas node aggregate under one use case
xProxy-UseCase-Step Node display name (e.g. Ascerta Databricks (Proxy)) Step within a multi-step workflow — override with a custom label when useful

Advanced Tracking (collapsed in UI)

These fields are available under the "Advanced Tracking" section and should typically only be modified with guidance from Ascerta Support:

Field Description
xProxy-UseCase-Version Version of the use case definition
xProxy-UseCase-Properties JSON object of key-value properties
xProxy-Limit-IDs Comma-separated list of Ascerta Limit IDs to enforce
Debug Logging Logs request URLs, headers, and routing details to the n8n server console

Supported Proxy Paths

All requests are routed through: {ASCERTA_BASE_URL}/api/v1/proxy/{provider_path}

Provider Proxy Path
OpenAI openai/v1/chat/completions
Anthropic anthropic/v1/messages
Azure OpenAI azure.openai/openai/deployments/{name}/chat/completions
AWS Bedrock aws.bedrock/{region}/model/{modelId}/converse
Databricks openai/v1/chat/completions (reuses OpenAI path with xProxy-Provider-BaseUri)

Migrating Existing Workflows

Already have n8n workflows calling OpenAI, Anthropic, Databricks, or other LLM providers natively? The ascerta-utilities n8n-toolkit can scan your n8n instance, find native LLM nodes, and replace them with Ascerta equivalents — rewiring all connections and credentials automatically.

export N8N_BASE_URL=http://localhost:5678
export N8N_API_KEY=your-n8n-api-key
export ASCERTA_BASE_URL=https://api.yourcompany.ascerta.com
export ASCERTA_API_KEY=your-ascerta-api-key

python3 migrate-workflows-to-ascerta.py --dry-run   # preview changes
python3 migrate-workflows-to-ascerta.py              # run migration

Development

npm install       # Install dependencies
npm run build     # Clean, compile TypeScript, copy icons
npm run dev       # TypeScript watch mode
npm run lint      # ESLint (TypeScript rules)
npm run lint:fix  # ESLint with auto-fix
npm run format    # Prettier

Local Testing

npm pack
cd ~/.n8n/nodes && npm install /path/to/ascerta-n8n-nodes-ascerta-*.tgz
rm -rf ~/.n8n/.cache   # Clear n8n cache after updates
# Restart n8n

Support

License

MIT

Discussion