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

@xlaunch/llm-anthropic

v0.3.0-beta.4

Published

The native Anthropic Messages LLM adapter: the anthropic-messages wire protocol to one Anthropic-compatible endpoint, behind the Xlaunch LLM seam

Readme


description: "The native Anthropic Messages LLM adapter: the anthropic-messages wire protocol to one Anthropic-compatible endpoint, behind the Xlaunch LLM seam." kind: "package-reference"

@xlaunch/llm-anthropic

Summary

xlaunch-llm-anthropic carries the harness's anthropic-messages wire protocol: request serialization (system slot, tool calls, images), server-sent-event stream translation (text, thinking, and tool-use blocks; stop reasons; usage), and refusal mapping, plus AnthropicAdapter, a full LLM adapter any composition can register routes with. The gateway adapter serves routes that declare api: anthropic-messages through the same translation, so a route can point directly at an Anthropic-compatible endpoint without an OpenAI-compatible shim. Wire facts — the 2023-06-01 version header, event vocabulary, disjoint usage accounting, and image limits — are pinned to the Messages API reference.

Table of Contents


Use this package

Declare a route under llm-gateway.providers in $XLAUNCH_HOME/settings.yaml with api: anthropic-messages, an endpoint base address ending at the version segment, and a credential reference; the Models page offers the protocol because the gateway's route schema enumerates it:

llm-gateway:
  providers:
    claude-direct:
      api: anthropic-messages
      displayName: Claude (direct)
      baseURL: https://api.anthropic.com/v1
      apiKeyEnv: ANTHROPIC_API_KEY
      models:
        - id: claude-sonnet-4-5
          contextWindow: 200000
          maxTokens: 8192

Compositions that register adapters themselves can construct AnthropicAdapter with the same dependency shape the gateway adapter takes — a route resolver, a credential resolver, and the attachment store — and register it with ctx.llm.registerAdapter(). The package is a library, not a plugin: it owns no settings section, and routes are declared where the gateway owns them.

Model Experience

Anthropic Messages dispatch

What the model sees

The adapter changes no model-visible text: it projects the assembled harness request onto the Messages wire — the system prompt and system-role history into the top-level system field, tool results into tool_result blocks inside user turns, assistant tool calls into tool_use blocks, and images into inline base64 sources read under the shared request-image policy — and streams response blocks back into harness chunks. A tool result's images ride the tool_result content array the API accepts beside its text, instead of being dropped from the string form. Stored tool-call arguments are re-parsed into tool_use input objects, and a stored call whose arguments do not parse is refused rather than rewritten.

Token effect

None of the request's tokens are added or removed here; the assembled request reaches the endpoint verbatim up to wire encoding. Anthropic reports disjoint counts (input_tokens excludes cached tokens), so usage maps directly: cache_read_input_tokens and cache_creation_input_tokens become the harness cache fields, and the total is derived from the authoritative parts.

KV Cache effect

Dispatch does not rewrite request prefixes, so an unchanged conversation prefix stays byte-stable across requests to the same route: consecutive same-role turns are sent as-is for the endpoint to combine, and system-role history folds deterministically. Changing the route's baseURL, credential, or model id in settings directs later requests to a different endpoint and forfeits that provider's cache reuse.

Known Limitations and Deferred Work

These limits define when this adapter is a poor fit. They are current package constraints, not a task backlog.

  • No reasoning-effort mapping — the Messages API request carries no effort field, so routes served through this wire declare no reasoning efforts and an effort-bearing request is refused before dispatch. Extended thinking is never enabled on requests, while thinking blocks a gateway-enabled endpoint streams back are still translated into harness reasoning chunks.
  • No model discovery — model interrogation on the gateway's settings namespace speaks the OpenAI listing shape; an Anthropic endpoint answers it with model ids but not display names.
  • Text and image output only — assistant-side image generation is not mapped; responses carry text, thinking, and tool-use blocks.

Dev Note

Runtime invariant: No companion is published. The wire translation is exercised directly by behavior specs (tests/stream.spec.ts, tests/request.spec.ts) against recorded server-sent-event transcripts; the adapter owns no durable package-local event stream.