How to Run ChatGPT on Raspberry Pi or PC

ChatGPT on Raspberry Pi
(Image credit: Tom's Hardware)

You will not have missed the frenzy of excitement surrounding ChatGPT (Chat Generative-Pre-Trained Transformer). It can create images, write code, songs, poetry and try to solve our problems, big or small. It may not know how to beat Star Trek’s Kobayashi Maru simulation, but it can write Python and Bash code with ease. At a push it can also be used to write G-Code for the best 3D printers though we have yet to try it on our Creality Ender 2 Pro.

Typically we interact with ChatGPT via the browser, but in this how to, we will use a special Python library that will connect our humble Raspberry Pi to the powerful AI and provide us with a tool to answer almost any question. This project is not exclusive to Raspberry Pi; it can also be used with Windows, macOS and Linux PCs. If you can run Python on it, then chances are this project will also work. 

Latest Videos FromTom's Hardware
Les Pounder
Associate Editor

Les Pounder is an associate editor at Tom's Hardware. He is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training program "Picademy".

  • siddhesh22
    This article is plain wrong. The ChatGPT API is not yet released and the model suggested in the article - "text-davinci-003" is a GPT3 model whereas ChatGPT is a separate GPT3.5 model trained on InstructGPT to follow instructions properly.
    Reply
  • Hckngrtfakt
    siddhesh22 said:
    This article is plain wrong. The ChatGPT API is not yet released and the model suggested in the article - "text-davinci-003" is a GPT3 model whereas ChatGPT is a separate GPT3.5 model trained on InstructGPT to follow instructions properly.
    text-davinci-003 is a model used by ChatGPT just as text-curie-001, text-babbage-001 & text-ada-001 but this has nothing to do with the official API as any other front end can submit queries to these data sets and receive a similar response, in the same sense that stable diffusion uses different "models".

    You may want to research a bit more on this topic before accusing any articles of being incorrect,.... if anything there's just a small fix needed

    the complete code listing contains a syntax error
    except KeyboardInterrupt:
    print("\nExiting ChatGPT")
    should be
    except KeyboardInterrupt:
    print("\nExiting ChatGPT")
    Reply
  • JockyMacIntosh
    After copy and pasting your code and adding my api I get the following error
    File "/home/tam/.local/lib/python3.9/site-packages/openai/api_requestor.py", line 680, in _interpret_response_line
    raise self.handle_error_response(
    openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details.
    Does this actually work on the free version ?
    Reply
  • edzieba
    Run ChatGPT on Raspberry Pi or PC
    This article is not anything to do with running any language model (GPT or otherwise) on a Raspberry Pi or PC. It is merely how to interface with a language model run by a third party.
    It would be like titling an article "how to run Doom on a Raspberry Pi" and providing steps on how to display streamed video from Geforce Now.
    Reply
  • elcano21
    Hckngrtfakt said:
    text-davinci-003 is a model used by ChatGPT just as text-curie-001, text-babbage-001 & text-ada-001 but this has nothing to do with the official API as any other front end can submit queries to these data sets and receive a similar response, in the same sense that stable diffusion uses different "models".

    You may want to research a bit more on this topic before accusing any articles of being incorrect,.... if anything there's just a small fix needed

    the complete code listing contains a syntax error
    except KeyboardInterrupt:
    print("\nExiting ChatGPT")
    should be
    except KeyboardInterrupt:
    print("\nExiting ChatGPT")

    Clickbait anyway. From the Wikipedia article: "...released ChatGPT, which was fine-tuned from a model in the GPT-3.5 series." In other words:

    ChatGPT <> GPT3.5, but a fine tuned version instead. The author could have stated the truth, "How to invoke the GPT3.5 API from a Raspberry Pi" in the title, but that wouldn't have reached as many clicks as the popular ChatGPT term, so he decided to inflate the claim instead.
    As already commented the uninitiated would be very attracted to the possibility of running ChatGPT on a Raspberry Pi, although anybody with an idea of the size of this language model knows that this would be impossible. Yet, anything is valid if you need to fulfill a quota I guess.
    Reply
  • Iamflimflam1
    Looks very similar to a tutorial I wrote . But to be honest it’s very simple to use the ooenAI APIs to make a chat bot.

    However. It’s not ChatGPT. It can ve made to superficially behave in a similar way, but it’s not going to be as good.

    jQFhtFMDz1sView: https://youtu.be/jQFhtFMDz1s
    Reply
  • sprout__
    What's a fair name for what OP is doing without advertising it as ChatGPT. ChatGPT API? Something else?
    Reply