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.

相关推荐
郭龙_Jack2 分钟前
Java 17 到 Java 25:LTS 升级的全面收益与迁移指南
java·开发语言·python
沉下去,苦磨练!3 分钟前
python的数据分析numpy
python·数据分析·numpy
2301_809244536 分钟前
mysql如何处理大量重复值索引_mysql索引存储特征分析.txt
jvm·数据库·python
要开心吖ZSH8 分钟前
Java AI Agent 开发中的 RAG 实现方案及小白入门指南
java·ai·agent·rag
笨蛋©10 分钟前
2026年制造业实战:工程图纸数字化与自动化检验计划生成指南
ai·数字化·质量管理·制造业·fai
咋吃都不胖lyh10 分钟前
IVF_FLAT 和 HNSW 是两种最核心的近似最近邻(ANN)索引算法
python
2401_8844541515 分钟前
如何管理只读表空间的备份_跳过只读表空间的RMAN优化策略
jvm·数据库·python
woxihuan12345620 分钟前
CSS移动端实现响应式导航菜单_利用媒体查询切换显示隐藏状态
jvm·数据库·python
CCPC不拿奖不改名21 分钟前
PostgreSQL数据库部署linux服务器流程
linux·服务器·数据库·windows·python·docker·postgresql
曲幽21 分钟前
你的Agent API还在裸奔?从认证到沙箱,我用FastAPI搭了几道防线
python·fastapi·web·security·jwt·oauth2·limit·sandbox·ai agent