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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@llms-sdk/bridge

v2.2.0

Published

Use non-Anthropic models with Claude Code by proxying requests through the LLMS SDK unified interface

Downloads

10

Readme

@llms-sdk/bridge

Use OpenAI, Google, and other LLM providers with Claude Code by intercepting and transforming API requests.

Not that anything can beat Opus, Sonnet and a Claude Max plan. But you can try that fools errand now. Go get Claude Max.

Quick Start

# No installation required - use npx
npx @llms-sdk/bridge                     # Show available providers
npx @llms-sdk/bridge openai              # Show OpenAI models
npx @llms-sdk/bridge openai gpt-4o       # Run Claude Code with GPT-4

# Set API keys (optional - can specify per-command with --apiKey)
export OPENAI_API_KEY=sk-...
export GOOGLE_API_KEY=...

# Advanced usage
npx @llms-sdk/bridge openai gpt-4o --apiKey sk-...                           # Custom API key
npx @llms-sdk/bridge openai llama3.2 --baseURL http://localhost:11434/v1     # Local Ollama
npx @llms-sdk/bridge openai gpt-4o --baseURL https://openrouter.ai/api/v1 --apiKey sk-or-... # OpenRouter
npx @llms-sdk/bridge openai gpt-4o --debug                          # Enable debug logs
npx @llms-sdk/bridge --trace -p "Hello world"                       # Spy on Claude ↔ Anthropic communication

# All Claude Code arguments work
npx @llms-sdk/bridge google gemini-2.5-pro-preview-05-06 --resume --continue
npx @llms-sdk/bridge openai o4-mini -p "Hello world"

How It Works

Claude Code only works with Anthropic models. This tool intercepts Claude Code's API calls and routes them to other providers while preserving (almost) full tool compatibility.

  1. Spawn Claude Code as subprocess with custom Node.js loader
  2. Patch global fetch() to intercept api.anthropic.com/v1/messages requests
  3. Transform Anthropic requests → unified LLMS SDK format → provider API
  4. Stream provider responses back in Anthropic SSE format

Limitations

This is a glorified hack that pretends other models are Claude. Here's what breaks:

Completely Broken:

  • 🚫 Token usage/cost reporting (Claude Code's displays will lie to you)
  • 🚫 Image uploads (drag/drop, paste, file paths - Claude Code expects Anthropic's servers)
  • 🚫 Input caching (Claude Code's prompt caching isn't implemented - enjoy higher costs!)
  • 🚫 Web search/fetch tools (Anthropic-specific magic)

Somewhat Janky:

  • 🤷 Model-specific features don't translate (Claude's artifacts, GPT's reasoning modes)
  • 🤷 Thinking/reasoning output formatting differs between providers
  • 🤷 Error messages might be cryptic (provider auth failures won't surface clearly)
  • 🤷 Tool schemas get converted (JSON Schema ↔ Zod) - usually works, sometimes doesn't
  • 🤷 Streaming behavior has subtle differences despite SSE format conversion

OpenAI Specific Rant: OpenAI, put the goddamn thinking tokens into your API responses, you cowards. We're all tired of your "reasoning effort" parameter nonsense.

There are definitely mystery bugs hiding in the corners. You've been warned. 🐛

Development

Setup:

git clone https://github.com/lennylmiller/llms-sdk
cd llms-sdk && npm install && npm run dev

This starts compilation in watch mode for all packages and apps. Code changes are reflected immediately. Use npx tsx src/cli.ts for on-the-fly compilation & testing.

Testing:

npm run test:all         # All tests
npm run test:unit        # Unit tests
npm run test:core        # CLI functionality
npm run test:tools       # Tool integration
npm run test:providers   # Multi-provider

Debugging:

# Enable debug logging
npx @llms-sdk/bridge openai gpt-4o --debug
cat .claude-bridge/requests-*.jsonl     # Raw request/response pairs
cat .claude-bridge/transformed-*.jsonl  # Transformation details
cat .claude-bridge/context-*.jsonl      # Message contexts and transform status

# Trace mode - spy on Claude Code ↔ Anthropic communication
npx @llms-sdk/bridge --trace -p "Test prompt"  # Normal Claude Code, but logs all requests/responses
cat .claude-bridge/trace-*.jsonl        # See system prompts, tools, thinking status, messages
cat .claude-bridge/requests-*.jsonl     # Raw request/response pairs

# VS Code debugging (requires patching Claude to disable anti-debugging)
npx tsx src/cli.ts <arguments> --patch-claude   # In JavaScript Debug Terminal

Bundling:

This package uses a hybrid bundling approach:

  • Core bridge logic is bundled with LLMS SDK package
  • LLM provider SDKs (@anthropic-ai/sdk, openai, @google/genai, etc.) remain external dependencies
  • This avoids Node.js dynamic require issues while keeping dependencies manageable

Core Files:

  • src/cli.ts - CLI with provider discovery
  • src/interceptor.ts - Fetch interception & client creation
  • src/transforms/ - Request/response transformations
  • src/utils/ - SSE streaming, logging, parsing