n8n
Call API-AI from n8n using a vanilla HTTP Request node. No custom community node needed — the raw Anthropic Messages API works as-is.
1. Create a credential
In n8n, Credentials → New → Header Auth. Set:
- Name:
x-api-key - Value: your API-AI key (
mdf-...)
2. HTTP Request node
Drop an HTTP Request node into your workflow and configure:
text
Method: POST
URL: https://api-ai.app/v1/messages
Authentication: Header Auth → (the credential above)
Headers:
anthropic-version: 2023-06-01
content-type: application/json
Body (JSON):
{
"model": "claude-sonnet-5-5",
"max_tokens": 1024,
"messages": [
{ "role": "user", "content": "{{$json.prompt}}" }
]
}The {{$json.prompt}} expression pulls text from the upstream node — swap it for any n8n expression that yields a string.
Streaming
Add "stream": true to the body and toggle the node’s Response → Response Format to String. n8n will receive the SSE byte stream; parse data: lines in a Function node downstream.
Use tool results
For Anthropic tool-calling flows, follow Tool use: pass
tools in the body, inspect the response’s content array fortool_use blocks, dispatch those in n8n, then post tool_result back in a second node.Last updated: October 2, 2026Found a bug? admin@minedom-france.fr