3.7 KiB
Single-Shot Mode
One task. One result. Exit.
Interactive sessions are great for exploration. But sometimes you just need to run a command, get the output, and move on.
That's single-shot mode.
Basic Usage
claudish --model x-ai/grok-code-fast-1 "add input validation to the login form"
Claudish:
- Spins up a proxy
- Runs Claude Code with your prompt
- Prints the result
- Exits
No interaction. No model selector. Just results.
When to Use This
Scripts and automation:
#!/bin/bash
claudish --model minimax/minimax-m2 "generate unit tests for src/utils.ts"
Quick fixes:
claudish --model x-ai/grok-code-fast-1 "fix the typo in README.md"
Code reviews:
claudish --model openai/gpt-5.1-codex "review the changes in the last commit"
Batch operations:
for file in src/*.ts; do
claudish --model minimax/minimax-m2 "add JSDoc comments to $file"
done
Quiet by Default
Single-shot mode suppresses [claudish] logs automatically.
You only see the model's output. Clean.
Want the logs?
claudish --verbose --model x-ai/grok-code-fast-1 "your prompt"
JSON Output
Need structured data for tooling?
claudish --json --model minimax/minimax-m2 "list 5 common TypeScript patterns"
Output is valid JSON. Perfect for piping to jq or other tools.
Reading from Stdin
Got a massive prompt? Don't paste it in quotes. Pipe it:
echo "Review this code and suggest improvements" | claudish --stdin --model openai/gpt-5.1-codex
Real-world example - code review a diff:
git diff HEAD~1 | claudish --stdin --model openai/gpt-5.1-codex "Review these changes"
Review a whole file:
cat src/complex-module.ts | claudish --stdin --model google/gemini-3-pro-preview "Explain this code"
Combining Flags
# Quiet + JSON + stdin
git diff | claudish --stdin --json --quiet --model x-ai/grok-code-fast-1 "summarize changes"
This gives you:
- No log noise (
--quiet) - Structured output (
--json) - Input from pipe (
--stdin)
Dangerous Mode
Need full autonomy? No sandbox restrictions?
claudish --dangerous --model x-ai/grok-code-fast-1 "refactor the entire auth module"
This passes --dangerouslyDisableSandbox to Claude Code.
Use with caution. The model can do anything.
Exit Codes
0- Success1- Error (model failure, API issue, etc.)
Script it:
if claudish --model minimax/minimax-m2 "run tests"; then
echo "Tests passed"
else
echo "Something broke"
fi
Performance Tips
Use the right model for the task:
- Quick fixes →
minimax/minimax-m2($0.60/1M, fast) - Complex reasoning →
google/gemini-3-pro-preview(slower, smarter)
Set a default model:
export CLAUDISH_MODEL='minimax/minimax-m2'
claudish "quick fix" # Uses MiniMax by default
Skip network latency on repeated runs: The proxy stays warm for ~200ms after each request. Quick sequential calls benefit from this.
Examples
Generate a commit message:
git diff --staged | claudish --stdin --model x-ai/grok-code-fast-1 "write a commit message for these changes"
Explain an error:
npm run build 2>&1 | claudish --stdin --model openai/gpt-5.1-codex "explain this error and how to fix it"
Convert code:
cat legacy.js | claudish --stdin --model minimax/minimax-m2 "convert to TypeScript"
Document a function:
claudish --model x-ai/grok-code-fast-1 "add JSDoc to the processPayment function in src/payments.ts"
Next
- Automation Guide - CI/CD integration
- Interactive Mode - When you need back-and-forth