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/
相关推荐
神马行空1 分钟前
一文解读DeepSeek大模型在政府工作中具体的场景应用
人工智能·大模型·数字化转型·deepseek·政务应用
合合技术团队3 分钟前
实测对比|法国 AI 独角兽公司发布的“最强 OCR”,实测效果如何?
大数据·人工智能·图像识别
冷月半明4 分钟前
Python项目打包指南:PyInstaller与SeleniumWire的兼容性挑战及解决方案
python·selenium
冷月半明4 分钟前
《Pandas 性能优化:向量化操作 vs. Swifter 加速,谁才是大数据处理的救星?》
python·数据分析·pandas
紫电青霜_FullStack5 分钟前
浅谈用Azure AI Search实现RAG (1)---基本概念
openai
蒹葭苍苍87310 分钟前
LoRA、QLoRA微调与Lama Factory
人工智能·笔记
蹦蹦跳跳真可爱58911 分钟前
Python----机器学习(基于PyTorch的线性回归)
人工智能·pytorch·python·机器学习·线性回归
搞不懂语言的程序员35 分钟前
装饰器模式详解
开发语言·python·装饰器模式
mosquito_lover139 分钟前
矿山边坡监测预警系统设计
人工智能·python·深度学习·神经网络·视觉检测
船长@Quant40 分钟前
PyTorch量化进阶教程:第二章 Transformer 理论详解
pytorch·python·深度学习·transformer·量化交易·sklearn·ta-lib