This CLI tool allows you to easily chat with chatGPT in the command line. You can chat with it, ask questions, and even translate text. It also
Project description
AI Tools for chatGPT
This CLI tool allows you to easily use chatGPT in the command line. You can chat with it, ask it questions, and use it to translate text. It also supports rendering Markdown in the terminal.
Dependencies
- OPENAI_API_BASE (optional)
If you are unable to access https://api.openai.com
because of the GFW, you can specify a different API address using the OPENAI_API_BASE
environment variable. We
recommend using this method, as it is more stable than using a proxy. You can find instructions for using Cloudflare Workers to set up a proxy at
(https://github.com/noobnooc/noobnooc/discussions/9).
- OPENAI_API_KEY
You can set the OPENAI_API_KEY
environment variable, or specify it using the --api-key
argument. You can also set it using the ai setting
command.
Installation
pip install py-ai-cli
or install the latest version:
pip install git+https://github.com/yufeikang/ai-cli.git
Configuration
You can now use the ai setting
command to set the API key and API base. Environment variables and command-line arguments also work.
# view settings
ai setting
# set
ai setting -e
Usage
Use ai -h
to view all the supported commands.
- Generate commit messages
ai commit
- Ask a question
ai ask "你好"
# no stream mode
ai --no-stream ask "你好"
# help
ai ask --help
# use pre prompt
curl -s https://raw.githubusercontent.com/yufeikang/ai-cli/main/README.md | ai ask --prompt "summary this, how to install"
- Translate
ai translate "你好"
ai translate "你好" -t japanese
ai translate -t english -f "file.txt"
echo "你好" | ai translate -t english
cat "file.txt" | ai translate -t english
- Chat
ai chat
- Code review
ai review
ai review -t develop
ai review -t HEAD~1
Proxy Support
OPENAI_API_BASE Using a forward proxy is more stable, we recommend using it.
Supports the HTTP_PROXY
and HTTPS_PROXY
or ALL_PROXY
environment variables. You can also specify a proxy using the --proxy
parameter.
For example:
export HTTP_PROXY=http://x.x.x.x:xxxx
# or
export HTTPS_PROXY=https://x.x.x.x:xxxx
Also supports SOCKS5 proxies, for example:
export ALL_PROXY=socks5://x.x.x.x:xxxx
SOCKS5 proxies require pip install pysocks
Additional Information
Please use ai --help
to view more commands.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for py_ai_cli-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57b771ee41a34e5aa8c4211ba4046849b86e1265794a3e9d7acba9b121201aee |
|
MD5 | 6684953e1744066616a67d4ae661bb9c |
|
BLAKE2b-256 | 6a0dbff27c5e27d0daa133309aafc5f6749bc741e5b5b13014ea80c020b687a3 |