Skip to content

Commit

Permalink
doc(README): 添加中文文档
Browse files Browse the repository at this point in the history
  • Loading branch information
RockChinQ committed Sep 22, 2023
1 parent 6673d76 commit 8c483a3
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# free-one-api

[中文文档](README_cn.md) | [English](README.md)

Turn reverse engineered LLM lib to standard OpenAI GPT API.
By using free-one-api, you can easily convert reverse engineered LLM libs (e.g. [acheong08/ChatGPT](https://github.com/acheong08/ChatGPT) ) to standard OpenAI GPT API.
So other application supports OpenAI GPT API can use reverse engineered LLM libs directly.
Expand All @@ -20,6 +22,8 @@ So other application supports OpenAI GPT API can use reverse engineered LLM libs

- `/v1/chat/completions`

File a issue or pull request if you want to add more.

## Setup

### Docker (Recommended)
Expand Down
101 changes: 101 additions & 0 deletions README_cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# free-one-api

[中文文档](README_cn.md) | [English](README.md)

将逆向工程的大语言模型库转换为标准的 OpenAI GPT API。
通过使用 free-one-api,您可以轻松地将逆向工程的 LLM 库(例如 [acheong08/ChatGPT](https://github.com/acheong08/ChatGPT) ) 转换为标准的 OpenAI GPT API。
因此,其他支持 OpenAI GPT API 的应用程序可以直接使用逆向工程的 LLM 库。

## 功能点

- 支持自动负载均衡。
- 支持 Web UI。
- 支持流模式。

### 支持的 LLM 库

- [acheong08/ChatGPT](https://github.com/acheong08/ChatGPT) - ChatGPT 网页版逆向工程
- gpt-3.5-turbo
- gpt-4

### 支持的 API 路径

- `/v1/chat/completions`

欢迎提交 issue 或 pull request 来添加更多的 LLM 库和 API 路径支持。

## 部署

### Docker (推荐)

```bash
docker run -d -p 3000:3000 --name free-one-api rockchin/free-one-api -v ./data:/app/data
```

你可以在 `http://localhost:3000/` 打开管理页面。

### 手动

```bash
git clone https://github.com/RockChinQ/free-one-api.git
cd free-one-api

cd web && npm install && npm run build && cd ..

pip install -r requirements.txt
python main.py
```

你可以在 `http://localhost:3000/` 打开管理页面。

## Usage

1. 创建一个 channel,按照说明填写配置,然后创建一个新的 key。

<img width="752" alt="image" src="https://github.com/RockChinQ/free-one-api/assets/45992437/d163652b-0b71-4ca9-89fb-ac964692f0ee">

2. 将 url (e.g. http://localhost:3000/v1 ) 设置为 OpenAI 的 api_base ,将生成的 key 设置为 OpenAI api key。
3. 现在你可以使用 OpenAI API 来访问逆向工程的 LLM 库了。

```curl
# curl example
curl http://localhost:3000/v1/chat/completions \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Hello!"
}
],
"stream": true
}'
```

```python
# python example
import openai

openai.api_base = "http://localhost:3000/v1"
openai.api_key = "generated key"

response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{
"role": "user",
"content": "hello, how are you?"
}
],
stream=False,
)

print(response)
```

0 comments on commit 8c483a3

Please sign in to comment.