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

Field for API key missing when using custom openai compatible API #427

Open
sammcj opened this issue Oct 26, 2024 · 7 comments
Open

Field for API key missing when using custom openai compatible API #427

sammcj opened this issue Oct 26, 2024 · 7 comments

Comments

@sammcj
Copy link

sammcj commented Oct 26, 2024

When you select to use a custom openai compatible API endpoint the API Key field disappears.

This makes using an openai compatible API impossible unless you have one that doesn't have an API key.

SCR-20241026-tiih
@nichochar
Copy link
Contributor

nichochar commented Oct 28, 2024

Indeed we were not sure what the right abstraction was here. Do most of these services require only one API key? Is it always using the same header or do we need to give people "multiple custom header" edit access.

Because this question wasn't obvious, we so far don't allow any changes.. This allows you to use local models through ollama or other local inference utilities, but does not let you use alternative online providers.

It seems like your provider is AWS bedrock. What does it need for authentication? Simply the API key ?

@sammcj
Copy link
Author

sammcj commented Oct 29, 2024

Most OpenAI compatible APIs require an API key and they're all the same thankfully - simply a a standard bearer token in the header.

For example:

Completions

curl http://localhost:8000/v1/completions -H "Content-Type: application/json" -H "Authorization: Bearer abcdefhijqlmnop123" -d '{
  "model": "facebook/opt-125m",
  "prompt": "tell me a joke",
  "max_tokens": 512,
  "temperature": 0,
}'

Listing models

curl https://openai-compat.local/v1/models -H "Content-Type: application/json" -H "Authorization: Bearer abcdefhijqlmnop123"

etc...

@nichochar
Copy link
Contributor

Alright in that case we can simply add an optional API key field to the settings page. Do you want to take a stab at it by any chance?

@Lokendra-sinh
Copy link

Hey @nichochar I'm back. Ready to work on this :)

@nichochar
Copy link
Contributor

Awesome, if you check this PR I recently made it shows most of the work needed to get this working (to add a new field to the config, you'll have to use the pnpm run migrate and pnpm run generate commands, as described in the README, and there's a bug where drizzle adds an annoying comment in the generated sql file, just delete that.

@ttkrpink
Copy link

So, when can we use the API key field? thanks

@MohdSaleh
Copy link

any update on this?

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