Where can I buy tokens for GPT-4?

Hello,

I'm currently programming a voice assistant and wanted to connect it to GPT-4. I purchased 50,000 tokens from Shop – ChatGPT , but when I start the program, it says I still don't have access to GPT-4. Do I need to buy the tokens somewhere else?

My code:

 import openai import pyttsx3 import re import pyjokes import speech_recognition as sr from pyowm import OWM import spotipy from spotipy.oauth2 import SpotifyOAuth import time import random import datetime import pytz from geopy.geocoders import Nominatim from timezonefinder import TimezoneFinder openai.api_key = 'sk-...' model_id = "gpt-4" engine = pyttsx3.init() def recognize_speech(): recognizer = sr.Recognizer() while True: with sr.Microphone() as source: print("Sage etwas...") audio = recognizer.listen(source, timeout=15) try: text = recognizer.recognize_google(audio, language="de-DE") print("Text: " + text) return text except sr.UnknownValueError: return "not_understood" except sr.RequestError as e: print(f"Fehler bei der Anfrage an die Google Web Speech API: {e}") return "" def openai_request(prompt): response = openai.ChatCompletion.create( model=model_id, messages=prompt ) api_usage = response['usage'] print('Total Token consumed: {0}'.format(api_usage['total_tokens'])) prompt.append({'role': response.choices[0].message.role, 'content': response.choices[0].message.content}) return prompt def speak(text): engine.say(text) engine.runAndWait() def ausführen(): while True: q = recognize_speech() print("Erkannter Text:", q) if q == "not_understood": speak("Entschuldigung! Das habe ich nicht verstanden.") break elif not q: break elif "hallo" in q: speak('Hallo! Womit kann ich dir behilflich sein?') break else: prompt = [{'role': 'user', 'content': q}] prompt = openai_request(prompt) response = prompt[-1]['content'] speak(response) if __name__ == '__main__': ausführen()

Error code:

C:\Users\User\PycharmProjects\voiceAssistant\venv\interpreter\Scripts\python.exe C:\Users\User\PycharmProjects\voiceAssistant\main.py

Say something…

Text: when was the First World War

Recognized text: when was the First World War

Traceback (most recent call last):

File "C:\Users\User\PycharmProjects\voiceAssistant\main.py", line 83, in <module>

carry out()

Run file "C:\Users\User\PycharmProjects\voiceAssistant\main.py", line 77

prompt = openai_request(prompt)

^^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\User\PycharmProjects\voiceAssistant\main.py", line 43, in openai_request

response = openai.ChatCompletion.create(

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\User\PycharmProjects\voiceAssistant\venv\interpreter\Lib\site-packages\openai\api_resources\chat_completion.py", line 25, in create

return super().create(*args, **kwargs)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\User\PycharmProjects\voiceAssistant\venv\interpreter\Lib\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 153, in create

response, _, api_key = requestor.request(

^^^^^^^^^^^^^^^^^

File "C:\Users\User\PycharmProjects\voiceAssistant\venv\interpreter\Lib\site-packages\openai\api_requestor.py", line 298, in request

resp, got_stream = self._interpret_response(result, stream)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\User\PycharmProjects\voiceAssistant\venv\interpreter\Lib\site-packages\openai\api_requestor.py", line 700, in _interpret_response

self._interpret_response_line(

File "C:\Users\User\PycharmProjects\voiceAssistant\venv\interpreter\Lib\site-packages\openai\api_requestor.py", line 765, in _interpret_response_line

raise self.handle_error_response(

openai.error.InvalidRequestError: The model `gpt-4` does not exist or you do not have access to it. Learn more: https://help.openai.com/en/articles/7102672-how-can-i-access-gpt-4.

Process finished with exit code 1

Kind regards

(2 votes)
Loading...

Similar Posts

Subscribe
Notify of
10 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
FaTech
1 year ago

There are no tokens from GPT. Your shop you found is a third-party provider that does not officially work with OpenAI. This shop probably reads your data. Do not use unknown third-party providers that are not verified. The official model is offered by OpenAI and is only offered as a subscription. As much as you use, you will be debited from your credit card. That means you have to pay a little. There is no other way. If you want a free option, you can also use Meta LLAMA. This is completely free and runs directly on your PC.

guteantwort626
1 year ago

You can find information about ChatGPT 4 pricing models here: https://openai.com/pricing

Fab1anDev
1 year ago

In OpenAI, a tab called pricing or something like that might exist.

Fab1anDev
1 year ago
Reply to  marcus09421
FaTech
1 year ago
Reply to  marcus09421

It’s an Abo Model. You pay as much as you need, no more, no less. That means you always have to pay a little. However, as prices are quite favourable, it should not be too expensive

Fab1anDev
1 year ago

No problem