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 the AI or ask it questions. It can also translate texts for you, and supports rendering Markdown in the terminal.
Dependencies
- OPENAI_API_BASE (optional)
If you are unable to access https://api.openai.com
due to the GFW, you can specify a different API address with the OPENAI_API_BASE
environment variable. We recommend using this method as it is more
stable than using a proxy.
You can refer to this article for instructions on how to use Cloudflare workers to build an OpenAI API proxy: Build an OpenAI API Proxy with Cloudflare
Workers.
- OPENAI_API_KEY
You can set the environment variable OPENAI_API_KEY
, or specify it through the --api-key
parameter. You can also set it through 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
Now you can set the API key and API base with the ai setting
command. Environment variables and CLI arguments are still valid.
# View settings
ai setting
# Set
ai setting -e
Usage
Ask a question
ai ask "Hello"
# no stream mode
ai --no-stream ask "Hello"
# help
ai ask --help
Translation
ai translate "Hello"
ai translate "Hello" -t japanese
ai translate -t english -f "file.txt"
echo "Hello" | 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 Forward proxy is more stable and recommended.
Support the HTTP_PROXY
and HTTPS_PROXY
or ALL_PROXY
environment variables. You can also specify a proxy with the --proxy
parameter.
For example:
export HTTP_PROXY=http://x.x.x.x:xxxx
# or
export HTTPS_PROXY=https://x.x.x.x:xxxx
SOCKS5 proxies are also supported, 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.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7387b93e02c217b5bfeeb0b1e9f72a8065c6275861851e99f5329cd3192f8b4 |
|
MD5 | 6e345031b5dcee5d5f46c69266eae1e1 |
|
BLAKE2b-256 | 7f2fca3b0e1dea67a9255df74611b99391f19c30921aab9ab7ba1bceb078dbb8 |