fgpt
v.0.1.7
API 키를 등록하거나 사용료를 지불할 필요 없이 GPT-3.5 API를 사용할 수 있습니다.
? OpenAI GPT-3.5-turbo는 계정이나 API 키 없이 무료로 사용할 수 있습니다.
? 프로덕션 환경에서는 사용하지 말고 개인적인 사용/테스트용으로만 사용하세요.
cargo install fgpt
# To get answers from GPT-3.5
fgpt " How to get a domain's MX record on linux shell? "
# Output plain code -c/--code
fgpt -c " Write python code to reverse a string "
# With pipe
cat README.md | fgpt " summarize for reddit post "
# With stdin
fgpt " Convert the follow csv data to json, without any description " < contacts.csv
# With file -f/--file
fgpt -f contacts.csv " Convert the follow csv data to json, without any description "
# REPL mode
fgpt
>> Write a javascript code to reverse a string
...
연결할 수 없는 경우 프록시를 사용해 볼 수 있습니다. HTTP 및 SOCKS5 프록시가 지원됩니다. 예를 들어:
# 1. pass the proxy address by -p/--proxy
fgpt -p ' socks5://127.0.0.1:9080 ' " Linux command to list files in a directory "
# 2. pass the proxy address by environment variable
export HTTPS_PROXY= ' socks5://127.0.0.1:9080 '
fgpt " Linux command to list files in a directory "
# 3. use alias to set the proxy address
alias fgpt= ' fgpt -p "socks5://127.0.0.1:9080" '
fgpt " Linux command to list files in a directory "
fgpt --stats " Linux command to list files in a directory "
docker run -it --rm shenjinti/fgpt " Linux command to list files in a directory "
ChatGPT에 대한 무료 자체 호스팅 API 액세스를 제공합니다. API 키를 등록할 필요 없이 OpenAI API를 사용하려는 경우에 유용합니다.
fgpt -s 127.0.0.1:4090
이제 로컬 서버가 실행되고 http://127.0.0.1:4090/v1/chat/completions
에서 액세스할 수 있습니다.
import openai
import sys
openai . api_key = 'nothing'
openai . base_url = "http://127.0.0.1:4090/v1/"
completion = openai . chat . completions . create (
model = "gpt-3.5-turbo" ,
messages = [
{ "role" : "user" , "content" : "Write a javascript simple code" },
],
stream = True ,
)
for chunk in completion :
print ( chunk . choices [ 0 ]. delta . content , end = '' )
sys . stdout . flush ()
print ()
또는 컬로 테스트하십시오.
curl -X POST -H " Content-Type: application/json " -d ' {"model":"gpt-3.5-turbo",
"messages":[{"role":"user","content":"Write a javascript simple code"}],
"stream":true} '
http://127.0.0.1:4090/v1/chat/completions
curl -X POST -H " Content-Type: application/json " -d ' {"model":"gpt-3.5-turbo",
"messages":[{"role":"user","content":"Write a javascript simple code"}]} '
http://127.0.0.1:4090/v1/chat/completions