Skip to main content

ChatGPT shell command

Project description

ChatGPT-CLI

ChatGPT shell command Support gpt-4

ChatGPT 支持终端命令行啦,支持gpt-4

支持连续对话,在终端输入asst即可开启对话。

如让它写个feapder的爬虫,实际对答如下:

安装

pip install asst

环境变量

变量 必须 描述
OPENAI_API_KEY OpenAI的密钥
OPENAI_BASE_URL OpenAI的镜像接口地址,如:https://api.openai.com, 注意不需要携带 v1/chat/completions
OPENAI_PROXY 代理,如 username:password@ip:port
OPENAI_MODEL 模型, 支持 gpt-4-1106-preview、gpt-3.5-turbo等,默认为 gpt-4-1106-preview

配置

没有OPENAI_API_KEY,openai官网自己搞

设置OPENAI_API_KEY="chatgpt的密钥"到环境变量

mac或linux下 临时设置的方式

export OPENAI_API_KEY=your key

永久设置

vim ~/.bash_profile

# 在合适的位置添加环境变量
export OPENAI_API_KEY="your key"

window下设置为系统环境变量

参考:https://blog.csdn.net/xue_nuo/article/details/114793534

使用

> asst
You: hello
Bot: Hi there!

请求超时

国内用户因为墙的原因,无法直接访问chatgpt,需配置镜像api或使用代理

代理使用方式:

设置ASST_PROXY="代理"到环境变量

如:

export ASST_PROXY="username:password@ip:port"

境外代理举例

推荐:brightdata

不需要公司、不需要实名,准备好邮箱即可

地址:https://brightdata.grsm.io/r0g6zla8seqs

若提示认证,选择支付宝即可,并不需要真正的认证

充值支持支付宝

使用方式:

  1. 选择机房代理,因为便宜。追求稳定选择住宅

  2. 配置:

  3. 查看访问参数

  1. 配置代理

    设置ASST_PROXY="代理"到环境变量

    如:

    export ASST_PROXY="用户名:密码@主机"
    

OPENAI_API_KEY

在chatgpt官网申请

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asst-2.1.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

asst-2.1.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file asst-2.1.1.tar.gz.

File metadata

  • Download URL: asst-2.1.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for asst-2.1.1.tar.gz
Algorithm Hash digest
SHA256 4a0f758a0798b941a50d087b4fa7238fa96f1d3e1b470fa3f7415de3102c74a8
MD5 c9d4222ddabefccab67930e439c75bcc
BLAKE2b-256 d2f9f53ac8e4355931128b3c02b06205d29c40530b745f9ea9955288b867b851

See more details on using hashes here.

File details

Details for the file asst-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: asst-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for asst-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3fabe267beeed0fe92c22c2471de2e8913fb9ab3cfc7df2ed1c1314e5370efd7
MD5 9ab479e0b19b15f4258f976793ed84a6
BLAKE2b-256 5ec30929e0aced86d7a50c43109dea17354946d3291347fbbfdde6430b79b93e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page