Giter Club home page Giter Club logo

pandoratov1api's Introduction

项目简介

为了方便大家将 Pandora-Next 项目与各种其他项目结合完成了本项目。

本项目支持:

  1. 将 Pandora-Next proxy 模式下的 backend-api 转为 /v1/chat/completions 接口,支持流式和非流式响应。

  2. 将 Pandora-Next proxy 模式下的 backend-api 转为 /v1/images/generations 接口

如果本项目对你有帮助的话,请点个小星星吧~

更新日志

Release 页面。

功能列表

  • 支持 代码解释器、联网、绘图

  • 支持 gpt-4-s

  • 支持 gpt-4-mobile

  • 支持 gpt-3.5-turbo

  • 支持 gpts

  • 支持 流式输出

  • 支持 非流式输出

  • 支持 dalle 绘图接口

  • 支持 接口保活

  • 支持 自定义接口前缀

  • 支持 日志等级划分

  • 支持 gpt-4-vision

  • 支持 指定进程、线程数

  • 优化 偶现的【0†source】引用bug

注意

Caution

  1. 本项目的运行需要 Pandora-Next 开启 auto_conv_arkose:true,同时请尽量升级最新版本的 Pandora-Next,以确保支持此功能。

  2. 本项目对话次数对Pandora-Next的对话额度消耗比例为:

    • gpt-4-sgpt-4-mobileGPTS1:14
    • gpt-3.5-turbo1:4
  3. 本项目实际为将来自 /v1/chat/completions 的请求转发到Pandora-Next的 /backend-api/conversation 接口,因此本项目并不支持高并发操作,请不要接入如 沉浸式翻译 等高并发项目。

  4. 本项目并不能绕过 OpenAI 和 PandoraNext 官方的限制,只提供便利,不提供绕过。

支持的模型

目前支持的模型包括:

  1. gpt-4-s:支持代码解释器、bing联网、dalle绘图的 GPT-4,对应的是官方的默认 GPT-4(绘图的响应有时候有些不稳定)

  2. gpt-4-mobile:支持代码解释器、bing联网、dalle绘图的 GPT-4,对应的是官方的手机版 GPT-4,截止至2023年12月15日,本模型使用量不计入 GPT-4 用量(即不受每 3 小时 40 次的限制)

  3. 几乎所有的 GPTS(配置方式见下文)

  4. gpt-3.5-turbo

Docker-Compose 部署

仓库内已包含相关文件和目录,拉到本地后修改 docker-compose.yml 文件里的环境变量后运行docker-compose up -d即可。

环境变量说明:

  • UPLOAD_BASE_URL:用于dalle模型生成图片的时候展示所用,需要设置为使用如 ChatGPT-Next-Web 的用户可以访问到的 Uploader 容器地址,如:http://1.2.3.4:50011

  • KEY_FOR_GPTS_INFO:仅获取 GPTS 信息的 key,需要该 key 能够访问所有配置的 GPTS。后续发送消息仍需要在请求头携带请求所用的 key,如果未配置该项,请将 gpts.json 文件修改为:

{}

GPTS配置说明

如果需要使用 GPTS,需要修改 gpts.json 文件,其中每个对象的key即为调用对应 GPTS 的时候使用的模型名称,而 id 则为对应的模型id,该 id 对应每个 GPTS 的链接的后缀。配置多个GPTS的时候用逗号隔开。

例如:PandoraNext的官方 GPTS 的链接为:https://chat.oaifree.com/g/g-CFsXuTRfy-pandoranextzhu-shou,则该模型的 id 的值应为 g-CFsXuTRfy-pandoranextzhu-shou,而模型名可以自定义。

示例:

{
    "gpt-4-classic": {
        "id":"g-YyyyMT9XH-chatgpt-classic"
    },
    "pandoraNext":{
        "id":"g-CFsXuTRfy-pandoranextzhu-shou"
    }
}

注意:使用该配置的时候需要保证正确填写 docker-compose.yml 的环境变量 KEY_FOR_GPTS_INFO,同时该变量设置的 key 允许访问所有配置的 GPTS。

绘图接口使用说明

接口URI:/v1/images/generations

请求方式:POST

请求头:正常携带 AuthorizationContent-Type 即可,Authorization 的值为 Bearer <Pandora-Next 的 fk>Content-Type 的值为 application/json

请求体格式示例:

{
    "model": "gpt-4-s",
    "prompt": "A cute baby sea otter"
}

请求体参数说明:

  • model:模型名称,需要支持绘图功能,否则绘图结果将为空

  • prompt:绘图的 Prompt

响应体格式示例:

{
    "created": 1702788293,
    "data": [
        {
            "url": "http://<upload 容器公网ip>:50012/images/image_20231217044452.png"
        }
    ],
    "reply": "\n```\n{\"size\":\"1024x1024\",\"prompt\":\"A cute baby sea otter floating on its back in calm, clear waters. The otter has soft, fluffy brown fur, and its small, round eyes are shining brightly. It's holding a small starfish in its tiny paws. The sun is setting in the background, casting a golden glow over the scene. The water reflects the colors of the sunset, with gentle ripples around the otter. There are a few seagulls flying in the distance under the pastel-colored sky.\"}Here is the image of a cute baby sea otter floating on its back."
}

示例

以ChatGPT-Next-Web项目的docker-compose部署为例,这里提供一个简单的部署配置文件示例:

version: '3'
services:
  chatgpt-next-web:
    image: yidadaa/chatgpt-next-web
    ports:
      - "50013:3000"
    environment:
      - OPENAI_API_KEY=<Pandora-Next 的 fk>
      - BASE_URL=<backend-to-api容器地址>
      - CUSTOM_MODELS=+gpt-4-s,+gpt-4-mobile,+<gpts.json 中的模型名>

功能演示

联网

api-1

代码解释器

api-2

绘图

api-3

GPT-4-Mobile

api-4

GPTS

api-5

Star 历史

Stargazers over time

pandoratov1api's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.