404 error when doing workload anlysis using locust on OpenAI API (GPT.35)

题意:"使用 Locust 对 OpenAI API (GPT-3.5) 进行工作负载分析时出现 404 错误。"

问题背景:

I am trying to do some workload analysis on OpenAI GPT-3.5-TURBO using locust.

"我正在使用 Locust 对 OpenAI GPT-3.5-TURBO 进行一些工作负载分析。"

python 复制代码
from locust import HttpUser, between, task


class OpenAIUser(HttpUser):

    wait_time = between(1, 2)  # wait between 1 and 2 seconds
    host = "https://api.openai.com/"

    def on_start(self):

        self.headers = {
            "Content-Type": "application/json",
            "Authorization": "Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
        }

        self.data = {
            "model": "gpt-3.5-turbo",
            "messages": [
                {
                    "role": "system",
                    "content": "You are a helpful story teller."
                },
                {
                    "role": "user",
                    "content": "Tell me a 100 word story"
                }
            ]
        }

    @task
    def test_chat_completion(self):
        self.client.post(
            "https://api.openai.com/v1/chat/completion/",
            json=self.data,
            headers=self.headers
        )

I get this error:

得到如下错误信息:

复制代码
POST /v1/chat/completion/: HTTPError('404 Client Error: Not Found for url: /v1/chat/completion/')

My script for Azure OpenAI workload analysis works fine with this exact same structure. What am I missing?

"我用于 Azure OpenAI 工作负载分析的脚本在相同的结构下运行正常。我漏掉了什么?"

问题解决:

Typo error. Should be:

"拼写错误。应该是:"

复制代码
https://api.openai.com/v1/chat/completions

and not: 而不是:

复制代码
https://api.openai.com/v1/chat/completion/
相关推荐
腾飞开源3 分钟前
《AI智能体实战开发教程(从0到企业级项目落地)》全网上线|CSDN & B站同步首发
人工智能·ai智能体开发·全网首发·新课上线·粉丝专属优惠·全完结·企业级项目落地
Python极客之家7 分钟前
基于数据挖掘的在线游戏行为分析预测系统
人工智能·python·机器学习·数据挖掘·毕业设计·课程设计
说私域9 分钟前
基于开源AI智能名片与链动2+1模式的S2B2C商城小程序研究:构建“信息找人”式精准零售新范式
人工智能·小程序·开源
技术猴小猴17 分钟前
如何使用Python实现UDP广播
开发语言·python·udp
嘀咕博客28 分钟前
Kimi-Audio:Kimi开源的通用音频基础模型,支持语音识别、音频理解等多种任务
人工智能·音视频·语音识别·ai工具
Baihai_IDP30 分钟前
GPU 网络基础,Part 2(MoE 训练中的网络挑战;什么是前、后端网络;什么是东西向、南北向流量)
人工智能·llm·gpu
Blacol39 分钟前
【MCP】Caldav个人日程助手
人工智能·mcp
峥嵘life44 分钟前
Android16 adb投屏工具Scrcpy介绍
android·开发语言·python·学习·web安全·adb
l12345sy1 小时前
Day31_【 NLP _1.文本预处理 _(4)文本特征处理、文本数据增强】
人工智能·深度学习·自然语言处理
说私域1 小时前
开源AI智能名片链动2+1模式S2B2C商城小程序在公益课裂变法中的应用与影响研究
人工智能·小程序