
Security News
npm Introduces minimumReleaseAge and Bulk OIDC Configuration
npm rolls out a package release cooldown and scalable trusted publishing updates as ecosystem adoption of install safeguards grows.
CLI tool to execute AI prompts with flexible output formatting
Execute AI prompts directly from your terminal with support for multiple models and structured output formats using OpenRouter and the Vercel AI SDK.
npm install heyi -g
heyi prompt [prompt] [options]
heyi preset [file] [options]
-m, --model <model> - AI model to use (default: openai/gpt-4o-mini)-f, --format <format> - Output format: string, number, object, array (default: string)-s, --schema <schema> - Zod schema for object/array format (required when format is object or array)-c, --crawler <crawler> - Crawler to use for fetching URLs: fetch, chrome (default: fetch)--file <path> - Read content from file and include as context (can be used multiple times)--url <url> - Fetch content from URL and include as context (can be used multiple times)--var <key=value> - Define variables for replacement in prompt using {{key}} syntax (can be used multiple times)-h, --help - Display help information-V, --version - Display version numberAPI_KEY - OpenRouter API key (required, can be set via environment or .env file)MODEL - Default AI model to use (optional, can be overridden with --model flag)CRAWLER - Default crawler to use for fetching URLs (optional, can be overridden with --crawler flag)# Simple text prompt
heyi prompt "What is the capital of France?"
# Use a different model
heyi prompt "Explain quantum computing" --model google/gemini-2.0-flash-exp
# Get structured output as array of strings
heyi prompt "List 5 programming languages" --format array --schema "z.string()"
# Get structured output as array of objects
heyi prompt "List 3 countries with their capitals" --format array --schema "z.object({name:z.string(),capital:z.string()})"
# Get structured output as single object
heyi prompt "Analyze: revenue 100k, costs 60k" --format object --schema "z.object({revenue:z.number(),costs:z.number()})"
# Complex nested schema
heyi prompt "Analyze top 3 tech companies" --format array --schema "z.object({name:z.string(),founded:z.number(),products:z.array(z.string())})"
# Variable replacement in prompts
heyi prompt "Preset in {{language}}" --var language="German"
heyi prompt "Preset in {{input}} and output in {{output}}" --var input="German" --var output="English"
# Variable replacement with stdin
echo "Translate to {{language}}" | heyi prompt --var language="Spanish"
# Set default model via environment variable
MODEL=perplexity/sonar heyi prompt "Explain AI"
# Set API key via environment variable
API_KEY=your-key heyi prompt "Hello, AI!"
# Input from file as context
heyi prompt "Summarize this content" --file input.txt
# Input from multiple files as context
heyi prompt "Compare these files" --file file1.txt --file file2.txt
heyi prompt "Analyze all these documents" --file doc1.md --file doc2.md --file doc3.md
# Input from URL as context
heyi prompt "Summarize this article" --url https://example.com/article.html
# Input from multiple URLs as context
heyi prompt "Compare these articles" --url https://example.com/article1.html --url https://example.com/article2.html
# Use Chrome crawler for JavaScript-heavy pages
heyi prompt "Summarize this SPA" --url https://example.com/spa --crawler chrome
CRAWLER=chrome heyi prompt "Get content from dynamic page" --url https://example.com/dynamic
# Mix files and URLs as context
heyi prompt "Compare local and remote content" --file local.txt --url https://example.com/remote.txt
# Input from stdin
cat article.md | heyi prompt "Extract all URLs mentioned"
echo "Analyze this text" | heyi prompt
# Preset files
heyi preset file.json
heyi preset file.json --var language=german
heyi preset file.json --model openai/gpt-4o
heyi preset file.json --file additional.txt --url https://example.com
Preset files allow you to define reusable configurations with prompts, models, files, and URLs. Create a JSON file with the following structure:
{
"prompt": "Your prompt with {{variables}}",
"model": "openai/gpt-4o-mini",
"format": "array",
"schema": "z.string()",
"crawler": "fetch",
"files": ["path/to/file1.txt", "path/to/file2.txt"],
"urls": ["https://example.com/page.html"]
}
{{variable}} syntax.openai/gpt-4o-mini, google/gemini-2.0-flash-exp).string, number, object, array (default: string).object or array).fetch, chrome (default: fetch).Basic preset with variables:
{
"prompt": "Explain {{topic}} in {{language}}"
}
heyi preset explain.json --var topic="quantum computing" --var language="simple terms"
Preset with files and URLs:
{
"prompt": "Analyze and compare the following documents",
"model": "google/gemini-2.0-flash-exp",
"files": ["report1.txt", "report2.txt"],
"urls": ["https://example.com/data.html"]
}
heyi preset analyze.json
Preset with structured output:
{
"prompt": "List programming languages mentioned in these files",
"format": "array",
"schema": "z.string()",
"files": ["code1.js", "code2.py"]
}
heyi preset languages.json
--model flag overrides the model specified in the preset file.--format flag overrides the format specified in the preset file.--schema flag overrides the schema specified in the preset file.--crawler flag overrides the crawler specified in the preset file.--file or --url flags adds additional context to the preset's files and URLs.--var to replace variables in the preset's prompt.# Override model from preset
heyi preset file.json --model openai/gpt-4o
# Override format from preset
heyi preset file.json --format object --schema "z.object({name:z.string()})"
# Override crawler from preset
heyi preset file.json --crawler chrome
# Add additional files to preset's files
heyi preset file.json --file extra.txt
# Replace variables in preset prompt
heyi preset file.json --var name="Alice" --var role="developer"
--schema flag)--schema flag)The tool uses Zod schemas to ensure the AI model returns data in the requested format. When using object or array formats, you must provide a Zod schema string via the --schema flag.
--format array --schema "z.string()"--format array --schema "z.url()" (not supported by all models)--format array --schema "z.object({name:z.string(),age:z.number()})"--format object --schema "z.object({total:z.number(),items:z.array(z.string())})"The tool supports two crawlers for fetching content from URLs:
fetch API to retrieve HTML content. Fast and lightweight, but may not work well with JavaScript-heavy or dynamically rendered pages.Use the chrome crawler when:
fetch crawler returns incomplete or missing content# Use default fetch crawler
heyi prompt "Summarize this page" --url https://example.com
# Use Chrome crawler for JS-heavy page
heyi prompt "Extract data from SPA" --url https://app.example.com --crawler chrome
# Set Chrome as default crawler via environment
CRAWLER=chrome heyi prompt "Get content" --url https://dynamic-site.com
# Install dependencies
npm install
# Run tests
npm test
# Lint and format code
npm run format
# Run the CLI in development
npm start -- prompt "Your prompt here"
# Or run directly
./bin/index.js prompt "Your prompt here"
FAQs
CLI tool to execute AI prompts with flexible output formatting
The npm package heyi receives a total of 4 weekly downloads. As such, heyi popularity was classified as not popular.
We found that heyi demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
npm rolls out a package release cooldown and scalable trusted publishing updates as ecosystem adoption of install safeguards grows.

Security News
AI agents are writing more code than ever, and that's creating new supply chain risks. Feross joins the Risky Business Podcast to break down what that means for open source security.

Research
/Security News
Socket uncovered four malicious NuGet packages targeting ASP.NET apps, using a typosquatted dropper and localhost proxy to steal Identity data and backdoor apps.