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

skalpel

v2.0.24

Published

Skalpel AI SDK — optimize your OpenAI and Anthropic API calls

Readme

Skalpel

Optimize Claude Code prompts to reduce credit usage. Skalpel sits between Claude Code and the Anthropic API, optimizing prompts before they reach the provider — saving you money without changing how you work.

How It Works

Claude Code  -->  Skalpel Proxy (local)  -->  Skalpel Backend (AWS)  -->  Anthropic API
                  Intercepts requests          Optimizes prompts           Returns response
                  Adds tracking headers        Reduces token usage
  1. A local proxy runs on your machine (port 18100)
  2. Claude Code is configured to send API requests to the proxy instead of api.anthropic.com
  3. The proxy forwards requests to the Skalpel backend, which optimizes prompts for lower token usage
  4. The optimized request is sent to Anthropic, and the response streams back to Claude Code

Your Anthropic API key stays in the request chain — Skalpel never stores it.

Quick Start

One command to install, detect Claude Code, and start optimizing:

npx skalpel --api-key sk-skalpel-YOUR_KEY --auto

This will:

  • Start the local proxy on ports 18100 (Anthropic) and 18101 (OpenAI)
  • Detect coding agents on your machine
  • Configure Claude Code and Codex agents automatically
  • Set shell environment variables in your .bashrc/.zshrc
  • Begin optimizing API traffic immediately

Interactive Setup

For a guided setup with prompts:

npx skalpel

The wizard walks you through API key entry, agent detection, and proxy configuration.

Manual Setup

# 1. Start the proxy
npx skalpel start

# 2. Run the setup wizard to configure Claude Code
npx skalpel setup

# 3. Verify everything is working
npx skalpel doctor

What Gets Configured

Claude Code

Claude Code is auto-configured during setup. ANTHROPIC_BASE_URL is set in ~/.claude/settings.json to route API calls through the proxy. Only API endpoints (/v1/messages, /v1/complete) are routed through Skalpel for optimization; auth endpoints pass directly to Anthropic.

Shell Environment (~/.bashrc, ~/.zshrc)

Environment variables are added for tools that read them directly:

# BEGIN SKALPEL PROXY - do not edit manually
export ANTHROPIC_BASE_URL="http://localhost:18100"
export OPENAI_BASE_URL="http://localhost:18101"
# END SKALPEL PROXY

Proxy Config (~/.skalpel/config.json)

{
  "apiKey": "sk-skalpel-YOUR_KEY",
  "remoteBaseUrl": "http://skalpel-production-554359744.us-west-2.elb.amazonaws.com",
  "anthropicPort": 18100,
  "openaiPort": 18101
}

CLI Commands

| Command | Description | |---|---| | npx skalpel | Run the setup wizard | | npx skalpel start | Start the proxy | | npx skalpel stop | Stop the proxy | | npx skalpel status | Show proxy status and uptime | | npx skalpel doctor | Verify configuration and connectivity | | npx skalpel logs | View proxy logs | | npx skalpel logs -f | Follow proxy logs in real time | | npx skalpel uninstall | Remove proxy, configs, and shell modifications |

Flags

| Flag | Description | |---|---| | --api-key <key> | Provide Skalpel API key (skips interactive prompt) | | --auto | Non-interactive mode (requires --api-key) |

Streaming Support

Skalpel fully supports Anthropic's SSE streaming protocol. When Claude Code sends a streaming request ("stream": true), the proxy:

  • Detects the streaming flag in the request body
  • Forwards to the backend with all original headers
  • Pipes SSE events (message_start, content_block_delta, message_stop) directly back to Claude Code
  • Preserves upstream headers like anthropic-request-id

No buffering, no modification of the stream — chunks flow through in real time.

Headers

The proxy adds these headers to every request forwarded to the Skalpel backend:

| Header | Value | Purpose | |---|---|---| | X-Skalpel-API-Key | Your Skalpel key | Backend authentication | | X-Skalpel-Source | claude-code | Traffic source identification | | X-Skalpel-Agent-Type | claude-code | Agent type for optimization routing | | X-Skalpel-SDK-Version | proxy-1.0.0 | SDK version tracking |

The original x-api-key header (your Anthropic key) is forwarded as-is.

Codex Support

Skalpel also supports OpenAI Codex on port 18101. The same --auto flow detects and configures both agents if present.

SDK Integration

For programmatic use in your own applications:

import { createSkalpelClient } from 'skalpel';
import Anthropic from '@anthropic-ai/sdk';

const client = createSkalpelClient(new Anthropic(), {
  apiKey: process.env.SKALPEL_API_KEY!,
});

const response = await client.messages.create({
  model: 'claude-sonnet-4-20250514',
  max_tokens: 1024,
  messages: [{ role: 'user', content: 'Hello' }],
});

See the API Reference for all SDK options.

API Reference

createSkalpelClient<T>(client: T, options: SkalpelClientOptions): T

Wraps an existing OpenAI or Anthropic client. All API calls route through the Skalpel proxy with automatic fallback on errors.

createSkalpelAnthropic(options): Promise<Anthropic>

Creates a pre-configured Anthropic client pointing at the Skalpel proxy.

createSkalpelOpenAI(options): Promise<OpenAI>

Creates a pre-configured OpenAI client pointing at the Skalpel proxy.

Configuration Options

interface SkalpelClientOptions {
  apiKey: string;                  // Skalpel API key (sk-skalpel-*)
  workspace?: string;              // Workspace ID
  baseURL?: string;                // Proxy URL (default: production ALB)
  fallbackOnError?: boolean;       // Fall back to direct provider (default: true)
  timeout?: number;                // Request timeout in ms (default: 30000)
  retries?: number;                // Max retries (default: 2)
}

Uninstall

npx skalpel uninstall

This removes the proxy and cleans up shell environment variables. If a previous version of Skalpel modified ~/.claude/settings.json, uninstall will also clean up those changes.