HI Newbie here - sorry if this is a stupid question or asked/answered 1000 times before but how can I get access to GPT-5 using the API? I have a Personal account, am Verified, can get GPT-5 using the Web app and the “Playground.” I have generated another key after I got verified as instructed. However, I still am getting this error. Any help would be much appreciated!
You can follow this direct link to gpt-5 on the “chat with prompts” Playground.
https://platform.openai.com/chat/edit?models=gpt-5
You will still need to go into the 'three dots" menu and pick the endpoint “Responses” or “Chat Completions”.
That uses a session key, and if successful in chatting it up with an AI, I would try:
- Create a new project
- Create a new API key in that project and record it for use, placing it as environment variable, etc
- Do not set any limits on the project or the API key initially
- make your API call with code. Do not have an organization ID or project ID set as env variables if using a project API key of your own.
That should give you success, not an error (which you don’t describe).
That is the end what you can do to transition from an initially offered “onboarding” key that might not have been fully-provisioned. If unsuccessful, and you verified key use, the next step is to contact OpenAI via “help” in the platform site for organization repair.
Here is some Python with more of a “secrets” function than you really need - but it can print all the environment variables that OpenAI’s SDK client would also use, to see if you would be sending unexpected headers. Make the API call to gpt-5, see it saying hello (streaming which requires ID verification is not attempted).
'''Responses: non-SDK, non-streaming, non-async, showing env var and returned headers'''
import json, httpx
def get_api_key_headers(
printing: bool = False,
dotenv_override: bool = True,
env_path: str | None = None,
) -> dict[str, str]:
"""
Returns OpenAI API auth headers.
Behavior:
- Attempts to load variables from a .env file (if python-dotenv is available).
- By default, .env VALUES OVERRIDE existing os.environ entries (dotenv_override=True).
- You can point to a specific file via env_path; otherwise we use find_dotenv(usecwd=True).
- Each .env path is loaded at most once per process (cached).
- environment org and proj are usually for scoping legacy user keys
Notes:
- This updates process environment variables; in multi-account, single-process scenarios,
prefer passing explicit headers/keys per call rather than relying on global env.
Usage: To avoid cross-call bleed, pass a copy before mutation is possible, e.g.:
api_call(url, headers = {**get_api_key_headers(), "OpenAI-Beta": "responses=v99"}, ...)
"""
# One-time cache per path
if not hasattr(get_api_key_headers, "_dotenv_loaded_paths"):
get_api_key_headers._dotenv_loaded_paths = set()
# Best-effort .env loading (optional dependency)
try:
if env_path is None:
from dotenv import load_dotenv, find_dotenv # lazy import
dotenv_path = find_dotenv(usecwd=True)
else:
from dotenv import load_dotenv # lazy import
dotenv_path = env_path
if dotenv_path and dotenv_path not in get_api_key_headers._dotenv_loaded_paths:
load_dotenv(dotenv_path=dotenv_path, override=dotenv_override)
get_api_key_headers._dotenv_loaded_paths.add(dotenv_path)
except Exception:
# Missing python-dotenv or any load failure is a no-op.
pass
import os
api_key = os.environ.get("OPENAI_API_KEY")
if not api_key:
raise ValueError("ERROR: Set the OPENAI_API_KEY environment variable (or in your .env).")
org_id = os.environ.get("OPENAI_ORG_ID")
project_id = os.environ.get("OPENAI_PROJECT_ID")
if printing:
print(f"Using OPENAI_API_KEY {api_key[:10]}...{api_key[-4:]}")
print(f"Using optional OPENAI_ORG_ID {org_id}")
print(f"Using optional OPENAI_PROJECT_ID {project_id}")
headers: dict[str, str] = {"Authorization": f"Bearer {api_key}"}
if org_id:
headers["OpenAI-Organization"] = org_id
if project_id:
headers["OpenAI-Project"] = project_id
return headers
## ======== API call construction ==========
model = "gpt-5"
payload = {
"model": model,
"instructions": "You are a helpful conversational companion.",
"input": "Greetings, friend.",
"store": False,
"text": {"verbosity":"low"},
"reasoning": {"effort": "minimal"},
}
print("\n---\n\nRequest JSON:\n" + json.dumps(payload, indent=2))
try:
response = httpx.post(
"https://api.openai.com/v1/responses",
json=payload,
headers={**get_api_key_headers(printing=True)},
timeout=300,
)
response.raise_for_status()
response_headers = {k: v for k, v in response.headers.items()}
print(f"- response headers: openai-organization {response_headers['openai-organization']}")
print(f"- response headers: openai-project {response_headers['openai-project']}")
## Note - no image object capture is done, don't try to ask for images!
assistant_texts = [ # a version of the "output_text" helper
content["text"]
for output in response.json().get("output", [])
for content in output.get("content", [])
if content.get("type") == "output_text" and "text" in content
]
print(f"\n---\n\n{model} Response JSON:\n" + json.dumps(response.json(), indent=2))
print("\n---\n\nCollected response text:\n" + str(assistant_texts))
except:
print(
response.status_code,
json.loads(response.content.decode())["error"]["message"]
)
Thank you.
SO, I click on that link https://platform.openai.com/chat/edit?models=gpt-5 and the page I get to has 2 identical black rectagles that say “The model “gpt-5” is not available… using the default model instead.”
However, I do see “Model gpt-5” as one of the Model options on the top left so go figure.
Anyway, based on these message, I assumed I can’t get to GPT-5 on the Playground. Since I was not successful with chatting it up with GPT-5 I didn’t follow the other steps you listed immediately below.
I ran the Python script you gave, after making sure the API key, Org ID, and Proj ID were set as env variables. I received the message "403 Project proj_....
does not have access to model gpt-5
So, I take it the next step is to follow up with OpenAI help. The only help source I’ve found so far is the chat bot linked to the little circle icon on the lower right of the help page. That didn’t give me the help I needed. Is there another contact point (email, link, etc) that might get me to a live person who can take over this inquiry.
Many thanks again for your help!
I am having the exact same issue with some of my projects, but not others.