Why can‘t I access GPT-4 models via API, although GPT-3.5 models work?

**题意:**为什么我无法通过API访问GPT-4模型,尽管GPT-3.5模型可以工作?

问题背景:

I'm able to use the gpt-3.5-turbo-0301 model to access the ChatGPT API, but not any of the gpt-4 models. Here is the code I am using to test this (it excludes my openai API key). The code runs as written, but when I replace "gpt-3.5-turbo-0301" with "gpt-4", "gpt-4-0314", or "gpt-4-32k-0314", it gives me an error

python 复制代码
openai.error.InvalidRequestError: The model: `gpt-4` does not exist

I have a ChatGPT+ subscription, am using my own API key, and can use gpt-4 successfully via OpenAI's own interface.

It's the same error if I use gpt-4-0314 or gpt-4-32k-0314. I've seen a couple articles claiming this or similar code works using 'gpt-4' works as the model specification, and the code I pasted below is from one of them.

Is it possible to access the gpt-4 model via Python + API, and if so, how?

python 复制代码
openai_key = "sk..."
openai.api_key = openai_key
system_intel = "You are GPT-4, answer my questions as if you were an expert in the field."
prompt = "Write a blog on how to use GPT-4 with python in a jupyter notebook"
# Function that calls the GPT-4 API

def ask_GPT4(system_intel, prompt): 
    result = openai.ChatCompletion.create(model="gpt-3.5-turbo-0301",
                                 messages=[{"role": "system", "content": system_intel},
                                           {"role": "user", "content": prompt}])
    print(result['choices'][0]['message']['content'])

# Call the function above
ask_GPT4(system_intel, prompt)

问题解决:

Currently the GPT 4 API is restricted, Even to users with a Chat GPT + subscription.

You may need to join the Waitlist for the API.

相关推荐
愚公搬代码6 分钟前
【愚公系列】《Python网络爬虫从入门到精通》055-Scrapy_Redis分布式爬虫(安装Redis数据库)
数据库·爬虫·python
浅浅28028 分钟前
numpy、pandas内存优化操作整理
数据结构·经验分享·python·学习·性能优化·numpy·pandas
MCP星球33 分钟前
我们离Agent终极形态又近了一步:全球首个支持谷歌A2A(Agent-to-Agent)协议的智能体注册网站上线Product Hunt,未来智能体协作网络
ai·agent·智能体·智能体协作·a2a·a2a协议·agent network·智能体网络·谷歌a2a·agent2agent
拓端研究室TRL1 小时前
Python+AI提示词比特币数据预测:Logistic逻辑回归、SVC及XGB特征工程优化实践
开发语言·人工智能·python·算法·逻辑回归
就叫飞六吧1 小时前
Python自动化selenium-一直卡着不打开浏览器怎么办?
python·selenium·自动化
亚林瓜子1 小时前
AWS Elastic Beanstalk的部署Python Flask后端服务(Hello,World)
python·flask·aws·eb
weixin_307779131 小时前
实现AWS Step Function安全地请求企业内部API返回数据
开发语言·python·云计算·aws
小研学术1 小时前
如何用AI辅助数据分析及工具推荐
论文阅读·人工智能·ai·数据挖掘·数据分析·deepseek
zhangjipinggom2 小时前
怎么安装python3.5-以及怎么在这个环境下安装包
开发语言·python
格子先生Lab2 小时前
Java反射机制深度解析与应用案例
java·开发语言·python·反射