13861419 / gptcli

ChatGPT in command line with gpt-3.5-turbo api

Home Page:https://platform.openai.com/docs/introduction

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

stream

Take chatGPT into command line.

Setup

  1. clone this repo
  2. pip3 install -U -r requirements.txt
  3. get your apikey from https://platform.openai.com/account/api-keys and put it in .key

Run

$ ./gptcli.py -h
usage: gptcli.py [-h] [-r] [-k KEY] [-p PROXY]

options:
  -h, --help  show this help message and exit
  -s          query openai in stream mode (default: False)
  -r          attach server response in request prompt, consume more tokens to get better results (default: False)
  -k KEY      path to api_key (default: .key)
  -p PROXY    http/https proxy to use (default: None)

Console help:

$ gptcli.py 
Loading key from .key
Attach response in prompt: False
Input: help
options:
  <        input multiline
  reset    reset session, i.e. clear chat history
  help     show this help message
  exit     exit console

Example

demo

Feature

  • Session based
  • Markdown support
  • Syntax highlight
  • Proxy support
  • Multiline input
  • Stream output

NOTE: openai's library use aiohttp for stream mode request, and aiohttp only supports http/https proxy, not socks5. see: aio-libs/aiohttp#2539 The workaround is to use aiohttp_socks module for socks proxy in stream mode

LINK

About

ChatGPT in command line with gpt-3.5-turbo api

https://platform.openai.com/docs/introduction

License:GNU General Public License v2.0


Languages

Language:Python 100.0%