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/
相关推荐
Ratten12 分钟前
【Python 实战】---- 实现一个可选择、配置操作的批量文件上传工具(三)上传类的实现
python
martinzh12 分钟前
提示词工程师到底是干什么的?
人工智能
Coovally AI模型快速验证15 分钟前
SOD-YOLO:基于YOLO的无人机图像小目标检测增强方法
人工智能·yolo·目标检测·机器学习·计算机视觉·目标跟踪·无人机
黎燃16 分钟前
无人机+AI:精准农业的“降维打击”实践
人工智能
茫茫人海一粒沙18 分钟前
RAG 分块中表格填补简明示例:Markdown、HTML、Excel、Doc
人工智能
爱喝奶茶的企鹅27 分钟前
Ethan开发者创新项目日报 | 2025-08-18
人工智能
却道天凉_好个秋27 分钟前
计算机视觉(一):nvidia与cuda介绍
人工智能·计算机视觉
爱喝奶茶的企鹅41 分钟前
Ethan独立开发新品速递 | 2025-08-18
人工智能·程序员·开源
七夜zippoe41 分钟前
如何使用 AI 大语言模型解决生活中的实际小事情?
人工智能·语言模型·生活
算家计算1 小时前
一行命令,玩转所有主流音视频格式!一站式音视频处理工具——FFmpeg本地部署教程
人工智能