How to subscribe and GPT-4 API access

Hi,

I am currently using subscribed Chat GPT-4 online version, and run prompts which looks great. However, I am also interested to subscribe GPT-4 API to run prompts via command line, do you how would I subscribe/pay and obtain the access to it.

Thank you,
Mohammed

1 Like

Welcome to the forum. Here you go…

1 Like

I just did this today myself. Make sure you’re in the API area of the website, and then click “begin” or “get started” (something like that), then you should see a page with a big “$4.99” discount showing. I got started by paying just $5, and getting the API key that way.

2 Likes

@wclayf great, thank you so much. It worked.

3 Likes

Hello @wclayf my organization subscribed for gpt-4 API, but it’s still not accessible when I try to consume the API and use the gpt-4 model. Please am I missing anything?

“gpt-4” worked yesterday but not today.
My API key is valid for “davinci” but not “gpt-4”.
I subscribe to ChatGPTPlus and have available API Credit Balance.

I’ve been using the gpt-3.5-turbo model and this endpoint : “https://api.openai.com/v1/chat/completions” and they are both working fine right now.

What error message are you getting? You know the API has it’s own separate signup for the main GPT for end users right?

My development code and this test code (api key valid for gpt-4) worked until last night when I exceeding my credit balance; although I added more monies to the balance over 5 hours ago, I still can’t access gpt-4 or 3.5 whilst “Davinci” works. I have ChatGPTPlus subscription and Credit Balance $20.

import openai

openai.api_key = 'YOUR_API_KEY'

def is_api_key_valid():
    try:
        response = openai.Completion.create(
            model="davinci",
            prompt="This is a test.",
            max_tokens=5
        )
    except:
        return False
    else:
        return True

# Check the validity of the API key
api_key_valid = is_api_key_valid()
print("API key is valid:", api_key_valid)

API key is valid: True <— Davinci
API key is valid: False ← gpt-4 or gpt-3

This worked…

curl https://api.openai.com/v1/chat/completions
-H “Content-Type: application/json”
-H "Authorization: Bearer “my api key”
-d ‘{
“model”: “gpt-4”,
“messages”: [{“role”: “user”, “content”: “Say this is a test!”}],
“temperature”: 0.7
}’
{
“id”: “chatcmpl-7sxzaBmtUbGAG6Q4QIgdZtiZIRHHs”,
“object”: “chat.completion”,
“created”: 1693334678,
“model”: “gpt-4-0613”,
“choices”: [
{
“index”: 0,
“message”: {
“role”: “assistant”,
“content”: “This is a test!”
},
“finish_reason”: “stop”
}
],
“usage”: {
“prompt_tokens”: 13,
“completion_tokens”: 5,
“total_tokens”: 18
}
}

But I list the models and appears to me no longer have access to gpt-4. I am current on my ChatGPTPlus subscription and it has been over 5 hours since I replenished my balance.

import os
import openai
openai.api_key = “My API Key”
openai.Model.list()
<OpenAIObject list at 0x7f8350083710> JSON: {
“object”: “list”,
“data”: [
{
“id”: “davinci”,
“object”: “model”,
“created”: 1649359874,
“owned_by”: “openai”,
“permission”: [
{
“id”: “modelperm-uJaD4C9nXA6tPNoBII9hcYF4”,
“object”: “model_permission”,
“created”: 1692634268,
“allow_create_engine”: false,
“allow_sampling”: true,
“allow_logprobs”: true,
“allow_search_indices”: false,
“allow_view”: true,
“allow_fine_tuning”: false,
“organization”: “",
“group”: null,
“is_blocking”: false
}
],
“root”: “davinci”,
“parent”: null
},
{
“id”: “gpt-4-0314”,
“object”: “model”,
“created”: 1687882410,
“owned_by”: “openai”,
“permission”: [
{
“id”: “modelperm-eJxIX8r0jTNkOTBy09sEo3Cp”,
“object”: “model_permission”,
“created”: 1693326339,
“allow_create_engine”: false,
“allow_sampling”: false,
“allow_logprobs”: false,
“allow_search_indices”: false,
“allow_view”: false,
“allow_fine_tuning”: false,
“organization”: "
”,
“group”: null,
“is_blocking”: false
}
],
“root”: “gpt-4-0314”,
“parent”: null
},
{
“id”: “gpt-4”,
“object”: “model”,
“created”: 1687882411,
“owned_by”: “openai”,
“permission”: [
{
“id”: “modelperm-tsET7VSHRhiQHP5Qz6TU1FBb”,
“object”: “model_permission”,
“created”: 1693330062,
“allow_create_engine”: false,
“allow_sampling”: false,
“allow_logprobs”: false,
“allow_search_indices”: false,
“allow_view”: false,
“allow_fine_tuning”: false,
“organization”: “*”,
“group”: null,
“is_blocking”: false
}
],
“root”: “gpt-4”,
“parent”: null
},
.
.
.
ChatGPTPlus was not helpful do I call Billing?

Yeah, I would reach out to help.openai.com … good luck.

2 Likes

Thanks Paul,

“gpt-4” works :slight_smile: [API key since deleted for safety]