Skip to main content

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官网申请

Metadata

Release files for asst 2.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asst 2.1.1
File Size Uploaded Provenance Actions
asst-2.1.1.tar.gz 6.3 kB Without provenance Details for asst-2.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for asst 2.1.1
File Interpreter ABI Platform Actions
asst-2.1.1-py3-none-any.whl Python 3 none any Details for asst-2.1.1-py3-none-any.whl

Total release size: 13.5 kB

Release files / asst-2.1.1.tar.gz

Download URL asst-2.1.1.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4a0f758a0798b941a50d087b4fa7238fa96f1d3e1b470fa3f7415de3102c74a8
BLAKE2b-256 checksum
How to use checksums
d2f9f53ac8e4355931128b3c02b06205d29c40530b745f9ea9955288b867b851
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.13

Release files / asst-2.1.1-py3-none-any.whl

Download URL asst-2.1.1-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3fabe267beeed0fe92c22c2471de2e8913fb9ab3cfc7df2ed1c1314e5370efd7
BLAKE2b-256 checksum
How to use checksums
5ec30929e0aced86d7a50c43109dea17354946d3291347fbbfdde6430b79b93e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.13

Security for asst 2.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page