npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@l10nmonster/helpers-anthropic

v3.1.3

Published

Anthropic Claude LLM provider for l10nmonster using Vertex AI

Downloads

78

Readme

L10nMonster Anthropic Helper

This package provides integration between L10nMonster and Anthropic's Claude models via both direct API and Google Vertex AI.

Installation

npm install @l10nmonster/helpers-anthropic

Usage

Direct API Configuration

import { AnthropicAgent } from '@l10nmonster/helpers-anthropic';

const agent = new AnthropicAgent({
    id: 'claude-translator',
    model: 'claude-3-5-sonnet-latest',
    quality: 80,
    temperature: 0.1,
    maxTokens: 4096,
    apiKey: 'your-anthropic-api-key'  // Direct API access
});

Vertex AI Configuration

import { AnthropicAgent } from '@l10nmonster/helpers-anthropic';

const agent = new AnthropicAgent({
    id: 'claude-translator',
    model: 'claude-3-5-sonnet@20241022',
    quality: 80,
    temperature: 0.1,
    maxTokens: 4096,
    vertexProject: 'your-gcp-project-id',
    vertexLocation: 'us-central1'
});

Authentication

The AnthropicAgent supports two authentication methods:

Direct API

  1. API Key: Obtain an API key from Anthropic Console
  2. Set apiKey: Pass your API key in the configuration

Vertex AI

  1. Service Account: Set up a service account with Vertex AI permissions
  2. gcloud CLI: Run gcloud auth login and gcloud config set project YOUR_PROJECT_ID
  3. Environment Variables: Set GOOGLE_APPLICATION_CREDENTIALS to point to your service account key file

Retry Behavior

The AnthropicAgent uses the native retry mechanism built into both the Anthropic SDK and Anthropic Vertex SDK:

  • Automatic Retries: Both SDKs automatically handle retries with exponential backoff
  • Configurable: Set maxRetries in the constructor to control retry attempts (passed directly to both SDKs)
  • Smart Error Handling: Automatically retries on network errors, rate limits, and temporary service issues
  • No Manual Implementation: Unlike other providers, this uses the SDK's native retry logic for better reliability
  • Consistent Behavior: The same maxRetries value is used whether you're using direct API or Vertex AI

Configuration Options

  • model (required): The Claude model to use
  • quality (required): Quality score for translations (0-100)
  • apiKey: Your Anthropic API key (for direct API access)
  • temperature: Controls randomness (0.0-1.0, default: 0.1)
  • maxTokens: Maximum output tokens (default: 4096)
  • maxRetries: Maximum number of retries (passed to Anthropic SDK)
  • vertexProject: GCP project ID (for Vertex AI, auto-detected if not provided)
  • vertexLocation: GCP region (for Vertex AI, default: 'global')
  • persona: Custom translator persona (optional)
  • customSchema: Custom response schema (optional)

Testing

Run the test suite using Node.js built-in testing:

# From the package directory
npm test

# From the workspace root
npm test --workspace=helpers-anthropic

The test suite includes:

  • Unit tests for all major functionality
  • Integration tests with the LLMTranslationProvider inheritance
  • Error handling and edge case scenarios
  • Mock testing without external API calls

Requirements

  • Node.js >= 22.11.0
  • Google Cloud Project with Vertex AI API enabled
  • Proper authentication setup for Google Cloud

License

MIT