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
16.06k stars 3.73k forks source link

model is required #1580

Closed zhangheng2022 closed 2 days ago

zhangheng2022 commented 5 days ago

例行检查

问题描述 {"error":{"message":"model is required (request id: 2024062818153452108536804408087)","type":"one_api_error","param":"","code":"invalid_text_request"}} 复现步骤 const stream = await fetch( "https://xxxxxxxx.com/v1/chat/completions", { method: "POST", headers: { "Content-Type": "text/event-stream", "Authorization": Bearer ${apiKey}-2, }, body: JSON.stringify({ model: "gemini-1.5-pro", messages: contents, stream: true, }), }, ); 预期结果

相关截图 如果没有的话,请删除此节。

好奇怪,我已经设置了model

QAbot-zh commented 5 days ago

把 Content-Type 换成 application/json 试试呢

zhangheng2022 commented 2 days ago

把 Content-Type 换成 application/json 试试呢

谢谢,可以了