Pipe anything to AI from your terminal. Answer questions, summarize logs, explain errors — without leaving the command line.
Ever wished you could ask AI a question without opening a browser?
$ ai "How do I find large files in Linux?"
→ du -ah / | sort -rh | head -20
Here's how to build it in 15 lines.
The Script
#!/usr/bin/env python3
import sys, os
from openai import OpenAI
client = OpenAI(
api_key=os.getenv("AIBRIDGE_KEY"),
base_url="https://aibridge-api.com/v1"
)
prompt = " ".join(sys.argv[1:]) or sys.stdin.read()
response = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[{"role": "user", "content": prompt}],
stream=True
)
for chunk in response:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")
Usage
#Ask questions
$ ai "explain this error: SyntaxError: invalid syntax"
#Summarize logs
$ cat error.log | ai "summarize these errors"
#Generate code
$ ai "write a bash script to backup my home directory"
#Explain code
$ cat app.py | ai "what does this file do?"
Install
#1. Save the script
curl -o /usr/local/bin/ai https://paste.example.com/ai.py
#2. Make it executable
chmod +x /usr/local/bin/ai
#3. Set your API key
export AIBRIDGE_KEY="mb-your-key"
#4. Get key (free) → aibridge-api.com




Top comments (0)