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

@simulacra-ai/anthropic

v0.0.8

Published

Anthropic Claude provider for the Simulacra conversation engine

Readme

Simulacra Anthropic Provider

The Anthropic provider allows Simulacra to use Claude models via the Anthropic API, with support for extended thinking and prompt caching.

Installation

npm install @simulacra-ai/core @simulacra-ai/anthropic @anthropic-ai/sdk

Usage

import { Conversation } from "@simulacra-ai/core";
import { AnthropicProvider } from "@simulacra-ai/anthropic";
import Anthropic from "@anthropic-ai/sdk";

// create a provider and conversation
const provider = new AnthropicProvider(new Anthropic(), { model: MODEL_NAME });
using conversation = new Conversation(provider);

AnthropicProviderConfig

interface AnthropicProviderConfig {
  model: string;
  max_tokens?: number;
  thinking?: { enable: boolean; budget_tokens?: number };
  prompt_caching?: { system_prompt?: boolean; toolkit?: boolean };
  request_options?: Anthropic.RequestOptions | (() => Anthropic.RequestOptions | Promise<Anthropic.RequestOptions>);
}

Additional properties (temperature, top_p, etc.) spread into the API request.

If max_tokens is not set, it defaults to 8192.

Request Options

The request_options field passes custom options to every Anthropic SDK call. It accepts a static Anthropic.RequestOptions object or a function that returns one (synchronously or as a promise). A function is useful when options need to be computed at request time, for example to resolve a fresh OAuth token.

const provider = new AnthropicProvider(new Anthropic(), {
  model,
  request_options: async () => ({
    headers: {
      "x-api-key": null,
      "authorization": `Bearer ${await get_oauth_token()}`, // don't use a Claude Code token here, doing so is against the Anthropic TOS
      "anthropic-beta": "oauth-2025-04-20",
    },
  }),
});

Extended Thinking

Extended thinking captures the model's chain-of-thought reasoning as ThinkingMessageContent blocks in the conversation history. This makes the model's reasoning process visible and accessible alongside its regular output.

const provider = new AnthropicProvider(new Anthropic(), {
  model,
  max_tokens: 16384,
  thinking: { enable: true, budget_tokens: 10000 },
});

Both thinking and redacted_thinking blocks from the API are converted to Simulacra's ThinkingMessageContent type.

Prompt Caching

Prompt caching is enabled by default. The provider adds cache_control markers to the system prompt and tool definitions, avoiding re-processing static content on every turn. Multi-turn conversations benefit because subsequent turns read from the cache at a reduced rate.

const provider = new AnthropicProvider(new Anthropic(), {
  model,
  max_tokens: 4096,
  prompt_caching: {
    system_prompt: true, // default
    toolkit: true, // default
  },
});

Cache writes cost slightly more per token than standard requests. Caching can be disabled by setting both flags to false.

License

MIT