{"id":34921031,"url":"https://github.com/electerious/heyi","last_synced_at":"2026-05-15T16:06:26.578Z","repository":{"id":329300918,"uuid":"1119006368","full_name":"electerious/heyi","owner":"electerious","description":"Execute AI prompts directly from your terminal.","archived":false,"fork":false,"pushed_at":"2026-03-27T15:36:19.000Z","size":234,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-28T00:51:45.504Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/electerious.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"electerious","custom":["https://paypal.me/electerious","https://www.buymeacoffee.com/electerious"]}},"created_at":"2025-12-18T15:46:44.000Z","updated_at":"2026-03-27T15:36:42.000Z","dependencies_parsed_at":"2025-12-21T20:02:36.864Z","dependency_job_id":null,"html_url":"https://github.com/electerious/heyi","commit_stats":null,"previous_names":["electerious/heyi"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/electerious/heyi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electerious%2Fheyi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electerious%2Fheyi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electerious%2Fheyi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electerious%2Fheyi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/electerious","download_url":"https://codeload.github.com/electerious/heyi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electerious%2Fheyi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33071615,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-26T13:39:10.733Z","updated_at":"2026-05-15T16:06:26.572Z","avatar_url":"https://github.com/electerious.png","language":"JavaScript","funding_links":["https://github.com/sponsors/electerious","https://paypal.me/electerious","https://www.buymeacoffee.com/electerious"],"categories":[],"sub_categories":[],"readme":"# heyi\n\n\u003e CLI tool to execute AI prompts with flexible output formatting\n\nExecute AI prompts directly from your terminal with support for multiple models and structured output formats using OpenRouter and the Vercel AI SDK.\n\n## Install\n\n```sh\nnpm install heyi -g\n```\n\n## Usage\n\n### CLI\n\n```sh\nheyi prompt [prompt] [options]\nheyi preset [file] [options]\n```\n\n#### Options\n\n- `-m, --model \u003cmodel\u003e` - AI model to use (default: `openai/gpt-4o-mini`)\n- `-f, --format \u003cformat\u003e` - Output format: `string`, `number`, `object`, `array` (default: `string`)\n- `-s, --schema \u003cschema\u003e` - Zod schema for object/array format (required when format is `object` or `array`)\n- `-c, --crawler \u003ccrawler\u003e` - Crawler to use for fetching URLs: `fetch`, `chrome` (default: `fetch`)\n- `--file \u003cpath\u003e` - Read content from file and include as context (can be used multiple times)\n- `--url \u003curl\u003e` - Fetch content from URL and include as context (can be used multiple times)\n- `--var \u003ckey=value\u003e` - Define variables for replacement in prompt using `{{key}}` syntax (can be used multiple times)\n- `-h, --help` - Display help information\n- `-V, --version` - Display version number\n\n#### Environment Variables\n\n- `HEYI_API_KEY` - OpenRouter API key (required, can be set via environment or `.env` file)\n- `HEYI_MODEL` - Default AI model to use (optional, can be overridden with `--model` flag)\n- `HEYI_CRAWLER` - Default crawler to use for fetching URLs (optional, can be overridden with `--crawler` flag)\n\n### Examples\n\n```sh\n# Simple text prompt\nheyi prompt \"What is the capital of France?\"\n\n# Use a different model\nheyi prompt \"Explain quantum computing\" --model google/gemini-2.0-flash-exp\n\n# Get structured output as array of strings\nheyi prompt \"List 5 programming languages\" --format array --schema \"z.string()\"\n\n# Get structured output as array of objects\nheyi prompt \"List 3 countries with their capitals\" --format array --schema \"z.object({name:z.string(),capital:z.string()})\"\n\n# Get structured output as single object\nheyi prompt \"Analyze: revenue 100k, costs 60k\" --format object --schema \"z.object({revenue:z.number(),costs:z.number()})\"\n\n# Complex nested schema\nheyi prompt \"Analyze top 3 tech companies\" --format array --schema \"z.object({name:z.string(),founded:z.number(),products:z.array(z.string())})\"\n\n# Variable replacement in prompts\nheyi prompt \"Translate to {{language}}\" --var language=\"German\"\nheyi prompt \"Translate {{input}} to {{output}}\" --var input=\"German\" --var output=\"English\"\n\n# Interactive variable prompting (prompts for undefined variables)\nheyi prompt \"Translate {{text}} to {{language}}\"\n# Will interactively prompt: text: [user enters value]\n#                            language: [user enters value]\n\n# Variable with description (shows custom prompt text)\nheyi prompt \"Explain {{topic description='What to explain'}} in simple terms\"\n# Will interactively prompt: What to explain (topic): [user enters value]\n\n# Variable replacement with stdin\necho \"Translate to {{language}}\" | heyi prompt --var language=\"Spanish\"\n\n# Set default model via environment variable\nHEYI_MODEL=perplexity/sonar heyi prompt \"Explain AI\"\n\n# Set API key via environment variable\nHEYI_API_KEY=your-key heyi prompt \"Hello, AI!\"\n\n# Input from file as context\nheyi prompt \"Summarize this content\" --file input.txt\n\n# Input from multiple files as context\nheyi prompt \"Compare these files\" --file file1.txt --file file2.txt\nheyi prompt \"Analyze all these documents\" --file doc1.md --file doc2.md --file doc3.md\n\n# Input from URL as context\nheyi prompt \"Summarize this article\" --url https://example.com/article.html\n\n# Input from multiple URLs as context\nheyi prompt \"Compare these articles\" --url https://example.com/article1.html --url https://example.com/article2.html\n\n# Use Chrome crawler for JavaScript-heavy pages\nheyi prompt \"Summarize this SPA\" --url https://example.com/spa --crawler chrome\nHEYI_CRAWLER=chrome heyi prompt \"Get content from dynamic page\" --url https://example.com/dynamic\n\n# Mix files and URLs as context\nheyi prompt \"Compare local and remote content\" --file local.txt --url https://example.com/remote.txt\n\n# Input from stdin\ncat article.md | heyi prompt \"Extract all URLs mentioned\"\necho \"Analyze this text\" | heyi prompt\n\n# Preset files\nheyi preset file.json\nheyi preset file.json --var language=german\nheyi preset file.json --model openai/gpt-4o\nheyi preset file.json --file additional.txt --url https://example.com\n```\n\n## Preset Files\n\nPreset files allow you to define reusable configurations with prompts, models, files, and URLs. Create a JSON file with the following structure:\n\n```json\n{\n  \"prompt\": \"Your prompt with {{variables}}\",\n  \"model\": \"openai/gpt-4o-mini\",\n  \"format\": \"array\",\n  \"schema\": \"z.string()\",\n  \"crawler\": \"fetch\",\n  \"files\": [\"path/to/file1.txt\", \"path/to/file2.txt\"],\n  \"urls\": [\"https://example.com/page.html\"]\n}\n```\n\n### Preset Configuration\n\n- **prompt**: The AI prompt to execute. Supports variable replacement using `{{variable}}` syntax.\n- **model** (optional): AI model to use (e.g., `openai/gpt-4o-mini`, `google/gemini-2.0-flash-exp`).\n- **format** (optional): Output format: `string`, `number`, `object`, `array` (default: `string`).\n- **schema** (optional): Zod schema for object/array format (required when format is `object` or `array`).\n- **crawler** (optional): Crawler to use for fetching URLs: `fetch`, `chrome` (default: `fetch`).\n- **files** (optional): Array of file paths to include as context.\n- **urls** (optional): Array of URLs to fetch and include as context.\n\n### Preset Examples\n\n**Basic preset with variables:**\n\n```json\n{\n  \"prompt\": \"Explain {{topic}} in {{language}}\"\n}\n```\n\n```sh\nheyi preset explain.json --var topic=\"quantum computing\" --var language=\"simple terms\"\n```\n\n**Preset with files and URLs:**\n\n```json\n{\n  \"prompt\": \"Analyze and compare the following documents\",\n  \"model\": \"google/gemini-2.0-flash-exp\",\n  \"files\": [\"report1.txt\", \"report2.txt\"],\n  \"urls\": [\"https://example.com/data.html\"]\n}\n```\n\n```sh\nheyi preset analyze.json\n```\n\n**Preset with structured output:**\n\n```json\n{\n  \"prompt\": \"List programming languages mentioned in these files\",\n  \"format\": \"array\",\n  \"schema\": \"z.string()\",\n  \"files\": [\"code1.js\", \"code2.py\"]\n}\n```\n\n```sh\nheyi preset languages.json\n```\n\n### CLI Override Behavior\n\n- **Model override**: Using `--model` flag overrides the model specified in the preset file.\n- **Format override**: Using `--format` flag overrides the format specified in the preset file.\n- **Schema override**: Using `--schema` flag overrides the schema specified in the preset file.\n- **Crawler override**: Using `--crawler` flag overrides the crawler specified in the preset file.\n- **Files and URLs append**: Using `--file` or `--url` flags adds additional context to the preset's files and URLs.\n- **Variables**: Use `--var` to replace variables in the preset's prompt.\n\n```sh\n# Override model from preset\nheyi preset file.json --model openai/gpt-4o\n\n# Override format from preset\nheyi preset file.json --format object --schema \"z.object({name:z.string()})\"\n\n# Override crawler from preset\nheyi preset file.json --crawler chrome\n\n# Add additional files to preset's files\nheyi preset file.json --file extra.txt\n\n# Replace variables in preset prompt\nheyi preset file.json --var name=\"Alice\" --var role=\"developer\"\n```\n\n## Output Formats\n\n- **string** (default): Plain text response from the AI model\n- **number**: Numeric response from the AI model\n- **object**: Single JSON object with structured data (requires `--schema` flag)\n- **array**: JSON array with structured data (requires `--schema` flag)\n\nThe 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.\n\n### Schema Examples\n\n- String array: `--format array --schema \"z.string()\"`\n- URL array: `--format array --schema \"z.url()\"` (not supported by all models)\n- Object array: `--format array --schema \"z.object({name:z.string(),age:z.number()})\"`\n- Single object: `--format object --schema \"z.object({total:z.number(),items:z.array(z.string())})\"`\n\n## Variables\n\nThe tool supports variable replacement in prompts using `{{variable}}` syntax. Variables can be provided via the `--var` flag or through interactive prompting.\n\n### Variable Syntax\n\n**Basic variable:**\n\n```\n{{variableName}}\n```\n\n**Variable with description (for interactive prompting):**\n\n```\n{{variableName description=\"Description shown to user\"}}\n```\n\n### Variable Behavior\n\n1. **Provided via --var flag**: Variables are directly replaced with the provided values\n2. **Not provided**: The tool will interactively prompt the user to enter the value\n3. **With description**: When prompting, the description is shown to help the user understand what to enter\n\n### Variable Examples\n\n```sh\n# Provide variables via flag\nheyi prompt \"Translate {{text}} to {{language}}\" --var text=\"Hello\" --var language=\"Spanish\"\n\n# Interactive prompting for undefined variables\nheyi prompt \"Translate {{text}} to {{language}}\"\n# Prompts:\n#   text: [user enters value]\n#   language: [user enters value]\n\n# Mix provided and interactive variables\nheyi prompt \"Translate {{text}} to {{language}}\" --var language=\"French\"\n# Only prompts for 'text' since 'language' is provided\n\n# Use descriptions for better user experience\nheyi prompt \"Explain {{topic description='Enter a topic to explain'}} in simple terms\"\n# Prompts:\n#   Enter a topic to explain (topic): [user enters value]\n\n# Variables work in preset files too\nheyi preset translate.json\n# Prompts for any undefined variables in the preset's prompt\n```\n\n## Crawlers\n\nThe tool supports two crawlers for fetching content from URLs:\n\n- **fetch** (default): Uses the native `fetch` API to retrieve HTML content. Fast and lightweight, but may not work well with JavaScript-heavy or dynamically rendered pages.\n- **chrome**: Uses Puppeteer to launch a headless Chrome browser and retrieve content after the page has fully loaded. Ideal for single-page applications (SPAs) and JavaScript-heavy websites, but slower and requires more resources.\n\n### When to Use Chrome Crawler\n\nUse the `chrome` crawler when:\n\n- The target website relies heavily on JavaScript for rendering content\n- Content is loaded dynamically after the initial page load\n- You need to interact with a single-page application (SPA)\n- The `fetch` crawler returns incomplete or missing content\n\n### Crawler Examples\n\n```sh\n# Use default fetch crawler\nheyi prompt \"Summarize this page\" --url https://example.com\n\n# Use Chrome crawler for JS-heavy page\nheyi prompt \"Extract data from SPA\" --url https://app.example.com --crawler chrome\n\n# Set Chrome as default crawler via environment\nHEYI_CRAWLER=chrome heyi prompt \"Get content\" --url https://dynamic-site.com\n```\n\n## Development\n\n```sh\n# Install dependencies\nnpm install\n\n# Run tests\nnpm test\n\n# Lint and format code\nnpm run format\n\n# Run the CLI in development\nnpm start -- prompt \"Your prompt here\"\n\n# Or run directly\n./bin/index.js prompt \"Your prompt here\"\n```\n\n## Related\n\n- [Vercel AI SDK](https://sdk.vercel.ai/) - Toolkit for building AI applications\n- [OpenRouter](https://openrouter.ai/) - Unified API for LLMs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felecterious%2Fheyi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felecterious%2Fheyi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felecterious%2Fheyi/lists"}