songquanpeng / one-api

OpenAI 接口管理 & 分发系统,支持 Azure、Anthropic Claude、Google PaLM 2 & Gemini、智谱 ChatGLM、百度文心一言、讯飞星火认知、阿里通义千问、360 智脑以及腾讯混元,可用于二次分发管理 key,仅单可执行文件,已打包好 Docker 镜像,一键部署,开箱即用. OpenAI key management & redistribution system, using a single API for all LLMs, and features an English UI.
https://openai.justsong.cn/
MIT License
19.04k stars 4.26k forks source link

请求支持openai新模型gpt-4-turbo #1304

Closed elonlo closed 7 months ago

elonlo commented 7 months ago

例行检查

问题描述 支持Openai GPT-4 Turbo

复现步骤

预期结果

相关截图 image

RexWzh commented 7 months ago

渠道模型那里,手动加上 gpt-4-turbo 就行了。亲测可用。

另外,”填入渠道支持模型“ 会填入默认写好的模型;能否增加一个选项,获取渠道 v1/models 接口返回的模型,这样项目不需要频繁维护这个模型列表(不过除了 OpenAI 其他API 的更新频率应该不高)。

curl $OPENAI_API_BASE/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-4-turbo",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "What'\''s in this image?"
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
            }
          }
        ]
      }
    ],
    "max_tokens": 300
  }'

{
  "id": "chatcmpl-9DAlsV4hpKvEkdpfxaWLppuhOUa45",
  "object": "chat.completion",
  "created": 1712926696,
  "model": "gpt-4-turbo-2024-04-09",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "This image features a beautiful natural landscape with a wooden boardwalk extending through a lush green meadow. The meadow is flanked by tall grasses and some scattered bushes, possibly hinting at a wetland or marshland environment. The sky above is clear with a few clouds, suggesting a sunny day. This scene is serene, and the boardwalk invites one to walk through and enjoy the tranquil surroundings. The overall picture is vibrant with rich green tones and a sense of peacefulness in a natural setting."
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 1118,
    "completion_tokens": 102,
    "total_tokens": 1220
  },
  "system_fingerprint": "fp_d1bac968b4"
}
songquanpeng commented 7 months ago

@RexWzh 这个是有什么用途吗?目前 /v1/models 返回的是令牌所支持的渠道

RexWzh commented 7 months ago

v1/models 的处理非常好了~ 我指填写渠道时,载入的默认列表。如果每次openai更新模型,都要同步更新该表,可能有点琐碎(开发侧)

songquanpeng commented 7 months ago

点击这个可以直接补齐: image