Skip to main content

Anthropic Connector

Integrate Anthropic's Claude models into your Logic Bee hooks.

Setup

// logic-bee.config.ts
export default {
connectors: {
anthropic: {
apiKey: process.env.ANTHROPIC_API_KEY,
model: 'claude-sonnet-4-20250514',
},
},
};

Usage

@LogicHook({
event: 'summarize-document',
collection: 'ai',
})
export class SummarizeDocumentHook {
async run(context) {
const { text } = context.body;

const response = await context.connectors.anthropic.complete({
prompt: `Summarize the following document:\n\n${text}`,
maxTokens: 500,
});

return { summary: response.text };
}
}

Configuration Options

OptionTypeDescription
apiKeystringYour Anthropic API key
modelstringModel to use (default: claude-sonnet-4-20250514)
maxTokensnumberDefault max tokens for completions
temperaturenumberSampling temperature (0–1)