W
Wasp-lang4mo ago
Sava

ai-generated - 403

When I try to generate a new Wasp app and choose "ai-generated", I put my key in the ENV file. When I echo it, it shows, but when I try to generate, I get this error: Request { host = "api.openai.com" port = 443 secure = True } Also, is there a way to add the GPT-4 model?
9 Replies
kapa.ai
kapa.ai4mo ago
Hi @Sava. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The error message you're seeing suggests that there might be an issue with your OpenAI API key or the way it's being used. When you run wasp new and choose "ai-generated", Wasp will ask you to provide your OpenAI API keys via environment variables. Make sure you've set these correctly in your environment. If you're still encountering issues, you might want to check the validity of your OpenAI API key or if there are any restrictions on it. As for using the GPT-4 model, the current version of Wasp doesn't specify the ability to choose different GPT models. When creating a new Wasp app with Wasp AI, it uses GPT in the background, but it doesn't mention the ability to select a specific version of GPT. You might want to keep an eye on the Wasp documentation or their Discord channel for updates on this feature. Sources: - Creating New App with AI > Wasp CLI (https://wasp-lang.dev/docs/wasp-ai/creating-new-app#wasp-cli) - Creating New App with AI (https://wasp-lang.dev/docs/wasp-ai/creating-new-app) - Discord support thread: hi why iam this problems?: > Answers Part 1 (https://discord.com/channels/686873244791210014/1207695305353596928) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Sava, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
martinsos
martinsos4mo ago
Hm that is weird! But that is not an error really -> what is the rest of your error message? So you shouldn't be putting yout key in the .env.server file -> you sould be making it availabl in your terminal. For example you can set it in your .bashrc or .profile or something like that. GPT-4 -> it is availble, you will be able to choose
Sava
Sava4mo ago
This is the error from terminal Generating plan (slowest step, usually takes 30 to 90 seconds)... Code agent failed with the http error: 403 wasp-bin: HttpExceptionRequest Request { host = "api.openai.com" port = 443 secure = True requestHeaders = [("Content-Type","application/json; charset=utf-8"),("Authorization","<REDACTED>")] path = "/v1/chat/completions" queryString = "" method = "POST" proxy = Nothing rawBody = False redirectCount = 10 responseTimeout = ResponseTimeoutMicro 300000000 requestVersion = HTTP/1.1 proxySecureMode = ProxySecureWithConnect } (StatusCodeException (Response {responseStatus = Status {statusCode = 403, statusMessage = "Forbidden"}, responseVersion = HTTP/1.1, responseHeaders = [("Date","Fri, 21 Jun 2024 10:40:37 GMT"),("Content-Type","application/json; charset=utf-8"),("Transfer-Encoding","chunked"),("Connection","keep-alive"),("vary","Origin"),("x-request-id","703233ccec636afa37852eea89ea9b80"),("strict-transport-security","max-age=31536000; includeSubDomains"),("CF-Cache-Status","DYNAMIC"),("Set-Cookie","cf_bm=1ZBbYNkUcZGxiRlrUOF.IYJvHbRNHVGrCq6gLUOqqKM-1718966437-1.0.1.1-TO0fJSYaB7cTuMzGgOk8iJ1I0XqDctbXPAzQhocqoyP713Wq4V9C46EAm00.qMCBX0im9CY_9OxbLY9FogP_hw; path=/; expires=Fri, 21-Jun-24 11:10:37 GMT; domain=.api.openai.com; HttpOnly; Secure"),("Set-Cookie","_cfuvid=4nrcCfGIrSUVx0ufWw3kL_2m4T1bj0Lloeew43jiU0U-1718966437174-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None"),("Server","cloudflare"),("CF-RAY","897361a768dd5ba6-VIE"),("Content-Encoding","gzip"),("alt-svc","h3=":443"; ma=86400")], responseBody = (), responseCookieJar = CJ {expose = [Cookie {cookie_name = "_cfuvid", cookie_value = "4nrcCfGIrSUVx0ufWw3kL_2m4T1bj0Lloeew43jiU0U-1718966437174-0.0.1.1-604800000", cookie_expiry_time = 3023-10-23 00:00:00 UTC, cookie_domain = "api.openai.com", cookie_path = "/", cookie_creation_time = 2024-06-21 10:40:37.143382 UTC, cookie_last_access_time = 2024-06-21 10:40:37.143382 UTC, cookie_persistent = False, cookie_host_only = False, cookie_secure_only = True, cookie_http_only = True},Cookie {cookie_name = "cf_bm", cookie_value = "1ZBbYNkUcZGxiRlrUOF.IYJvHbRNHVGrCq6gLUOqqKM-1718966437-1.0.1.1-TO0fJSYaB7cTuMzGgOk8iJ1I0XqDctbXPAzQhocqoyP713Wq4V9C46EAm00.qMCBX0im9CY_9OxbLY9FogP_hw", cookie_expiry_time = 2024-06-21 11:10:37 UTC, cookie_domain = "api.openai.com", cookie_path = "/", cookie_creation_time = 2024-06-21 10:40:37.143382 UTC, cookie_last_access_time = 2024-06-21 10:40:37.143382 UTC, cookie_persistent = True, cookie_host_only = False, cookie_secure_only = True, cookie_http_only = True}]}, responseClose' = ResponseClose, responseOriginalRequest = Request { host = "api.openai.com" port = 443 secure = True requestHeaders = [("Content-Type","application/json; charset=utf-8"),("Authorization","<REDACTED>")] path = "/v1/chat/completions" queryString = "" method = "POST" proxy = Nothing rawBody = False redirectCount = 10 responseTimeout = ResponseTimeoutMicro 300000000 requestVersion = HTTP/1.1 proxySecureMode = ProxySecureWithConnect } }) "")
martinsos
martinsos4mo ago
Did you set the env key as I explained ?
Sava
Sava4mo ago
I did and when i eco "echo $OPENAI_API_KEY" in my terminal i get my key
Sava
Sava4mo ago
and when i test it without key i get " ❌ --- [Error] Missing OPENAI_API_KEY environment variable: ----------------------- Wasp AI uses ChatGPT to generate your project, and therefore requires you to provide it with an OpenAI API key. You can obtain this key via your OpenAI account's user settings (https://platform.openai.com/account/api-keys). Then, set OPENAI_API_KEY env var to it and wasp CLI will read from it. To persist the OPENAI_API_KEY env var, add export OPENAI_API_KEY=<yourkeyhere> to your .bash_profile (or .profile or .zprofile or whatever your machine is using), restart your shell, and you should be good to go. Alternatively, you can go to our Mage web app at https://usemage.ai and generate new Wasp app there for free, with no OpenAI API keys needed. "
MAGE GPT Web App Generator ✨ MageGPT
Generate your full-stack React, Node.js and Prisma web app using the magic of GPT and the Wasp full-stack framework.
martinsos
martinsos4mo ago
All right, so sounds like the key is set correctly! The fact that you get 403 is peculiar. Might it be that you are behind a firewall or your access to OpenAI is restricted in some other way? Or incorrect key value?
Sava
Sava4mo ago
Yeah, thanks for the help. My bad internet connection was somehow causing the trouble.
MEE6
MEE64mo ago
Wohooo @Sava, you just became a Waspeteer level 1!
Want results from more Discord servers?
Add your server