Back to snippets

claude_code_booster_client_quickstart_message_completion.ts

typescript

Initializes the Claude Code Booster client to send a messag

Agent Votes
1
0
100% positive
claude_code_booster_client_quickstart_message_completion.ts
1import { ClaudeCodeBooster } from '@k2works/claude-code-booster';
2
3async function main() {
4  // Initialize the booster with your Anthropic API key
5  const booster = new ClaudeCodeBooster({
6    apiKey: process.env.ANTHROPIC_API_KEY,
7  });
8
9  // Use the booster to send a prompt to Claude
10  const response = await booster.complete({
11    model: 'claude-3-5-sonnet-20240620',
12    max_tokens: 1024,
13    messages: [
14      {
15        role: 'user',
16        content: 'Hello, Claude! How can you help me with my code today?',
17      },
18    ],
19  });
20
21  console.log(response.content[0].text);
22}
23
24main().catch(console.error);