Home / Learn / Connecting Claude to n8n
Connecting Claude to n8n — n8n Guide

Connecting Claude to n8n

n8n's Anthropic node exposes a Base URL field, which is all you need to route its Claude calls through AI Prime Tech. From there Claude feeds AI Agent and LLM Chain nodes, so your automations reason with Claude while billing flows through one gateway.

Build the Anthropic credential

Create an Anthropic credential in n8n. The API Key field is sent as the x-api-key header; the Base URL field points at the gateway. Attach the credential to an Anthropic Chat Model node feeding an AI Agent or Basic LLM Chain.

Enter the Base URL as the host root only — n8n appends /v1/messages for chat and /v1/models for the credential test. Do not add /v1 yourself or you get a doubled /v1/v1 path.

The '/v1/models' credential trap

The single most common 'n8n Claude API key not working' report is not a bad key. When you save the credential, n8n runs a test that calls GET {BaseURL}/v1/models with an anthropic-version header. A gateway that doesn't implement /v1/models fails that test even though chat works.

AI Prime Tech implements /v1/models, so the credential saves cleanly. If you ever front a gateway that lacks it, the chat node still works once saved — the failure is only the test.

Auth header mismatches

n8n's Anthropic node authenticates with x-api-key, not Authorization: Bearer. A gateway expecting Bearer returns 401 and looks like a wrong key. Use the credential's Add Custom Header toggle to send Bearer if needed.

Watch trailing slashes on the Base URL too — a stray slash produces a //v1/messages path error.

Why automations love a gateway

n8n workflows fire on schedules, webhooks, and triggers, unattended around the clock. A single hourly summarizer or per-ticket classifier accumulates a steady stream of Claude calls with no human watching the meter.

Routing that through AI Prime Tech gives you one balance, one set of logs, and the option to switch models per workflow without re-crendentialing every node.

# n8n -> Credentials -> Anthropic
# API Key:  <your gateway key>
# Base URL: https://aiprimetech.io        (host root, NO /v1)
# Attach to: Anthropic Chat Model -> AI Agent node
# If gateway needs Bearer: 'Add Custom Header'
#   Authorization: Bearer <key>

Frequently asked questions

How do I connect Claude to n8n?
Create an Anthropic credential, set the Base URL to the gateway host root (no /v1), paste your key, and attach it to the Anthropic Chat Model node.
Why does n8n say my Claude key isn't working?
Its credential test calls /v1/models; a gateway without that endpoint fails the test even though chat works. AI Prime Tech implements it, so the credential saves.
Bearer or x-api-key?
n8n's Anthropic node sends x-api-key. If the gateway needs Bearer, use Add Custom Header.
Should the Base URL include /v1?
No — host root only. n8n appends the paths itself.
Start using Claude in minutes

Get an API key — no Anthropic account or waitlist required.

Get your API key

AI Prime Tech is an independent API gateway. It is not affiliated with, endorsed by, or a reseller of Anthropic. Claude and related model names are trademarks of their respective owners.

More Claude API guides

How to Get a Claude API KeyClaude API Pricing, ExplainedThe Cheapest Way to Use the Claude APIUnlimited Cursor with the Claude APIUnlimited Claude Code AccessClaude API Gateway vs. Anthropic DirectUsing Claude Through an OpenAI-Compatible APIClaude Models ComparedPaying for the Claude API with CryptoClaude API Access Without a WaitlistHow to Reduce Claude Token UsageUnlimited Cline with the Claude APIUnlimited Roo Code with the Claude APIUnlimited Claude in JetBrains IDEsUnlimited Aider with the Claude APIUnlimited Claude in VS CodeUnlimited OpenCode with the Claude APIRunning an Unlimited Hermes Agent on ClaudeRunning Unlimited OpenClaw on ClaudeWhat an Anthropic-Compatible API MeansClaude Code API Key — How to Get and Set UpClaude Code API Costs — Pricing and How to Cut ThemClaude API Errors — Rate Limits, 400, 500, 529 FixesHow to Buy Claude API CreditsClaude API Free Trial — Get $5 Free CreditClaude API vs Claude Pro/Max Subscription — Which to ChooseRunning the Codex CLI on ClaudeRouting LiteLLM to ClaudeUsing Claude in Kilo CodeBring Claude into GitHub CopilotWire Zed to Claude Through the GatewayConnect Cherry Studio to ClaudePoint LangChain at Claude on the GatewayRun Factory Droid on ClaudeThe Claude Code API, ExplainedIntegrating the Claude API Into Your Application