ask  by kagisearch

AI CLI tool for querying models via OpenRouter API

Created 4 months ago
267 stars

Top 96.1% on SourcePulse

GitHubView on GitHub
Project Summary

A lightweight bash script, ask, enables querying AI models through the OpenRouter API directly from the command line. It is optimized for generating executable output, making it a valuable tool for developers and power users seeking to integrate AI assistance into their shell workflows for tasks like command generation, code snippets, and quick technical answers.

How It Works

The project is a single bash script that leverages curl to interact with the OpenRouter API. It parses API responses using jq and performs calculations with bc for metrics. The core design prioritizes direct, executable output, allowing users to pipe AI-generated commands or code directly into other processes or execute them immediately. This approach offers a minimal footprint and seamless integration into existing command-line environments.

Quick Start & Requirements

Installation involves cloning the repository, making the script executable, and copying it to a directory in your system's PATH (e.g., /usr/local/bin/). Alternatively, an install script is provided.

  • Primary install/run command:
    git clone https://github.com/kagisearch/ask.git
    cd ask
    chmod +x ask
    sudo cp ask /usr/local/bin/
    
  • Non-default prerequisites:
    • Bash shell
    • curl
    • jq
    • bc
    • OpenRouter API key, set as the environment variable OPENROUTER_API_KEY.
  • Links:
    • Repository: https://github.com/kagisearch/ask.git
    • OpenRouter API Key: https://openrouter.ai/

Highlighted Details

  • Supports multiple AI models via shorthand flags (e.g., -c for Mercury Coder, -g for Gemini 2.5 Flash) and custom model names (-m).
  • Enables provider routing for fallback support and custom system prompts (--system) or disabling them (-r).
  • Features streaming output (--stream) for real-time responses.
  • Designed for seamless piping of input and output, facilitating command generation, code review, and complex task chaining.

Maintenance & Community

The provided README does not contain specific details regarding maintainers, community channels (like Discord or Slack), sponsorships, or a public roadmap.

Licensing & Compatibility

The project is released under the MIT License. This permissive license generally allows for commercial use and integration into closed-source projects without significant restrictions.

Limitations & Caveats

The script's functionality is dependent on the availability and performance of the OpenRouter API. Output quality and accuracy are subject to the chosen AI model and the user's prompt engineering. As a bash script, it may have limitations in handling highly complex error scenarios or user interfaces compared to more robust applications. Compatibility with non-Unix-like systems (e.g., Windows without WSL) is not explicitly detailed.

Health Check
Last Commit

2 months ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
4 stars in the last 30 days

Explore Similar Projects

Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Tobi Lutke Tobi Lutke(Cofounder of Shopify), and
33 more.

opencode by anomalyco

26.5%
60k
CLI tool for AI-assisted coding in the terminal
Created 8 months ago
Updated 10 hours ago
Feedback? Help us improve.