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/
相关推荐
人工智能AI技术7 分钟前
DeskClaw Windows上线|C#开发AI桌面助手,轻量内核源码解析
人工智能·c#
璞华Purvar7 分钟前
园区运营管理系统是什么?如何实现园区全业务精细化数字化管理?(2026年)
大数据·人工智能
sw12138911 分钟前
Python字典与集合:高效数据管理的艺术
jvm·数据库·python
进击的小头13 分钟前
第13篇:基于伯德图的超前_滞后校正器深度设计
python·算法
zzh9407715 分钟前
2026年实测:Genmini 3.0使用AI联网搜索功能全攻略
人工智能
田里的水稻22 分钟前
EI_openclaw_UI交互
人工智能·ui·机器人
>ᴗoಣ29 分钟前
Exploring Persona Sentiment Sensitivity in Personalized Dialogue Generation
人工智能
大数据AI人工智能培训专家培训讲师叶梓30 分钟前
120B 数学语料 + GRPO 算法,DeepSeekMath 刷新开源大模型推理天花板
人工智能·算法·大模型·推理·deepseek·openclaw·openclaw 讲师
智算菩萨33 分钟前
多目标超启发式算法系统文献综述:人机协同大语言模型方法论深度精读
论文阅读·人工智能·深度学习·ai·多目标·综述
兮℡檬,39 分钟前
银行卡卡号识别
人工智能·计算机视觉