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 also have it translate text. It also supports markdown rendering in the terminal.
Dependencies
- OPENAI_API_BASE (Optional)
If you are unable to access https://api.openai.com
due to the Great Firewall of China, you can specify an alternative API address
via the OPENAI_API_BASE
environment variable. This is the recommended method as it is more stable compared to using proxies. You
can refer to this article on how to set up an OpenAI API proxy using Cloudflare workers: Using Cloudflare Workers to Setup a OpenAI
API Proxy
- OPENAI_API_KEY
You can set the OPENAI_API_KEY
environment variable, or use the --api-key
argument to specify it. You can also use the ai setting
command to set it.
Installation
pip install py-ai-cli
Or install the latest version
pip install git+https://github.com/yufeikang/ai-cli.git
Configuration
Now you can use the ai setting
command to set your API key and API base. Environmental variables and CLI arguments are still valid.
# show current setting
ai setting
# set it up
ai setting -e
Usage
Ask a question
ai ask "你好"
# no stream mode
ai --no-stream ask "你好"
# help
ai ask --help
Translation
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
Proxy Support
OPENAI_API_BASE with forwarding proxy is recommended.
It supports the HTTP_PROXY
and HTTPS_PROXY
, or ALL_PROXY
environment variables. You can also specify the proxy via the
--proxy
argument.
For example:
export HTTP_PROXY=http://x.x.x.x:xxxx
# or
export HTTPS_PROXY=https://x.x.x.x:xxxx
It also supports SOCKS5 proxies, for example:
export ALL_PROXY=socks5://x.x.x.x:xxxx
SOCKS5 proxies require an installation of pip install pysocks
.
Additional Information
Please refer to ai --help
for 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.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b3fed3a08be225de44b1b88c3976443e56725caaecd30b6c7450d1f1700c788 |
|
MD5 | 947cc9271a6d3e3a73fb6b0d7ebef2d9 |
|
BLAKE2b-256 | e5c22ec2ce5e5123105295279670141974dd505b3cd53fd03f482ec8544ae23d |