Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / Is it possible to get a response from the ChatGPT API using SendHTTPRequest?

Author
Message
mattyjy2k
21
Years of Service
User Offline
Joined: 26th Jan 2003
Location:
Posted: 11th Apr 2023 20:41 Edited at: 11th Apr 2023 21:00
Hi, I have been playing around trying to get a response from the ChatGPT API directly in AppGameKit Studio using SendHTTPRequest, but I can't seem to figure it out. I asked ChatGPT for help and it said this:

I'm not sure if that is correct advice or a ChatGPT hallucination. But if anybody could give me an example of AppGameKit tier 1 code that works to access the ChatGPT API, I would be really grateful.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 12th Apr 2023 02:31 Edited at: 12th Apr 2023 02:48
Quote: "Retrieve and parse the response"

ChatGPT should have some API docs? and, do they have a free dev option? i'm not seeing one or i would test it out.

otherwise, i expect it would be a process similar to this DNS lookup snippet.

add: i did see a "$5 credit" for testing. then, skimming the docs and it doesn't seem as simple as the DNS lookup example (and i'm not up for the challenge ATM ).
mattyjy2k
21
Years of Service
User Offline
Joined: 26th Jan 2003
Location:
Posted: 12th Apr 2023 08:12
Hi Virtual Nomad,

Thanks for the reply. I received $18 in free API credit when signing up for an OpenAI account. I have been using it for months for hundreds of API calls and have only used under $4 of the free credit. It seems that they are only giving $5 to some people, maybe because of the increased number of users.

To be honest, I thought I was just missing something obvious with HTTP requests, so it makes me feel a little better that it might be more complicated. I have only learned some basic code with Dark Basic and Tier 1 code with AppGameKit, as well as a bit of Python coding.

I wanted to implement the Chat GPT API to give the NPCs in one of my game projects some memory and personality. I can probably get the API call back into AppGameKit by asking ChatGPT to write some JavaScript code for me to run on my web server, and then just make an HTTP request for the JSON or string output. However, this seems a bit convoluted, so I was hoping to query the API directly from AppGameKit code.

If anybody knows of any code that would work, that would be great. In the meantime, I will look into your DNS lookup snippet to see if that can help.
mattyjy2k
21
Years of Service
User Offline
Joined: 26th Jan 2003
Location:
Posted: 12th Apr 2023 08:12 Edited at: 12th Apr 2023 08:23
Thanks for looking into it for me, Virtual Nomad. I really appreciate you taking the time. I love the community here on GameCreators, and even the developers are super nice and really helpful. I just really wish the community was a lot larger. Can't believe it's been 20 years since I started playing around with Dark Basic. Time flies.

Login to post a reply

Server time is: 2024-04-20 05:17:35
Your offset time is: 2024-04-20 05:17:35