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

@hashbrownai/anthropic

v0.5.0

Published

Anthropic provider for Hashbrown AI

Readme

Getting Started

Installation

npm install @hashbrownai/anthropic --save

You'll also need to install the Anthropic SDK as a peer dependency:

npm install @anthropic-ai/sdk --save

Basic Usage

Deploy an express server with a single /chat endpoint to use Hashbrown with Anthropic.

import { HashbrownAnthropic } from '@hashbrownai/anthropic';

app.post('/chat', async (req, res) => {
  const stream = HashbrownAnthropic.stream.text({
    apiKey: process.env.ANTHROPIC_API_KEY!,
    request: req.body, // must be Chat.Api.CompletionCreateParams
  });

  res.header('Content-Type', 'application/octet-stream');

  for await (const chunk of stream) {
    res.write(chunk); // Pipe each encoded frame as it arrives
  }

  res.end();
});

Advanced Usage with Custom Base URL

import { HashbrownAnthropic } from '@hashbrownai/anthropic';

const stream = HashbrownAnthropic.stream.text({
  apiKey: process.env.ANTHROPIC_API_KEY!,
  baseURL: 'https://api.anthropic.com', // Optional custom base URL
  request: {
    model: process.env.ANTHROPIC_MODEL ?? 'claude-haiku-4-5-20251001',
    system: 'You are a helpful assistant.',
    messages: [
      {
        role: 'user',
        content: 'Hello, how are you?',
      },
    ],
    // Optional: Add tools for function calling
    tools: [
      {
        name: 'get_weather',
        description: 'Get the current weather for a location',
        parameters: {
          type: 'object',
          properties: {
            location: {
              type: 'string',
              description: 'The city and state, e.g. San Francisco, CA',
            },
          },
          required: ['location'],
        },
      },
    ],
    toolChoice: 'auto',
    // Optional: Add structured output schema
    responseFormat: {
      type: 'object',
      properties: {
        answer: { type: 'string' },
        confidence: { type: 'number' },
      },
      required: ['answer'],
    },
  },
  // Optional: Transform request options before sending to Anthropic
  transformRequestOptions: (options) => {
    // Modify options as needed
    return {
      ...options,
      max_tokens: 1000, // Override max tokens
    };
  },
});

API Reference

HashbrownAnthropic.stream.text(options)

Creates a streaming text completion using Anthropic's Claude models.

Parameters

  • options.apiKey (string, required): Your Anthropic API key
  • options.baseURL (string, optional): Custom base URL for Anthropic API
  • options.request (Chat.Api.CompletionCreateParams, required): The completion request parameters
  • options.transformRequestOptions (function, optional): Function to modify request options before sending

Returns

An async iterable that yields Uint8Array chunks encoded with Hashbrown's frame protocol.

Supported Features

  • Text Streaming: Real-time streaming of text completions
  • Tool Calling: Function calling with automatic tool execution
  • Structured Output: JSON schema validation for responses
  • System Messages: Custom system prompts and instructions
  • Message History: Full conversation context support
  • Error Handling: Proper error propagation through the stream

Models

The adapter supports all Anthropic Claude models. We currently recommend using claude-haiku-4-5-20251001, which is widely available for streaming and tool calling. Switch to newer releases by setting the ANTHROPIC_MODEL environment variable.

Docs

Read the docs for the Hashbrown Anthropic adapter.

Contributing

hashbrown is a community-driven project. Read our contributing guidelines on how to get involved.

Workshops and Consulting

Want to learn how to build web apps with AI? Learn more about our workshops.

LiveLoveApp provides hands-on engagement with our AI engineers for architecture reviews, custom integrations, proof-of-concept builds, performance tuning, and expert guidance on best practices. Learn more about LiveLoveApp.

License

MIT © LiveLoveApp, LLC