Skip to content

Conversation

@kxz2002
Copy link
Contributor

@kxz2002 kxz2002 commented Nov 4, 2025

Motivation

vllm supports adding one or more api-key parameters during service startup or reading them from environment variables. Subsequent requests must include the correct api-key in the request header to be authorized. FastDeploy needs to add this functionality to support API key authentication.

Modifications

Added an authentication middleware in api_server.py, added support for “--api-key” in arg_parser, and introduced the new environment variable “FD_API_KEY”.

Usage or Command

To enable API key authentication in the service startup command, you can add multiple entries:
--api-key key1
--api-key key2
Alternatively, set the environment variable “FD_API_KEY” with multiple API keys separated by commas.

Accuracy Tests

Checklist

  • Add at least a tag in the PR title.
    • Tag list: [[FDConfig],[APIServer],[Engine], [Scheduler], [PD Disaggregation], [Executor], [Graph Optimization], [Speculative Decoding], [RL], [Models], [Quantization], [Loader], [OP], [KVCache], [DataProcessor], [BugFix], [Docs], [CI], [Optimization], [Feature], [Benchmark], [Others], [XPU], [HPU], [GCU], [DCU], [Iluvatar], [Metax]]
    • You can add new tags based on the PR content, but the semantics must be clear.
  • Format your code, run pre-commit before commit.
  • Add unit tests. Please write the reason in this PR if no unit tests.
  • Provide accuracy results.
  • If the current PR is submitting to the release branch, make sure the PR has been submitted to the develop branch, then cherry-pick it to the release branch with the [Cherry-Pick] PR tag.

@paddle-bot
Copy link

paddle-bot bot commented Nov 4, 2025

Thanks for your contribution!

@paddle-bot paddle-bot bot added the contributor External developers label Nov 4, 2025
Copy link
Collaborator

@LiqinruiG LiqinruiG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LiqinruiG LiqinruiG merged commit 87911b7 into PaddlePaddle:develop Nov 8, 2025
12 of 13 checks passed
juncaipeng pushed a commit to juncaipeng/FastDeploy that referenced this pull request Nov 10, 2025
…ication parameter. (PaddlePaddle#4806)

* add api key initial commit

* add unit test

* modify unit test

* move middleware to a single file and add unit tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants