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/
相关推荐
colman wang9 分钟前
人工智能课程(配套AIMA(Artificial Intelligence: A Modern Approach))
人工智能
LinXunFeng4 小时前
Draw Things 换装 LoRA 实战:用 Silo 秒装,同一提示词对比出图
人工智能·开源·aigc
xiaohaiAIgeo4 小时前
【2026年】通风柜自动门安全吗?联锁逻辑与防夹设计
人工智能·安全·科普知识
像风一样自由20204 小时前
52.Docker部署大模型应用从本地开发到服务化运行
运维·人工智能·docker·容器·大模型·智能体
牛战士coding5 小时前
AI Agent 如何接入真实业务系统?订单助手三层架构完整拆解
人工智能·架构
·云扬·5 小时前
Prompt 工程与安全:从 System 设计到注入防御
java·人工智能·安全·ai·prompt
阿明副业观察5 小时前
2026年免费AI视频生成工具功能深度解析:有无水印、中文语音及商业用途考量
大数据·人工智能·ai作画·aigc·音视频·ai写作
收放扳机5 小时前
PCB收放板设备机械手架构选型参考——三轴/四轴/六轴/蜘蛛手对比
人工智能·科技·架构·自动化·制造·pcb工艺
AKAMAI6 小时前
Akamai 宣布与Anthropic达成 116 亿美元多年期协议,以支持其日益增长的需求
人工智能·云计算
甲维斯6 小时前
我把“赶 Deadline”和AI做成了一款游戏
人工智能·游戏开发