Sunnnner / popai2api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

用户手册

项目结构

project-root/
├── Dockerfile
├── requirements.txt
└── app/
    ├── __init__.py
    ├── main.py
    ├── config.py
    ├── utils.py
    └── routes.py

功能

  • 支持图片上传
  • 支持gpt-4o
  • 模拟对话隔离(根据客户前一条消息作为key)
  • 支持多账号轮询(AUTHORIZATION = auth1,auth2,auth3 )
  • 支持proxy:HTTPS_PROXIES = proxy1,proxy2
  • 新增 “ /v1/images/generations” 路由,兼容OPENAI文生图报文格式

部署

docker

docker run --name popai2api --restart=always -d -p 3000:3000 -e AUTHORIZATION = {{auth1,auth2,auth3}} hulu365/popai2api:latest

draw

curl --location --request GET 'http://127.0.0.1:3034/v1/chat/completions' \
--header 'Authorization: Bearer none' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "dalle3",
    "messages": [
        {
            "role": "user",
            "content": "画一只猫猫"
        }
    ],
    "stream": false
}'

chat

curl --location --request GET 'http://127.0.0.1:3034/v1/chat/completions' \
--header 'Authorization: Bearer none' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gpt-4",
    "messages": [
        {
            "role": "user",
            "content": "say this is a test"
        }
    ],
    "stream": false
}'

webserarch

curl --location --request GET 'http://127.0.0.1:3034/v1/chat/completions' \
--header 'Authorization: Bearer none' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "websearch",
    "messages": [
        {
            "role": "user",
            "content": "今日财经新闻"
        }
    ],
    "stream": false
}'

About


Languages

Language:Python 98.7%Language:Dockerfile 1.3%