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

@yadimon/claude-code-to-llm

v0.4.0

Published

Use Claude Code as a simple LLM provider through an SDK and CLI

Readme

@yadimon/claude-code-to-llm

Minimal SDK and CLI wrapper around Claude Code headless mode for raw prompt requests.

Install

npm install @yadimon/claude-code-to-llm

Requirements:

  • Node.js >=20
  • installed claude CLI in PATH or CLAUDE_CODE_TO_LLM_CLI_PATH
  • valid Claude Code login on the machine

The wrapper defaults to the Claude Code auth bundle at:

  • ~/.claude.json
  • ~/.claude/.credentials.json

If you need to verify that Claude Code is currently logged in, run:

claude auth status

What It Provides

  • a small SDK for raw prompt execution with minimal prompt overhead
  • a CLI for direct prompt mode from flags, files, or stdin
  • structured streaming events for adapters such as HTTP compatibility servers
  • isolated execution via a temporary home directory copied from your Claude Code auth bundle

SDK

import { runPrompt } from "@yadimon/claude-code-to-llm";

const result = await runPrompt("Hello", {
  model: "claude-sonnet-4-6",
  maxTokens: 256
});

console.log(result.content);
console.log(result.usage);

For streamed events:

import { streamPrompt } from "@yadimon/claude-code-to-llm";

for await (const event of streamPrompt("Hello", {
  model: "claude-sonnet-4-6"
})) {
  if (event.type === "response.output_text.delta") {
    process.stdout.write(event.delta);
  }
}

CLI

claude-code-to-llm --prompt "Hello"
claude-code-to-llm --input-file ./prompt.txt --json
cat ./prompt.txt | claude-code-to-llm --stream --json

Supported CLI options:

--prompt <text>
--input-file <path>
--stream
--json
--model <name>
--reasoning-effort <level>
--max-tokens <n>
--search
--auth-path <path>
--credentials-path <path>
--settings-path <path>
--config-home <path>
--cwd <path>
--cli <path>

Runtime Configuration

| Variable | Default | Description | |---|---|---| | CLAUDE_CODE_TO_LLM_AUTH_PATH | ~/.claude.json | Path to the Claude Code session file. | | CLAUDE_CODE_TO_LLM_CREDENTIALS_PATH | ~/.claude/.credentials.json | Path to the Claude Code credentials file. | | CLAUDE_CODE_TO_LLM_SETTINGS_PATH | ~/.claude/settings.json when present | Optional Claude Code settings file to copy into the temp home. | | CLAUDE_CODE_TO_LLM_CLI_PATH | claude | Path to the Claude Code CLI binary. | | CLAUDE_CODE_TO_LLM_REASONING_EFFORT | low | Default reasoning effort passed to Claude Code. | | CLAUDE_CODE_TO_LLM_CONFIG_HOME | temp dir | Temporary Claude Code home directory for a run. | | CLAUDE_CODE_TO_LLM_WORKSPACE | temp dir | Workspace directory used for execution. | | CLAUDE_CODE_TO_LLM_LOCAL_HOME | .claude-code-to-llm/ | Local directory used by the auth copy helper. |

Notes

  • The wrapper calls claude --print --output-format stream-json.
  • maxTokens maps to CLAUDE_CODE_MAX_OUTPUT_TOKENS for the spawned Claude Code process.
  • The package is intentionally focused on raw prompt execution. It does not expose Claude Code tools through its public API.
  • Web search is off by default. The wrapper always forces the WebSearch permission via --allowed-tools WebSearch (when webSearch: true / --search) or --disallowed-tools WebSearch, overriding any WebSearch entry in settings.json.

Development

npm run build --workspace @yadimon/claude-code-to-llm
npm run lint --workspace @yadimon/claude-code-to-llm
npm run typecheck --workspace @yadimon/claude-code-to-llm