# APEX and GPT-3

Michska and I built a quick application that uses the OpenAI GPT-3 REST API to show results through an APEX application. It's a quick and easy build. You can play with it here: [https://apex.oracle.com/pls/apex/r/anton/ait99-gpt-3/gpt-3](https://apex.oracle.com/pls/apex/r/anton/ait99-gpt-3/gpt-3)

Just put your email as a username, you won't need a password.

# TLDR

If you just want to get the application up and running, do the following:

1. Download the APEX application export file (f\_gpt-3.sql) from here: [https://github.com/ainielse/rando](https://github.com/ainielse/rando)
    
2. Import into your APEX (22.2 or higher) workspace.
    
3. Sign up for an OpenAI account here: [https://openai.com/api/](https://openai.com/api/)
    
4. Create a new secret key
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1676646332949/c40f87c7-f310-404a-a1be-0e0bb0625d08.png align="center")
    
5. When you imported the APEX application it created a web credential: Credentials for OpenAI - GP3. You need to enter the SECRET KEY you just created to that credential. The format is  
    `Bearer blah-bla-bl-blah`  
    or  
    `Bearer [Your SECRET KEY]`
    
6. That's it...Run your application
    

# You're a visual learner

Check out the YouTube video about it: [https://www.youtube.com/watch?v=wDmngdO5lDw](https://www.youtube.com/watch?v=wDmngdO5lDw)

# Potential Pitfalls

Your database may have restrictions about what networks you can access (Network ACLs). Check out my ACL post:  
[https://apexdebug.com/query-to-find-users-granted-an-acl-the-natural-question-after-seeing-ora-24247](https://apexdebug.com/query-to-find-users-granted-an-acl-the-natural-question-after-seeing-ora-24247)

If you get an error complaining about TLS/SSL certificates, here is a script for getting all of the certs you are likely to need into your wallet:  
[https://github.com/Dani3lSun/oracle-ca-wallet-creator](https://github.com/Dani3lSun/oracle-ca-wallet-creator)
