分享几个免费无限制的gpt3.5 api使用方式
前段时间,chatgpt3.5直接像搜索引擎一样免注册使用,随后meta.ai等也纷纷效仿,人类能免费用到ai人工智能的时代到了,那么既然chatgpt3.5都免注册使用了,那么gpt3.5的key还免费吗? 目前官方还是收费的,不过新用户注册还是有18美元的额度的,用完就要充值了。不过现在不用担心了,有大牛直接逆向破解的免费的gpt3.5网页版,将他做成了免费的gpt api接口,今天介绍2款:
FreeGPT35
支持api调用和webui直接使用,支持docker运行:
docker run -p 3040:3040 ghcr.io/missuo/freegpt35源码地址:https://github.com/missuo/FreeGPT35
ChatGPT
这个也是支持api和webui使用,api兼容openai,也就是说你之前的业务代码不用修改,只要换一个url就行了。
docker run -dp 3040:3040 pawanosman/chatgpt:latest
import openai openai.api_key = 'anything' openai.base_url = "http://localhost:3040/v1/" completion = openai.chat.completions.create( model="gpt-3.5-turbo", messages=[ {"role": "user", "content": "How do I list all files in a directory using Python?"}, ], ) print(completion.choices[0].message.content)地址:https://github.com/PawanOsman/ChatGPT
这个还自己搭建了服务器,你只要申请他的key也能免费调用chatgpt,步骤如下:
1、加入discord,打开网址https://discord.pawan.krd/
2、选择bot频道
3、输入/key 获取key
4、更换代码如下
python
import openai openai.api_key = 'bot给你的key' openai.base_url = "https://api.pawan.krd/v1/chat/completions" completion = openai.chat.completions.create( model="pai-001", messages=[ {"role": "user", "content": "How do I list all files in a directory using Python?"}, ], ) print(completion.choices[0].message.content)php
<?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://api.pawan.krd/v1/chat/completions"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $_postobj = array("model" => "pai-001", "messages" => array(["role" => "user", "content" => "你好"]) ); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($_postobj, JSON_UNESCAPED_UNICODE)); curl_setopt($ch, CURLOPT_POST, 1); // Set the API key as an HTTP header $headers = array(); $headers[] = "Content-Type: application/json"; $headers[] = "Authorization: Bearer key"; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // Send the request and parse the response $response = curl_exec($ch); echo $response; $response_data = json_decode($response, true); if (curl_errno($ch)) { // If there was an error executing the cURL request, print it out //echo 'Error: ' . curl_error($ch); echo curl_error($ch); curl_close($ch); } else { // Otherwise, print the response from the GPT-3 API curl_close($ch); // var_dump($response_data); echo $response_data['choices'][0]['message']['content']; // var_dump($response_data) ; } ?>
网友评论0