Closed aftab0094 closed 11 months ago
I've gotten that a few times, just try again later, OpenAI have quite the outage problem.
Closing this issue, since the issue not on ShellGPT side.
I have tried it many times but it always gives this error also tried to use a different api key but failed now this is a problem facing for 3 days I would be happy if i get a better recommendation.
https://help.openai.com/en/articles/6891839-api-error-code-guidance
@TheR1D it seems like 404 is used in nonstandard ways and maybe there is something that could have been done clientside, maybe something with organizations. I think it's time to use the sdk
I have tried it many times but it always gives this error also tried to use a different api key but failed now this is a problem facing for 3 days I would be happy if i get a better recommendation.
Are you sure you have credits in your OpenAI account? I started to get these and realized I had ran out of credits and had auto-recharge turned off.
@aftab0094 Try to make a request from your shell with your API key:
export OPENAI_API_KEY=your_api_key
curl https://api.openai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Hello!"
}
]
}'
And share the response.
I think this might be helpful: https://help.openai.com/en/articles/7102672-how-can-i-access-gpt-4
If you're a Pay-As-You-Go customer and you've made a successful payment of $1 or more, you'll be able to access the GPT-4 API (8k).
Or try to change your default model to gpt-3.5-turbo
the error:
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ /home/kali/.local/lib/python3.11/site-packages/sgpt/app.py:178 in main │ │ │ │ 175 │ │ │ caching=cache, │ │ 176 │ │ ) │ │ 177 │ else: │ │ ❱ 178 │ │ full_completion = DefaultHandler(role_class).handle( │ │ 179 │ │ │ prompt, │ │ 180 │ │ │ model=model, │ │ 181 │ │ │ temperature=temperature, │ │ │ │ ╭─────────────────────────────── locals ────────────────────────────────╮ │ │ │ cache = True │ │ │ │ chat = None │ │ │ │ code = False │ │ │ │ create_role = None │ │ │ │ describe_shell = False │ │ │ │ editor = False │ │ │ │ install_integration = None │ │ │ │ list_chats = None │ │ │ │ list_roles = None │ │ │ │ model = 'gpt-4-1106-preview' │ │ │ │ prompt = 'hi' │ │ │ │ repl = None │ │ │ │ role = None │ │ │ │ role_class = <sgpt.role.SystemRole object at 0x7fb38afa7c50> │ │ │ │ shell = False │ │ │ │ show_chat = None │ │ │ │ show_role = None │ │ │ │ stdin_passed = False │ │ │ │ temperature = 0.0 │ │ │ │ top_probability = 1.0 │ │ │ │ version = None │ │ │ ╰───────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/kali/.local/lib/python3.11/site-packages/sgpt/handlers/handler.py:64 in handle │ │ │ │ 61 │ │ │ 62 │ def handle(self, prompt: str, kwargs: Any) -> str: │ │ 63 │ │ if self.role.name == "ShellGPT" or self.role.name == "Shell Command Descriptor": │ │ ❱ 64 │ │ │ return self._handle_with_markdown(prompt, kwargs) │ │ 65 │ │ return self._handle_with_plain_text(prompt, kwargs) │ │ 66 │ │ │ │ ╭───────────────────────────────────── locals ─────────────────────────────────────╮ │ │ │ kwargs = { │ │ │ │ │ 'model': 'gpt-4-1106-preview', │ │ │ │ │ 'temperature': 0.0, │ │ │ │ │ 'top_probability': 1.0, │ │ │ │ │ 'caching': True │ │ │ │ } │ │ │ │ prompt = 'hi' │ │ │ │ self = <sgpt.handlers.default_handler.DefaultHandler object at 0x7fb38afa6f90> │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/kali/.local/lib/python3.11/site-packages/sgpt/handlers/handler.py:36 in │ │ _handle_with_markdown │ │ │ │ 33 │ │ │ │ │ Markdown(markup="Loading...\r", code_theme=self.theme_name), │ │ 34 │ │ │ │ │ refresh=True, │ │ 35 │ │ │ │ ) │ │ ❱ 36 │ │ │ for word in self.get_completion(messages=messages, kwargs): │ │ 37 │ │ │ │ full_completion += word │ │ 38 │ │ │ │ live.update( │ │ 39 │ │ │ │ │ Markdown(full_completion, code_theme=self.theme_name), │ │ │ │ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ │ │ full_completion = '' │ │ │ │ kwargs = { │ │ │ │ │ 'model': 'gpt-4-1106-preview', │ │ │ │ │ 'temperature': 0.0, │ │ │ │ │ 'top_probability': 1.0, │ │ │ │ │ 'caching': True │ │ │ │ } │ │ │ │ live = <rich.live.Live object at 0x7fb38afa7910> │ │ │ │ messages = [ │ │ │ │ │ { │ │ │ │ │ │ 'role': 'system', │ │ │ │ │ │ 'content': 'You are ShellGPT\nYou are ShellGPT\nYou are │ │ │ │ programming and system administration '+311 │ │ │ │ │ }, │ │ │ │ │ {'role': 'user', 'content': 'hi'} │ │ │ │ ] │ │ │ │ prompt = 'hi' │ │ │ │ self = <sgpt.handlers.default_handler.DefaultHandler object at 0x7fb38afa6f90> │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/kali/.local/lib/python3.11/site-packages/sgpt/handlers/handler.py:60 in get_completion │ │ │ │ 57 │ │ raise NotImplementedError │ │ 58 │ │ │ 59 │ def get_completion(self, kwargs: Any) -> Generator[str, None, None]: │ │ ❱ 60 │ │ yield from self.client.get_completion(kwargs) │ │ 61 │ │ │ 62 │ def handle(self, prompt: str, *kwargs: Any) -> str: │ │ 63 │ │ if self.role.name == "ShellGPT" or self.role.name == "Shell Command Descriptor": │ │ │ │ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ │ │ kwargs = { │ │ │ │ │ 'messages': [ │ │ │ │ │ │ { │ │ │ │ │ │ │ 'role': 'system', │ │ │ │ │ │ │ 'content': 'You are ShellGPT\nYou are ShellGPT\nYou are programming and │ │ │ │ system administration '+311 │ │ │ │ │ │ }, │ │ │ │ │ │ {'role': 'user', 'content': 'hi'} │ │ │ │ │ ], │ │ │ │ │ 'model': 'gpt-4-1106-preview', │ │ │ │ │ 'temperature': 0.0, │ │ │ │ │ 'top_probability': 1.0, │ │ │ │ │ 'caching': True │ │ │ │ } │ │ │ │ self = <sgpt.handlers.default_handler.DefaultHandler object at 0x7fb38afa6f90> │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/kali/.local/lib/python3.11/site-packages/sgpt/client.py:105 in get_completion │ │ │ │ 102 │ │ :param caching: Boolean value to enable/disable caching. │ │ 103 │ │ :return: String generated completion. │ │ 104 │ │ """ │ │ ❱ 105 │ │ yield from self._request( │ │ 106 │ │ │ messages, │ │ 107 │ │ │ model, │ │ 108 │ │ │ temperature, │ │ │ │ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ │ │ caching = True │ │ │ │ messages = [ │ │ │ │ │ { │ │ │ │ │ │ 'role': 'system', │ │ │ │ │ │ 'content': 'You are ShellGPT\nYou are ShellGPT\nYou are │ │ │ │ programming and system administration '+311 │ │ │ │ │ }, │ │ │ │ │ {'role': 'user', 'content': 'hi'} │ │ │ │ ] │ │ │ │ model = 'gpt-4-1106-preview' │ │ │ │ self = <sgpt.client.OpenAIClient object at 0x7fb38afa7d50> │ │ │ │ temperature = 0.0 │ │ │ │ top_probability = 1.0 │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/kali/.local/lib/python3.11/site-packages/sgpt/cache.py:39 in wrapper │ │ │ │ 36 │ │ │ │ yield cache_file.read_text() │ │ 37 │ │ │ │ return │ │ 38 │ │ │ result = "" │ │ ❱ 39 │ │ │ for i in func(args, **kwargs): │ │ 40 │ │ │ │ result += i │ │ 41 │ │ │ │ yield i │ │ 42 │ │ │ cache_file.write_text(result) │ │ │ │ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ │ │ args = ( │ │ │ │ │ <sgpt.client.OpenAIClient object at 0x7fb38afa7d50>, │ │ │ │ │ [ │ │ │ │ │ │ { │ │ │ │ │ │ │ 'role': 'system', │ │ │ │ │ │ │ 'content': 'You are ShellGPT\nYou are ShellGPT\nYou are programming │ │ │ │ and system administration '+311 │ │ │ │ │ │ }, │ │ │ │ │ │ {'role': 'user', 'content': 'hi'} │ │ │ │ │ ], │ │ │ │ │ 'gpt-4-1106-preview', │ │ │ │ │ 0.0, │ │ │ │ │ 1.0 │ │ │ │ ) │ │ │ │ cache_file = PosixPath('/tmp/cache/48e5e53928d5204ccd39dbc4ccdb5bda') │ │ │ │ cache_key = '48e5e53928d5204ccd39dbc4ccdb5bda' │ │ │ │ func = <function OpenAIClient._request at 0x7fb38b22e660> │ │ │ │ kwargs = {} │ │ │ │ result = '' │ │ │ │ self = <sgpt.cache.Cache object at 0x7fb38bd1d510> │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/kali/.local/lib/python3.11/site-packages/sgpt/client.py:68 in _request │ │ │ │ 65 │ │ │ │ f"Invalid OpenAI API key, update your config file: {SHELL_GPT_CONFIG_PAT │ │ 66 │ │ │ │ fg="red", │ │ 67 │ │ │ ) │ │ ❱ 68 │ │ response.raise_for_status() │ │ 69 │ │ # TODO: Optimise. │ │ 70 │ │ # https://github.com/openai/openai-python/blob/237448dc072a2c062698da3f9f512fae3 │ │ 71 │ │ if not stream: │ │ │ │ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ │ │ data = { │ │ │ │ │ 'messages': [ │ │ │ │ │ │ { │ │ │ │ │ │ │ 'role': 'system', │ │ │ │ │ │ │ 'content': 'You are ShellGPT\nYou are ShellGPT\nYou are │ │ │ │ programming and system administration '+311 │ │ │ │ │ │ }, │ │ │ │ │ │ {'role': 'user', 'content': 'hi'} │ │ │ │ │ ], │ │ │ │ │ 'model': 'gpt-4-1106-preview', │ │ │ │ │ 'temperature': 0.0, │ │ │ │ │ 'top_p': 1.0, │ │ │ │ │ 'stream': True │ │ │ │ } │ │ │ │ endpoint = 'https://api.openai.com/v1/chat/completions' │ │ │ │ messages = [ │ │ │ │ │ { │ │ │ │ │ │ 'role': 'system', │ │ │ │ │ │ 'content': 'You are ShellGPT\nYou are ShellGPT\nYou are │ │ │ │ programming and system administration '+311 │ │ │ │ │ }, │ │ │ │ │ {'role': 'user', 'content': 'hi'} │ │ │ │ ] │ │ │ │ model = 'gpt-4-1106-preview' │ │ │ │ response = <Response [404]> │ │ │ │ self = <sgpt.client.OpenAIClient object at 0x7fb38afa7d50> │ │ │ │ stream = True │ │ │ │ temperature = 0.0 │ │ │ │ top_probability = 1.0 │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /usr/lib/python3/dist-packages/requests/models.py:1021 in raise_for_status │ │ │ │ 1018 │ │ │ ) │ │ 1019 │ │ │ │ 1020 │ │ if http_error_msg: │ │ ❱ 1021 │ │ │ raise HTTPError(http_error_msg, response=self) │ │ 1022 │ │ │ 1023 │ def close(self): │ │ 1024 │ │ """Releases the connection back to the pool. Once this method has been │ │ │ │ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ │ │ http_error_msg = '404 Client Error: Not Found for url: │ │ │ │ https://api.openai.com/v1/chat/completions' │ │ │ │ reason = 'Not Found' │ │ │ │ self = <Response [404]> │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯