Anthropic

Integrate Anthropic's Claude AI models for message generation in your Spala flows.

Anthropic

The Anthropic addon connects your Spala flows to Anthropic's Claude API. Use Claude models for conversational AI, content analysis, summarization, code generation, and other text-based tasks.

Installation

1. Enable the Anthropic addon from the Addons panel
2. Enter your Anthropic API key in the addon configuration

Configuration

Available Steps

Create Message

Sends a message to a Claude model and receives a response.

Example: Content Moderation

// POST /api/moderate

// Step 1: Create Message (Anthropic addon)
// model: '<current-claude-model>'
// system: 'You are a content moderator. Analyze the following text and respond with a JSON object: { "safe": boolean, "reason": string, "category": string }. Only respond with valid JSON.'
// messages: [{ role: 'user', content: input.text }]
// maxTokens: 200
// Output → vars.moderation
// Step 2: Set Variable - Parse the response
// vars.result = JSON.parse(vars.moderation.content[0].text)
// Step 3: Condition - Check if content is safe
// If vars.result.safe === false
//   Step 4: Database Query - Flag the content
//   INSERT INTO flagged_content (text, reason, category) VALUES (...)
// Step 5: Response
// { safe: vars.result.safe, reason: vars.result.reason }

Example: Document Summarization

// POST /api/summarize

// Step 1: Database Query - Get the document
// SELECT * FROM documents WHERE id = input.documentId
// Step 2: Create Message (Anthropic addon)
// model: '<current-claude-model>'
// system: 'Summarize the following document in 2-3 paragraphs. Focus on the key points and main conclusions.'
// messages: [{ role: 'user', content: vars.document.content }]
// maxTokens: 1000
// Output → vars.summary
// Step 3: Database Query - Save the summary
// UPDATE documents SET summary = vars.summary.content[0].text WHERE id = input.documentId
// Step 4: Response
// { summary: vars.summary.content[0].text }

Response Format

The Create Message step returns Anthropic's standard response format:

{
  id: "msg_...",
  type: "message",
  role: "assistant",
  content: [
    {
      type: "text",
      text: "The model's response text..."
    }
  ],
  model: "<current-claude-model>",
  usage: {
    input_tokens: 125,
    output_tokens: 340
  }
}

Access the response text with: vars.result.content[0].text

Claude models excel at long-form content analysis, nuanced reasoning, and following complex instructions. They support context windows up to 200K tokens, making them suitable for processing large documents.

Anthropic API calls are billed per token. Set the maxTokens parameter appropriately for your use case to control costs.

Your Anthropic API key from console.anthropic.com.
The Claude model to use. Choose a currently supported model from Anthropic.
Array of message objects with 'role' and 'content' fields.
System prompt that sets the behavior and context for the conversation.
Maximum number of tokens in the response.
Sampling temperature between 0 and 1 (default: 1).
Addons Overview
/addons
Browse available addons
Installing Addons
/addons/installing
Enable and configure addons in your project