You are viewing limited content. For full access, please sign in.

Question

Question

chatgpt

asked on August 21, 2023

Has anyone managed to create a web service connection to ChatGPT?

I'm trying by using 'no authentication' and typing this as the endpoint - https://api.openai.com/v1  - but getting a 401 return code.

1 0

Replies

replied on August 21, 2023

I get a json response accessing this with a browser, but that is a get request. You must make a post request and authenticate with your API key if you want to call any methods based on all the documentation that I see. I don't know of any method to talk to gpt anonymously, they want everyone to have accounts and limitations.

0 0
replied on August 21, 2023 Show version history

Hey Chad, thanks for your response,

Yeah I have an account and a token, I just don't know how to authenticate properly. I've tried using the token in the header but I'm not sure how to make the request work, i.e. is it OAuth 2.0 or No Authentication or what.

auth.png
auth.png (40.34 KB)
0 0
replied on August 21, 2023

Looks correct. You can leave it at No Authentication, OAuth 2.0 allows you to automate using a secret which it looks like they don't require.

So what happens when you try to execute a method? For example something like this:

https://youtu.be/bgQXSjk18mg?t=153

 

0 0
replied on August 21, 2023 Show version history

I can't execute a method unless I create a web service connection first, so that's the bit I'm still stuck at. I can execute a method using postman so there is nothing wrong with the token, it's obviously just the syntax of my attempt to create the connection in Laserfiche. I've looked at this but it's not really helping me > https://platform.openai.com/docs/plugins/authentication

0 0
replied on August 22, 2023

Which model are you trying to use? The endpoint can vary depending on the model. For example:

 

If you are using chat completions, the request body must have 2 sections: 1 defines the role and content, the other defines the body parameters. For completions, the request body only needs 1 section that defines the body parameters and the prompt.

The link you posted is for plugin authentication. You are not creating a plugin — this is purely an API call. You should focus on following this documentation: API Reference - OpenAI API

1 0
replied on August 22, 2023 Show version history

Hi Kevin,

Thanks for your feedback.

Where I was getting hung up was when trying to create a web service connection, it wasn't returning a 200 code (returning 404), so I was concerned that without that being 200, the web request rules wouldn't work.

But ended up putting the whole endpoint in there (even though it didn't return a 200 code), then created the rule with all the json, and it worked. 

So the web service connection not returning a valid result is irrelevant, something I found out in this exercise.

0 0
replied on August 22, 2023

Works for me with this config for web service and web request rule

Web Request Rule

1 0
replied on August 22, 2023

Hey Chad, cheers, see my post above.

0 0
replied on August 22, 2023

Oh yes I see, I get a 404 when I test too, that is because your not supposed to call the base URL without a method (URI and parameters), so you really can not test until you create your web request rule.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.