Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API key request using other devices #20

Closed
hcdgsv opened this issue Jan 15, 2024 · 7 comments
Closed

API key request using other devices #20

hcdgsv opened this issue Jan 15, 2024 · 7 comments

Comments

@hcdgsv
Copy link

hcdgsv commented Jan 15, 2024

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.?

@Anil-matcha
Copy link
Contributor

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

@hcdgsv
Copy link
Author

hcdgsv commented Jan 18, 2024

is there any way to keep my API key?

@SamuelChabal
Copy link

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

@vonbarnekowa
Copy link

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

@mledwards
Copy link

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
Copy link

mledwards commented May 13, 2024

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

@Anil-matcha
Copy link
Contributor

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants