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.

相关推荐
菠菠萝宝30 分钟前
【Java手搓RAGFlow】-1- 环境准备
java·开发语言·人工智能·llm·openai·rag
SunnyDays10111 小时前
从图片到PPT:用Python实现多图片格式(PNG/JPG/SVG)到幻灯片的批量转换
python·图片转ppt·png转ppt·jpg转ppt·svg转ppt·添加图片到ppt
CodeCraft Studio1 小时前
Excel处理控件Aspose.Cells教程:使用Python从Excel工作表中删除数据透视表
开发语言·python·excel·aspose·aspose.cells·数据透视表
普通网友1 小时前
用Python批量处理Excel和CSV文件
jvm·数据库·python
linuxxx1101 小时前
高考志愿填报辅助系统
redis·后端·python·mysql·ai·django·高考
无妄无望2 小时前
ragflow代码学习切片方式(1)docling_parser.py
人工智能·python·学习
醒过来摸鱼2 小时前
9.12 sinc插值
python·线性代数·算法·numpy
努力的光头强2 小时前
《智能体设计模式》从零基础入门到精通,看这一篇就够了!
大数据·人工智能·深度学习·microsoft·机器学习·设计模式·ai
小兔崽子去哪了2 小时前
Numpy、Panads
python·numpy·pandas