A fast, minimal command-line client for the OpenAI Responses API, written in Rust.
- Direct prompts -- inline text, files, stdin, or
$EDITOR - Interactive REPL -- multi-turn conversations with history
- Streaming -- tokens print as they arrive
- JSON mode -- machine-readable output with
--json/-j - Clipboard -- copy responses with
--copy/-c - Retry logic -- automatic exponential backoff on rate limits and server errors
- Reasoning effort --
--reasoning/-rfor reasoning models (o3, o4-mini) - Web search -- enabled by default; the model searches when helpful, disable with
--no-web - System prompt --
--system/-sto override default instructions per request - Structured logging --
--verbose/-vorRUST_LOG=debugfor tracing output - Single binary -- no runtime dependencies
brew install Skyline-9/tap/openai-cli| Platform | Architecture | Download |
|---|---|---|
| macOS | Apple Silicon (arm64) | openai-darwin-arm64 |
| Linux | x86-64 | openai-linux-amd64 |
| Windows | x86-64 | openai-windows-amd64.exe |
# macOS
curl -Lo openai https://github.com/Skyline-9/openai-cli/releases/download/v0.3.1/openai-darwin-arm64
chmod +x openai && mv openai ~/.local/bin/
# Linux
curl -Lo openai https://github.com/Skyline-9/openai-cli/releases/download/v0.3.1/openai-linux-amd64
chmod +x openai && mv openai ~/.local/bin/git clone https://github.com/Skyline-9/openai-cli.git
cd openai-cli
cargo build --release
ln -sf "$(pwd)/target/release/openai" ~/.local/bin/openaiRequires Rust 1.80+ and an OpenAI API key.
export OPENAI_API_KEY="sk-..."openai ask -p "Explain quicksort in one sentence"openai complete --file prompt.txt
# or
openai complete -p @prompt.txtopenai ask -p @- <<'PROMPT'
Explain quicksort in one sentence,
and then give a one-line pseudocode summary.
PROMPTopenai ask --editoropenai chatUsage: openai [OPTIONS] <COMMAND>
Commands:
complete Send a prompt and get a completion [aliases: ask]
repl Start interactive REPL with conversation history [aliases: chat]
Options:
-m, --model <MODEL> OpenAI model to use [default: gpt-5.2]
-k, --max-tokens <MAX_TOKENS> Maximum number of tokens in the response [default: 16384]
--temperature <TEMPERATURE> Temperature for response generation [default: 0.23]
-t, --token <TOKEN> OpenAI API token (overrides OPENAI_API_KEY)
-j, --json Output raw JSON instead of streaming text
-r, --reasoning <EFFORT> Reasoning effort: low, medium, high (for o3/o4-mini)
-s, --system <PROMPT> System prompt / instructions (overrides default)
--no-web Disable web search (enabled by default)
-v, --verbose Enable verbose/debug logging
-h, --help Print help
-V, --version Print version
-p > positional arg > --file > --editor > stdin (pipe)
# Different model
openai -m gpt-4o ask -p "Hello"
# High creativity
openai --temperature 0.9 ask -p "Write a haiku about Rust"
# JSON output piped to jq
openai -j ask -p "What is 2+2?" | jq .text
# Copy response to clipboard
openai ask -c -p "Draft a commit message for this diff"
# Custom system prompt
openai -s "You are a Python expert. Reply with code only." ask -p "fizzbuzz"
# Reasoning model with high effort
openai -m o4-mini -r high ask -p "Prove that sqrt(2) is irrational"
# Debug logging
openai -v ask -p "test"| Environment Variable | Description | Default |
|---|---|---|
OPENAI_API_KEY |
API key (required) | -- |
OPENAI_API_URL |
Override the API endpoint | https://api.openai.com/v1/responses |
RUST_LOG |
Logging filter (e.g. debug) |
warn |
EDITOR / VISUAL |
Editor for --editor flag |
vi |
The project uses a GitHub Actions workflow that runs cargo fmt --check, cargo clippy, and cargo test on every push.