Open-Custom-GPT icon indicating copy to clipboard operation
Open-Custom-GPT copied to clipboard

API key request using other devices

Open hcdgsv opened this issue 1 year ago • 6 comments

Is there a way to set the API key as fixed so that external users can interact with the chat?

I've installed it and it works perfectly in Chrome; however, when I open it in another browser or device, it asks me to enter the API KEY.?

hcdgsv avatar Jan 15 '24 06:01 hcdgsv

It is designed by default to take the api key from the user and use it for generating the response

Anil-matcha avatar Jan 16 '24 07:01 Anil-matcha

is there any way to keep my API key?

hcdgsv avatar Jan 18 '24 16:01 hcdgsv

For me the only job I am looking for is the use of the chat by external people via my key.

SamuelChabal avatar Feb 20 '24 18:02 SamuelChabal

Any news about this ? Would be nice to have the possibility to store an api key for all users. So when you share a custom gpt, the end user has not to put in the API key

vonbarnekowa avatar Mar 08 '24 10:03 vonbarnekowa

Just thinking about the easiest way to do this, then I'll PR an "option" to make it public (without the key being visible to the client)

mledwards avatar May 12 '24 10:05 mledwards

I got this working by changing all the client-side openai calls to server side API calls, so

This...

const messages = await openai.beta.threads.messages.list(threadId);

Becomes this...

const getMessagesResponses = await fetch(`/api/openai`, {
        method: "post",
        body: JSON.stringify({
          method: "messages",
          action: "list",
          threadId,
        }),
      });

      const messages = await getMessagesResponses.json();

And the API route returns this...

const listMessages = await openai.beta.threads[method].list(threadId);
      return NextResponse.json({
        ...listMessages,
      });

See this branch: https://github.com/mledwards/Open-Custom-GPT/tree/update/make-server-side

mledwards avatar May 13 '24 13:05 mledwards

@hcdgsv @SamuelChabal @vonbarnekowa

Now added support for using api key of owner instead of requesting it everytime in the web version. Do try at customgpt.thesamur.ai

Anil-matcha avatar May 19 '24 18:05 Anil-matcha