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.

相关推荐
智算菩萨4 分钟前
【Python小游戏】深度解析Pygame实现2048游戏的完整开发流程(有代码实现)
python·游戏程序·pygame
嘉嘉嘉71717 分钟前
【day 52】神经网络调参指南
python·深度学习·机器学习
测试秃头怪21 分钟前
Python测试框架Pytest的参数化
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·pytest
深蓝电商API21 分钟前
Scrapy 爬虫异常处理与重试机制优化
爬虫·python·scrapy
数字游民952727 分钟前
推荐一个自带流量加成的小程序接口
人工智能·ai·小程序
爱吃提升41 分钟前
如何使用量化工具对模型进行量化优化?
python
计算机网恋1 小时前
本地部署DeepSeek
ai
明洞日记1 小时前
【CUDA手册004】一个典型算子的 CUDA 化完整流程
c++·图像处理·算法·ai·图形渲染·gpu·cuda
wang_yb2 小时前
你真的会用 Python 的 print 吗?
python·databook
筱昕~呀2 小时前
基于深度生成对抗网络的智能实时美妆设计
人工智能·python·生成对抗网络·mediapipe·beautygan