欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 汽车 > 新车 > 404 error when doing workload anlysis using locust on OpenAI API (GPT.35)

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

2025/2/23 1:58:11 来源:https://blog.csdn.net/suiusoar/article/details/142159568  浏览:    关键词: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 进行一些工作负载分析。"

from locust import HttpUser, between, taskclass OpenAIUser(HttpUser):wait_time = between(1, 2)  # wait between 1 and 2 secondshost = "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"}]}@taskdef 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/

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词