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

dreame-claude

v1.2.14

Published

dreame claude-code

Downloads

1,241

Readme

dreame-claude

A wrapper for claude-code with custom API endpoints and SSO authentication.

Installation

npm install -g dreame-claude

Usage

After installation, you can use the dreame-claude command just like the regular claude command:

dreame-claude

Features

  1. Automatic Environment Setup: Sets up telemetry environment variables automatically
  2. API Endpoint Redirection: Redirects all Anthropic API requests to custom endpoints
  3. SSO Authentication: Provides browser-based authentication with token management
  4. User Identity Management: Extracts and maps user IDs between systems
  5. API Key Management: Automatically creates and manages user-specific API keys
  6. Configuration Management: Automatically sets up Claude settings with GLM model configuration

Authentication Flow

The tool implements a comprehensive authentication system:

  1. Token Caching: Stores authentication tokens in ~/.claude/dreame-tokens.json
  2. Token Validation: Validates tokens with the remote authentication service
  3. Browser-based Login: Opens a local web server for authentication when needed
  4. Automatic Renewal: Handles token expiration and renewal automatically

Authentication Endpoints

  • Token Validation: https://upper.dreame.tech:5005/v1/auth/reftoken
  • User Login: http://llm.dreame.tech/copilot/v1/api/rest/login
  • User Mapping: https://llm.dreame.tech/copilot/v1/api/rest/claude-client-user-map/create_or_update

Environment Variables

This tool automatically sets the following environment variables:

Telemetry Configuration

  • CLAUDE_CODE_ENABLE_TELEMETRY=1
  • OTEL_METRICS_EXPORTER=otlp
  • OTEL_LOGS_EXPORTER=otlp
  • OTEL_EXPORTER_OTLP_PROTOCOL=grpc
  • OTEL_EXPORTER_OTLP_ENDPOINT=http://172.26.33.148:4317
  • OTEL_METRIC_EXPORT_INTERVAL=10000
  • OTEL_LOGS_EXPORT_INTERVAL=5000
  • OTEL_LOG_USER_PROMPTS=1

API Configuration

  • ANTHROPIC_BASE_URL=https://dreame-claude.dreame.tech/init
  • ANTHROPIC_API_KEY: Dynamically set per user via API key management

Localization

  • LANG=zh_CN.UTF-8
  • LC_ALL=zh_CN.UTF-8
  • LC_CTYPE=zh_CN.UTF-8

Configuration Management

The tool automatically creates and manages Claude configuration:

Claude Settings (~/.claude/settings.json)

{
  "env": {
    "ANTHROPIC_MODEL": "glm-4.6",
    "ANTHROPIC_SMALL_FAST_MODEL": "glm-4.6"
  },
  "alwaysThinkingEnabled": true
}

API Key Management

The tool includes a comprehensive API key management system:

  1. Dynamic Key Creation: Creates user-specific API keys through the admin API
  2. Remote Synchronization: Synchronizes keys with the remote user management service
  3. Automatic Rotation: Handles key updates and invalidation

API Management Endpoints

  • Admin API: https://dreame-claude.dreame.tech/admin/api-keys
  • User API Sync: https://llm.dreame.tech/copilot/v1/api/rest/claude-user-apikey/create_or_update

User Identity Extraction

The tool automatically extracts user identities from Claude telemetry data:

  • Parses JSON telemetry output to identify user.id fields
  • Maps extracted user IDs to usernames in the user management system
  • Ensures proper attribution for API usage

Command Setup

The tool automatically manages the Claude command installation:

  • Renames existing claude executable to real_claude
  • Creates symbolic link from dreame-claude to claude
  • Ensures seamless integration with existing workflows

Requirements

  • Node.js >= 18.0.0
  • @anthropic-ai/claude-code installed globally
  • Network access to Dreame authentication services

Dependencies

  • @anthropic-ai/claude-code: Base Claude Code functionality

License

MIT