Actions2
Overview
The Claude AI Studio node (Resource: Default, Operation: Chat) enables conversational interactions with Anthropic's Claude models directly from n8n workflows. It sends a user prompt—and optionally previous conversation history—to the Claude API and returns the model's response. This is useful for building chatbots, virtual assistants, or any workflow requiring advanced natural language understanding and generation.
Practical examples:
- Automating customer support responses by sending user queries and receiving AI-generated replies.
- Creating internal tools that summarize, rephrase, or analyze text via conversational prompts.
- Building multi-turn chat experiences where context from previous messages is preserved.
Properties
| Name | Type | Meaning |
|---|---|---|
| Model | options | Selects which Claude model to use (e.g., Opus, Sonnet, Haiku, 2.1). |
| Prompt | string | The message prompt sent to Claude; this is the main user input for the conversation. |
| Include Previous Messages | boolean | If true, includes prior messages from the input data to provide conversation context. |
| Previous Messages Field | string | Specifies the field in the input JSON containing an array of previous messages. |
| Advanced Parameters | collection | Additional settings to control model behavior (see below for details): |
| └ Temperature | number | Controls randomness: 0 = deterministic, 1 = maximum randomness. |
| └ Top P | number | Nucleus sampling: considers tokens with top_p probability mass. |
| └ Maximum Output Tokens | number | Limits the maximum number of tokens in the generated response. |
| └ System Prompt | string | A system-level instruction to guide the assistant’s behavior. |
| └ Response Format | options | Desired format of the response: Auto, JSON, or Text. |
| └ Stop Sequences | string[] | Comma-separated sequences that will cause the model to stop generating further output. |
| └ Stream | boolean | Whether to stream partial progress (not fully supported in n8n yet). |
Output
The node outputs a single item per input, with the following structure in the json field:
{
// ...original input fields,
"claudeResponse": {
// Full response object returned by the Claude API, typically including:
"id": "string",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "AI-generated reply"
}
// ...possibly other content types
],
// ...other metadata fields as provided by Claude API
}
}
- The original input fields are preserved.
- The Claude API response is added under the key
claudeResponse. - No binary data is produced by this operation.
Dependencies
- External Service: Requires access to the Anthropic Claude API.
- API Key: You must configure an
anthropicApicredential in n8n, providing your Claude API key. - Environment Variables: None required by default, but you may override the API endpoint or version in credentials if needed.
- n8n Dependency: Relies on the
axioslibrary for HTTP requests (bundled).
Troubleshooting
Common Issues:
- Invalid API Key: If the API key is missing or incorrect, you will receive an authentication error from the Claude API.
- Model Not Supported: Selecting a model not available to your account or region may result in an error.
- Malformed Previous Messages: If the previous messages field does not contain a valid array of messages, the request may fail.
- Exceeded Token Limit: Setting
Maximum Output Tokenstoo high may exceed your account or model limits.
Error Messages:
Claude API Error: <status> - <message>: Indicates an error returned by the Claude API. Check the status code and message for details (e.g., invalid parameters, quota exceeded).Error: <message>: General error, possibly due to network issues or misconfiguration.
How to resolve:
- Double-check your API credentials.
- Ensure all required properties are set and correctly formatted.
- Review the Claude API documentation for parameter constraints and limits.