#Using Webflow's Logic to make HTTP Requests to ChatGPT's API

35 messages · Page 1 of 1 (latest)

hushed hedge
#

Hey yall thanks for having this available! I am interested in using ChatGPT's API to help me build a website off of Webflow, right now I'm using their Logic feature to make HTTP Requests to the API and was having trouble finding the "endpoint URL" I need from the (https://beta.openai.com/docs/api-reference/making-requests) API manual on the site. It has TERRIFIC instructions for those coding it from the ground up but I'm a little confused as to what the endpoint URL I need at this juncture

hushed hedge
#

{
"error": {
"message": "You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://beta.openai.com.",
"type": "invalid_request_error",
"param": null,
"code": null
}
}

autumn shuttle
#

Hi there, there is no api for ChatGPT, the most similar that you can use is the Completions API, which you linked, the model davinci003 that is available in completions is what chatGPT is built off

autumn shuttle
hushed hedge
# autumn shuttle How are you doing your request?

I make a "HTTP Request" block in Webflow, choose the "API Token" choice under "Authentication" and "Header" under "Add to" and then write "Authorization" in the "Header" field before adding my secret API key in the "Credentials" field and name it "Authorization: Bearer" leaving an empty description and choosing the "API token" option in the "Type" field followed by my API key in the "Token" field, I haven't touched the "Request Method" but it's on "GET" and then under "General" and "URL" I use (https://api.openai.com/v1/completions) and then run the test

autumn shuttle
#

Can you export the raw request from webflow and show me it? With the auth token blurred out ofc

hushed hedge
autumn shuttle
#

basically, we wanna confirm that ur request is formatted with a

“Authorization Bearer <your token>” somewhere at the top of the request

hushed hedge
#

But I added "Bearer" before my API key this time and it kind of worked

{
"error": {
"message": "you must provide a model parameter",
"type": "invalid_request_error",
"param": null,
"code": null
}
}

autumn shuttle
#

Yeah now you’re making progress, add the required parameters for he model now into the request

hushed hedge
autumn shuttle
#

Yeah I’m not too sure about webflow, but when I get some free time I’ll look into it and can get back to you, ping me in 24h to remind me? In the meantime, try to search for where you can add post parameters to a request on webflow

hushed hedge
#

Reaching out to the proper Webflow communities and support channels now ❤️

autumn shuttle
#

Sounds good, let me know how it goes

hushed hedge
hushed hedge
autumn shuttle
#

Can I see the email they sent you? @hushed hedge

hushed hedge
#

This came after they asked for shots of my Flow setup

#

The last one comes when I run the test

#

If I swap to Params to enter "davinci" then it says I'm not sending my API key anymore

#

{
"error": {
"message": "You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://beta.openai.com.",
"type": "invalid_request_error",
"param": null,
"code": null
}
}

autumn shuttle
#

Yeah, the issue still lies in you not sending all of the parameters that the model is expecint

#

It looks like you're either sending an Authorization Bearer token or a Model parameter, not both

#

you need to send both + a bunch of other parameters to get it to work, so you need to figure out how to add "post parameters" to that Webflow request

#

Their email response was useless 😦

hushed hedge
#

Hahaha exactly, you get it! I'm just waiting on a reply to my email and some kind of response in their discord

autumn shuttle
#

What other tools are you familiar with?

#

other than webflow for stuff like this?

hushed hedge
#

Nothing but I'm more than willing to learn, I just want to make something

autumn shuttle
#

That looks much better! I see the post parameters there 🙂