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

@dysporium-sdk/anthropic

v3.0.0

Published

Anthropic provider for Dysporium SDK

Readme

@dysporium-sdk/anthropic

Anthropic provider for Dysporium SDK - integrate Claude models with a simple, type-safe API.

Installation

npm install @dysporium-sdk/anthropic
# or
pnpm add @dysporium-sdk/anthropic
# or
yarn add @dysporium-sdk/anthropic

Note: This package includes all exports from @dysporium-sdk/core, so you only need to install this single package.

Quick Start

import { createAnthropic, generateText, streamText } from '@dysporium-sdk/anthropic';

const anthropic = createAnthropic({
  apiKey: process.env.ANTHROPIC_API_KEY,
});

// Generate text
const result = await generateText({
  model: anthropic('claude-sonnet-4-5'),
  messages: [{ role: 'user', content: 'Hello!' }],
});

console.log(result.text);

Features

  • Full Anthropic API support (Claude 4.5 Sonnet/Haiku/Opus, Claude 4, Claude 3.7, and legacy models)
  • Streaming responses
  • Tool/function calling
  • Automatic retries with exponential backoff
  • Full TypeScript support

Usage

Text Generation

import { createAnthropic, generateText } from '@dysporium-sdk/anthropic';

const anthropic = createAnthropic({ apiKey: 'your-api-key' });

const result = await generateText({
  model: anthropic('claude-sonnet-4-5'),
  messages: [
    { role: 'user', content: 'What is the capital of France?' },
  ],
  maxTokens: 100,
  temperature: 0.7,
});

console.log(result.text);
console.log(result.usage); // { inputTokens, outputTokens, totalTokens }

Streaming

import { createAnthropic, streamText } from '@dysporium-sdk/anthropic';

const anthropic = createAnthropic({ apiKey: 'your-api-key' });

const stream = await streamText({
  model: anthropic('claude-sonnet-4-5'),
  messages: [{ role: 'user', content: 'Write a poem about coding' }],
});

for await (const chunk of stream) {
  if (chunk.type === 'text-delta') {
    process.stdout.write(chunk.textDelta);
  }
}

Tool Calling

import { createAnthropic, generateText } from '@dysporium-sdk/anthropic';

const anthropic = createAnthropic({ apiKey: 'your-api-key' });

const result = await generateText({
  model: anthropic('claude-sonnet-4-5'),
  messages: [{ role: 'user', content: 'What is the weather in Paris?' }],
  tools: [
    {
      name: 'get_weather',
      description: 'Get current weather for a location',
      parameters: {
        type: 'object',
        properties: {
          location: { type: 'string', description: 'City name' },
        },
        required: ['location'],
      },
    },
  ],
});

if (result.toolCalls) {
  console.log(result.toolCalls);
}

Supported Models

Latest Models (Claude 4.5)

  • claude-sonnet-4-5-20250929 / claude-sonnet-4-5 - Best balance of intelligence, speed, and cost
  • claude-haiku-4-5-20251001 / claude-haiku-4-5 - Fastest model with near-frontier intelligence
  • claude-opus-4-5-20251101 / claude-opus-4-5 - Maximum intelligence with practical performance

Claude 4 Models

  • claude-opus-4-1-20250805 / claude-opus-4-1 - Enhanced Claude 4.1 Opus
  • claude-sonnet-4-20250514 / claude-sonnet-4-0 - Claude 4 Sonnet
  • claude-opus-4-20250514 / claude-opus-4-0 - Claude 4 Opus

Legacy Models

  • claude-3-7-sonnet-20250219 - Claude 3.7 Sonnet
  • claude-3-5-haiku-20241022 - Claude 3.5 Haiku
  • claude-3-haiku-20240307 - Claude 3 Haiku (fast and efficient)

Configuration

const anthropic = createAnthropic({
  apiKey: 'your-api-key',
  baseURL: 'https://api.anthropic.com/v1', // Optional: custom base URL
  retry: {
    maxRetries: 3,
    initialDelay: 1000,
    maxDelay: 30000,
  },
});

License

MIT