## ChatGPT `gpt-3.5-turbo` API for Free (as a Reverse Proxy)
Welcome to the ChatGPT API Free Reverse Proxy, offering free self-hosted API access to ChatGPT (`gpt-3.5-turbo`) with OpenAI's familiar structure, so no code changes are needed.
## Quick Links
- [Join our Discord Community](https://discord.pawan.krd) for support and questions.
- ⚡Note: Your Discord account must be at least 7 days old to be able join our Discord community.
## Table of Contents
- [Features](#features)
- Option 1: [Installing/Self-Hosting Guide](#installingself-hosting-guide) (Without using any API key)
- Method 1: [Using Docker](#using-docker) or [Run it with a Chat Web UI using docker-compose](./docker-compose)
- Method 2: [Your PC/Server](#your-pcserver) (manually)
- Method 3: [Termux on Android Phones](#termux-on-android-phones)
- Option 2: [Accessing Our Hosted API](#accessing-our-hosted-api) (Free)
- [Usage Examples](#usage-examples)
- [License](#license)
## Features
- **Streaming Response**: The API supports streaming response, so you can get the response as soon as it's available.
- **API Endpoint Compatibility**: Full alignment with official OpenAI API endpoints, ensuring hassle-free integration with existing OpenAI libraries.
- **Complimentary Access**: No charges for API usage, making advanced AI accessible to everyone even **without an API key**.
## Installing/Self-Hosting Guide
### Using Docker
1. Ensure Docker is installed by referring to the [Docker Installation Docs](https://docs.docker.com/engine/install/).
2. Run the following command:
```bash
docker run -dp 3040:3040 pawanosman/chatgpt:latest
```
3. Done! You can now connect to your local server's API at:
```
http://localhost:3040/v1/chat/completions
```
Note that the base URL is `http://localhost:3040/v1`.
### Install with chat web interfaces
✅ You can run third-party chat web interfaces, such as BetterChatGPT and LobeChat, with this API using Docker Compose. [Click here for the installation guide](./docker-compose).
### Your PC/Server
To install and run the ChatGPT API Reverse Proxy on your PC/Server by following these steps:
Note: This option is not available to all countries yet. if you are from a country that is not supported, you can use a **U.S. VPN** or use **our hosted API**.
1. Ensure NodeJs (v19+) is installed: [Download NodeJs](https://nodejs.org/en/download)
2. Clone this repository:
```bash
git clone https://github.com/PawanOsman/ChatGPT.git
```
3. Open `start.bat` (Windows) or `start.sh` (Linux with `bash start.sh` command) to install dependencies and launch the server.
4. Done, you can connect to your local server's API at:
```
http://localhost:3040/v1/chat/completions
```
Note that the base url will be `http://localhost:3040/v1`
To include installation instructions for Termux on Android devices, you can add the following section right after the instructions for Linux in the **Installing/Self-Hosting Guide**:
### Termux on Android Phones
To install and run the ChatGPT API Reverse Proxy on Android using Termux, follow these steps:
1. Install [Termux](https://play.google.com/store/apps/details?id=com.termux) from the Play Store.
2. Update Termux packages:
```bash
apt update
```
3. Upgrade Termux packages:
```bash
apt upgrade
```
4. Install git, Node.js, and npm:
```bash
apt install -y git nodejs
```
5. Clone the repository:
```bash
git clone https://github.com/PawanOsman/ChatGPT.git
```
6. Navigate to the cloned directory:
```bash
cd ChatGPT
```
7. Start the server with:
```bash
bash start.sh
```
8. Your local server will now be running and accessible at:
```
http://localhost:3040/v1/chat/completions
```
Note that the base url will be `http://localhost:3040/v1`
You can now use this address to connect to your self-hosted ChatGPT API Reverse Proxy from Android applications/websites that support reverse proxy configurations, on the same device.
## Accessing Our Hosted API
Utilize our pre-hosted ChatGPT-like API for free by:
1. Joining our [Discord server](https://discord.pawan.krd).
2. Obtaining an API key from the `#Bot` channel with the `/key` command.
3. Incorporating the API key into your requests to:
```
https://api.pawan.krd/v1/chat/completions
```
## Usage Examples
Leverage the same integration code as OpenAI's official libraries by simply adjusting the API key and base URL in your requests. For self-hosted setups, ensure to switch the base URL to your local server's address as mentioned above.
### Example Usage with OpenAI Libraries
#### Python Example
```python
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)
```
#### Node.js Example
```js
import OpenAI from 'openai';
const openai = new OpenAI({
apiKey: "anything",
baseURL: "http://localhost:3040/v1",
});
const chatCompletion = await openai.chat.completions.create({
messages: [{ role: 'user', content: 'Say this is a test' }],
model: 'gpt-3.5-turbo',
});
console.log(chatCompletion.choices[0].message.content);
```
## License
This project is under the AGPL-3.0 License. Refer to the [LICENSE](LICENSE) file for detailed information.
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
ChatGPT API 免费反向代理,它以 OpenAI 熟悉的结构提供对 ChatGPT (gpt-3.5-turbo) 的免费自托管 API 访问,因此无需更改代码。流式响应:API 支持流式响应,因此您可以在响应可用时立即获取响应。API 端点兼容性:与官方 OpenAI API 端点完全一致,确保与现有 OpenAI 库轻松集成。免费访问:API 使用不收取任何费用,即使没有 API 密钥,每个人都可以访问高级 AI。您可以使用 Docker Compose 通过此 API 运行第三方聊天 Web 界面,例如 BetterChatGPT 和 LobeChat。只需调整请求中的 API 密钥和基本 URL,即可利用与 OpenAI 官方库相同的集成代码。对于自托管设置,请确保如上所述将基本 URL 切换到本地服务器的地址。
资源推荐
资源详情
资源评论
收起资源包目录
ChatGPT-main.zip (17个子文件)
ChatGPT-main
.github
workflows
docker-publish.yml 662B
bettergpt-docker-publish.yml 718B
src
app.ts 10KB
LICENSE 34KB
start.bat 161B
package.json 672B
start.sh 155B
Dockerfile 322B
package-lock.json 39KB
.gitignore 139B
tsconfig.json 653B
docker-compose
bettergpt
docker-compose.yaml 964B
Dockerfile 324B
chatgpt-next-web
docker-compose.yaml 1023B
lobe-chat
docker-compose.yaml 946B
README.md 3KB
README.md 5KB
共 17 条
- 1
资源评论
传奇开心果编程
- 粉丝: 8596
- 资源: 335
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 1961ee27df03bd4595d28e24b00dde4e_744c805f7e4fb4d40fa3f695bfbab035_8(1).c
- mediapipe-0.9.0.1-cp37-cp37m-win-amd64.whl.zip
- windows注册表编辑工具
- mediapipe-0.9.0.1-cp37-cp37m-win-amd64.whl.zip
- 校园通行码预约管理系统20240522075502
- 车类型数据集6250张VOC+YOLO格式.zip
- The PyTorch implementation of STGCN.STGCN-main.zip
- 092300108.cpp
- 车类型数据集6000张VOC+YOLO格式.zip
- for daily read
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功