Can't attach Anthropic API to Credentials in n8n

Goodday! I ve just installed n8n via Elestio. I and currently ising vps server (not elestio). When I try to attach attach Anthropic API to Credentials in n8n it doesnt work, as you can see on screenshot below. There are no problems with OpenAI and DeepSeek API. Please help me. I m gonna go insane with this X) Thanks!

1 Like

Hi @Portmone1

First, test if your VPS can reach Anthropic at all. SSH into your server and run:

curl -I https://api.anthropic.com

If that fails or times out, your VPS’s region or IP is blocked by Anthropic. The fix would be routing your n8n traffic through a VPN or moving to a VPS in a supported region.

Second, if curl works fine, this is a known n8n bug. GitHub issues #26381 and #26899 report the exact same error where valid Anthropic keys fail the credential test but work perfectly in an HTTP Request node. No fix yet from n8n’s side.

In that case, skip the credential test warning and try using the key directly in a workflow, it may work despite the red error in the credentials screen.

1 Like

houda’s diagnostics are spot on. if curl works but the credential test still fails, you can skip it and use the key directly in an http request node instead — not 100% sure if that’s still how it works in 2.x but it’s worth a shot. we’ve had luck with that workaround

1 Like

Hi @Portmone1 Welcome!
Have you tried ignoring the error and still try to use the anthropic model node or any node, does they give the same credential error? I would say that you should also try clearing the base URL and then trying that, i think you must be on the latest version of n8n. Let me know if these bring some help.

1 Like

hey! yes I did. chat still dont work… ty anyway!

ty! will try it out and read suggested topics!

The others are right that the credential test has a known bug, but since your chat still fails after skipping it, the problem is upstream. Anthropic restricts API access from certain server IPs and regions. The fact that OpenAI and DeepSeek both work rules out a general networking issue on your VPS.

SSH into your server and run this:


curl https://api.anthropic.com/v1/messages \
  -H "x-api-key: YOUR_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model":"claude-sonnet-4-20250514","max_tokens":10,"messages":[{"role":"user","content":"hi"}]}'
```

If you get a 403 or a timeout, your VPS IP is blocked. The fix is a simple reverse proxy. Put a small Cloudflare Worker or nginx proxy on a US/EU endpoint and point your n8n Anthropic base URL at it. You do not need to move your whole setup.

had this exact issue, the credential test pings claude-3-haiku to validate the key and if your anthropic plan doesnt have haiku access it throws “resource not found” even though the key itself is fine

just hit Save anyway and ignore the red error — the credential still works when you actually use it in a workflow with sonnet or whatever model you have access to

If n8n can’t connect to Anthropic, it’s usually because your server can’t reach the API or the API key is incorrect. Make sure your server allows outbound connections and that the key is copied correctly. If the server is blocked, using a VPN, proxy, or a different server with access will fix the issue. Once the connection works, the API can be attached successfully.

Hello,

I have been facing same problem for days and no solution for day, I have tried multiple ways to get my API key work with n8n but it doesn’t,

1-curl to actual API returns Positive

2- Base URL to https://api.anthropic.com sends negative,

3- Even after saving my credentials it returns blank and never is saved.

4- on F12 on chrome there are dozens of red alerts of error,

Please can a someone from support fix this problem?

Regards.