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

@aiany/hai

v0.8.4

Published

AI in your terminal. Run commands or ask questions - just hai it. Supports OpenAI, Claude, Gemini, DeepSeek & more.

Readme

hai

Say hi to AI, right from your terminal

npm version License: GPL-3.0

hai (pronounced "hi") brings AI to your terminal. Run commands or ask questions—just hai it.

$ hai "how much disk space"
# → runs `df -h`, explains the result

$ hai "what is Docker"
# → answers your question directly

No complex setup. No switching modes. Just describe what you need.

Features

  • Agent Mode - AI automatically executes shell commands based on your intent
  • Multiple AI Providers - OpenAI, Anthropic Claude, Google Gemini, and any OpenAI-compatible API
  • Profile Management - Configure multiple profiles for different models and providers
  • Interactive Mode - Multi-turn conversations in the terminal
  • Pipe Support - Process input from stdin or files
  • Predefined Prompts - Create reusable prompt templates with {{input}} placeholder
  • Thinking Mode - Enable extended thinking for supported models (Claude, o1/o3)
  • Streaming Output - Real-time response streaming with color support
  • Keyboard Shortcuts - Interrupt output with ESC or Ctrl+C

Installation

npm install -g @aiany/hai

Usage

Basic

# Single question
hai "What is the capital of France?"

# Interactive mode
hai -i

# Interactive mode with initial message
hai -i "Hello"

Agent Mode

By default, hai runs in agent mode where AI can execute shell commands to help you:

# AI will run `ls -la` to answer
hai "What files are in this directory?"

# AI will check git status and logs
hai "Show me recent changes in this project"

# AI will run build commands
hai "Build and test this project"

When a command is about to execute, you'll see a confirmation prompt:

▶ ls -la
  Execute? (Yes/no/all/cancel)
  • Y/Enter - Execute this command
  • n - Skip this command
  • a - Execute all remaining commands without asking
  • c/ESC - Cancel and stop the agent

Use -y for autonomous mode (no confirmation):

hai -y "List all TypeScript files"

Use --chat to disable agent mode and just chat:

hai --chat "Explain what ls does"

Pipe Input

# Pipe text
echo "Hello" | hai "Translate to Chinese"

# Pipe file content
cat code.js | hai "Explain this code"

File Input

# Single file
hai "Review this code" -f main.ts

# Multiple files
hai "Compare these files" -f a.ts -f b.ts

Profiles

# Use a specific profile
hai -u claude "Hello"

# Enable thinking mode
hai --think "Explain quantum entanglement"

Predefined Prompts

# Use a predefined prompt template
hai -p translate "Hello world"

Configuration

Configuration file: ~/.config/hai/settings.json

{
  "profiles": [
    {
      "name": "claude",
      "provider": "anthropic",
      "model": "claude-opus-4-5",
      "apiKey": "$ANTHROPIC_API_KEY",
      "baseURL": "https://api.openai.com/v1",
      "default": true,
      "options": {
        "think": true
      }
    },
    {
      "name": "gpt",
      "provider": "openai",
      "model": "gpt-5.2-pro",
      "apiKey": "$OPENAI_API_KEY",
      "baseURL": "https://api.openai.com/v1"
    },
    {
      "name": "gemini",
      "provider": "gemini",
      "model": "gemini-3-pro-preview",
      "apiKey": "$GOOGLE_API_KEY",
      "baseURL": "https://generativelanguage.googleapis.com/v1beta"
    },
    {
      "name": "deepseek",
      "provider": "openai-compatible",
      "model": "deepseek-reasoner",
      "apiKey": "$DEEPSEEK_API_KEY",
      "baseURL": "https://api.deepseek.com/v1"
    }
  ],
  "prompts": {
    "translate": "Translate to English: {{input}}",
    "explain": "Explain in simple terms: {{input}}"
  },
  "options": {
    "stream": true,
    "mode": "auto",
    "maxSteps": 25,
    "timeout": 120
  }
}

Options

Runtime options can be set globally or per-profile. Profile options override global options.

| Option | Type | Default | Description | | ---------- | ------- | ------- | ------------------------------------ | | stream | boolean | true | Enable streaming output in TTY mode | | think | boolean | false | Enable thinking mode | | mode | string | auto | auto (agent) or chat (pure text) | | maxSteps | integer | 25 | Max command execution steps | | timeout | integer | 120 | Command timeout in seconds | | pipe | object | - | Pipe mode settings (stream, color) |

Example with profile-specific options:

{
  "profiles": [
    {
      "name": "claude-think",
      "provider": "anthropic",
      "model": "claude-opus-4-5",
      "apiKey": "$ANTHROPIC_API_KEY",
      "options": {
        "think": true,
        "mode": "chat"
      },
      "headers": { "X-Custom-Auth": "token" },
      "providerOptions": {
        "thinking": { "type": "enabled", "budgetTokens": 20000 }
      }
    }
  ],
  "options": {
    "stream": true
  }
}

Provider Options

providerOptions accepts the same parameters as AI SDK's providerOptions. These are passed directly to the provider when calling the model.

Custom Headers

Use headers to add custom HTTP headers to API requests.

Environment Variables

Use $ENV_VAR syntax in apiKey and baseURL fields to reference environment variables:

{
  "apiKey": "$OPENAI_API_KEY",
  "baseURL": "$MY_CUSTOM_BASE_URL"
}

You can also use literal values directly:

{
  "apiKey": "sk-xxxx",
  "baseURL": "http://localhost:11434/v1"
}

Providers

| Provider | Description | | ------------------- | --------------------------- | | openai | OpenAI Responses API | | openai-compatible | OpenAI Chat Completions API | | anthropic | Anthropic Claude | | gemini | Google Gemini |

CLI Options

| Option | Short | Description | | ------------------ | ----- | ----------------------------------------- | | --interact | -i | Interactive mode | | --yes | -y | Autonomous mode (auto-confirm) | | --chat | | Chat mode (disable command execution) | | --prompt <name> | -p | Use predefined prompt | | --use <name> | -u | Use a specific profile | | --file <path> | -f | Input file (can use multiple times) | | --think | | Enable thinking mode | | --no-think | | Disable thinking mode | | --stream | | Force streaming output | | --no-stream | | Disable streaming output | | --max-steps <n> | | Max command execution steps (default: 25) | | --timeout <secs> | | Command timeout in seconds (default: 120) | | --config <path> | | Custom config file path | | --version | -v | Show version | | --help | -h | Show help |

Keyboard Shortcuts

| Key | Single-shot Mode | Interactive Mode | Command Confirm | | --------- | ---------------- | ------------------- | --------------- | | Ctrl+C | Exit | Exit | Exit | | ESC | Stop output | Stop current output | Cancel | | Y/Enter | - | - | Execute | | n | - | - | Skip | | a | - | - | Execute all | | c | - | - | Cancel |

In interactive mode, pressing ESC interrupts the current response but allows you to continue the conversation. Use Ctrl+C or type /exit to quit.

中文文档

查看中文 README

License

GPL-3.0