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 get answers. It can also help you translate text and supports markdown rendering in the terminal.
Dependencies
- OPENAI_API_BASE (optional)
If you cannot access https://api.openai.com
because of the GFW, you can specify another API address through the OPENAI_API_BASE
environment variable. It is recommended to use this method, which is more stable
than using a proxy. You can refer to this article on how to use Cloudflare Workers to set up an OpenAI API proxy: Using Cloudflare Workers build OpenAI API proxy
- OPENAI_API_KEY
You can set the OPENAI_API_KEY
environment variable 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
You can now set the API key and API base through the ai setting
command. Environment variables and CLI parameters are still valid.
# view setting
ai setting
# set
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
Using OPENAI_API_BASE for forward proxy is more stable, which is recommended.
Support HTTP_PROXY
and HTTPS_PROXY
or ALL_PROXY
environment variable. You can also specify a proxy through 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 proxy is also supported, for example:
export ALL_PROXY=socks5://x.x.x.x:xxxx
Socks5 proxy requires pip install pysocks
.
Supplement
Please use ai --help
to see 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.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bc5973d58cca2ac7c5254b36201f4d38f6e1d110ebef09f30067d9311775d11 |
|
MD5 | 0b76725f2539155224d5b0e350da7d90 |
|
BLAKE2b-256 | b0e66c6903a4e032fc5130bb918eb338dd1ceece24d59c55dc8aa99fa13eb1ad |