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

open-claude-code-proxy

v1.1.5

Published

Local proxy that forwards API requests through the official Claude Code CLI

Readme

Open Claude Code Proxy

Route API requests through the official Claude Code client

English | 中文

npm version npm downloads License: MIT Node.js


What is this?

A local proxy server that forwards Anthropic API requests through the official Claude Code CLI. This allows you to use Claude in any app that supports the Anthropic API (like OpenCode, Cursor, etc.) while leveraging your existing Claude Code authentication.

Features

  • Tool Compatibility: Automatic tool name mapping (Read→read, WebSearch→websearch_exa_*, etc.)
  • Parameter Translation: Converts parameter names (file_path→filePath, old_string→oldString, etc.)
  • Multi-turn Conversations: Full conversation history support including tool_use/tool_result
  • Cache Optimization: Handles cache_control to avoid conflicts with Claude Code
  • OpenCode Integration: Auto-configures OpenCode with backup support

How it works

Your App (OpenCode/Cursor/etc.)
    ↓ POST /v1/messages
localhost:12346 (This Proxy)
    ↓ Spawns `claude --print`
Claude Code CLI (Official Client)
    ↓ Uses your login session
Anthropic API

Quick Start

Option 1: Let an LLM Agent do it (Recommended)

Paste this into a fresh OpenCode/Cursor/Claude session:

Install and configure by following the instructions here https://raw.githubusercontent.com/lkyxuan/open-claude-code-proxy/main/INSTALL_GUIDE.md

Option 2: Install globally (Manual)

npm install -g open-claude-code-proxy
claude-local-proxy

Option 3: Clone and run

git clone https://github.com/lkyxuan/open-claude-code-proxy.git
cd open-claude-code-proxy
node cli.js

Prerequisites

  1. Install Claude Code CLI

    npm install -g @anthropic-ai/claude-code
  2. Login to Claude Code

    claude auth login
  3. Configure Claude Code environment (if using a relay service)

    # Add to ~/.zshrc or ~/.bashrc
    export ANTHROPIC_BASE_URL="https://your-relay-service.com/v1"
    export ANTHROPIC_API_KEY="your-api-key"
    source ~/.zshrc

Port Configuration

The proxy supports flexible port configuration:

# Use command line argument
claude-local-proxy --port 8080
claude-local-proxy -p 8080

# Or use environment variable
PORT=8080 claude-local-proxy

# Or let it use saved config (~/.claude-proxy/config.json)
claude-local-proxy

Port Priority: CLI argument > Config file > Environment variable > Default (12346)

On first run, you'll be prompted to customize the port. Your choice is saved for future use.

OpenCode Auto-Configuration

The proxy can automatically configure OpenCode for you:

  • Detects OpenCode config at ~/.config/opencode/opencode.json
  • Updates provider.anthropic.options.baseURL to match your proxy port
  • Creates automatic backups before modifying (keeps last 3)
  • Prompts before making changes (use --skip-opencode to skip)
# Auto-configure OpenCode
claude-local-proxy -p 8080

# Skip OpenCode configuration
claude-local-proxy -p 8080 --skip-opencode

Configure Your Client

Point your app to the local proxy:

{
  "baseURL": "http://localhost:12346",
  "apiKey": "any-string-works"
}

Note: The API key can be any string - authentication is handled by your Claude Code session.

Commands

This package provides two commands:

claude-local-proxy - Interactive Mode

claude-local-proxy [options]

Options:
  -p, --port <port>    Server port (1024-65535)
  --skip-opencode      Skip OpenCode auto-configuration
  -h, --help           Show help
  -v, --version        Show version

claude-proxy - Background Mode

| Command | Description | |---------|-------------| | claude-proxy start | Start the proxy (background) | | claude-proxy stop | Stop the proxy | | claude-proxy restart | Restart the proxy | | claude-proxy status | Check status | | claude-proxy logs -f | View logs (live) | | claude-proxy test | Test connectivity |

API Endpoints

  • GET /health - Health check
  • POST /v1/messages - Messages API (Anthropic-compatible)

FAQ

| Issue | Solution | |-------|----------| | Login required | Run claude auth login to re-authenticate | | Connection failed | Check environment variable: echo $ANTHROPIC_BASE_URL | | Port in use | Use a different port: claude-local-proxy -p 12347 | | Tool name mismatch | Proxy auto-maps tool names (e.g., Read→read) |


Contributing

PRs and issues are welcome!

License

MIT