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.

相关推荐
深蓝电商API5 分钟前
爬虫数据导出 Excel:openpyxl 高级用法
爬虫·python·openpyxl
reasonsummer7 分钟前
【教学类-74-05】20260216剪影马(黑色填充图案转黑线条白填充)
python
逻极15 分钟前
BMAD之核心架构:为什么“方案化”至关重要 (Phase 3 Solutioning)——必学!BMAD 方法论架构从入门到精通
人工智能·ai·系统架构·ai编程·敏捷开发·ai辅助编程·bmad
查士丁尼·绵16 分钟前
通过sdk获取ecs指标
python·sdk
喵手18 分钟前
Python爬虫实战:失败重试分级 - DNS/超时/403 分策略处理 + 重试退避等!
爬虫·python·爬虫实战·零基础python爬虫教学·失败重试分级·dns/超时·重试退避
得一录1 小时前
Python 算法高级篇:布谷鸟哈希算法与分布式哈希表
python·算法·aigc·哈希算法
Faker66363aaa1 小时前
基于Cascade-Mask-RCNN和RegNetX-4GF的果蝇检测与识别系统——COCO数据集训练与优化
python
聂 可 以1 小时前
解决Pycharm中(Python)软件包下载速度很慢、甚至下载失败的问题
ide·python·pycharm
七夜zippoe1 小时前
强化学习实战指南:从Q-Learning到PPO的工业级应用
python·openai·超参数调优·q-learning·mdp
JaydenAI1 小时前
[拆解LangChain执行引擎]非常规Pending Write的持久化
python·langchain