Skip to content

[Feature] Simple API token authentication - #1106

Merged
simon-mo merged 2 commits into
vllm-project:mainfrom
taisazero:main
Jan 23, 2024
Merged

simon-mo merged 2 commits into
vllm-project:mainfrom
taisazero:main

Conversation

@taisazero

@taisazero taisazero commented Sep 20, 2023 •

Copy link
Copy Markdown
Contributor

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

XBeg9 commented Nov 20, 2023

Copy link
Copy Markdown

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

simon-mo commented Dec 1, 2023

Copy link
Copy Markdown
Collaborator

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

@taisazero

taisazero commented Dec 5, 2023 •

Copy link
Copy Markdown
Contributor Author

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

@oushu1zhangxiangxuan1

Copy link
Copy Markdown
Contributor

Awesome! Long for this!

@Slawikus

Slawikus commented Jan 23, 2024 •

Copy link
Copy Markdown

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
pi314ever pushed a commit to pi314ever/vllm that referenced this pull request May 22, 2025
amy-why-3459 pushed a commit to amy-why-3459/vllm that referenced this pull request Sep 15, 2025
Add the release note for v0.9.0rc1

Signed-off-by: wangxiyuan <wangxiyuan1007@gmail.com>
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.

5 participants