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

[Feature] Simple API token authentication #1106

Merged
merged 2 commits into from
Jan 23, 2024
Merged

Conversation

taisazero
Copy link
Contributor

@taisazero taisazero commented Sep 20, 2023

I added a few messages to instruct folk to install fschat and accelerate (due to a nested dependency).
I also added native FastAPI access token authentication to vllm's openai server and vanilla server.

@taisazero taisazero changed the title Simple token authentication PR compatible with OAI server. [Feature] Simple API token authentication Sep 29, 2023
@XBeg9
Copy link

XBeg9 commented Nov 20, 2023

Any ideas when this will be merged?

@simon-mo simon-mo self-assigned this Nov 21, 2023
@simon-mo simon-mo self-requested a review November 21, 2023 01:33
@simon-mo
Copy link
Collaborator

Hi @taisazero, thank you for your PR. Can you help modify the code to simplify it:

  • Do not change the demo api server. Only change OpenAI compatible server. We would like to keep the demo server simple. OpenAI server have more features for production.
  • Use starlette or fastapi middleware for token authentication instead. If we can share the same way that OpenAI's client library uses key that would be even better.
  • fschat message is not needed as we are trying to moving towards huggingface chat template.

Thank you again!

@taisazero
Copy link
Contributor Author

@simon-mo I cleaned up the other TODO's. For using middleware do you mean something like this link to remove the need for Depends? I already am using the fastapi- APIKey middleware: https://github.com/taisazero/vllm/blob/main/vllm/entrypoints/openai/api_server.py#L68

@simon-mo
Copy link
Collaborator

Yes. I believe instead of depends, using @app.middleware is a more composable and less intrusive approach: https://fastapi.tiangolo.com/tutorial/middleware/

Additionally, let's make it so the the authentication behaves the following:

  • By default, no auth
  • When the env var or command argument is supplied, check auth

If you can add a snippet to the documentation, that would be even better! Thank you

@simon-mo
Copy link
Collaborator

simon-mo commented Dec 1, 2023

@taisazero please let me know if you need any help in the described items!

@taisazero
Copy link
Contributor Author

taisazero commented Dec 5, 2023

I'll get to it -- just have a lot of deadlines right now 😭

@oushu1zhangxiangxuan1
Copy link
Contributor

Awesome! Long for this!

@Slawikus
Copy link

Slawikus commented Jan 23, 2024

It would be awesome to have this feature merged. Thanks for working on it @taisazero

@simon-mo simon-mo merged commit 9c1352e into vllm-project:main Jan 23, 2024
16 checks passed
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

Successfully merging this pull request may close these issues.

None yet

5 participants