A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 15, 02:15 UTC
Add full serve CLI reference back to docs (#20978)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Harry Mellor committed
Jul 15, 2025 at 18:42 UTC
b637e9dcb83d81ff5a2a3ae96bd90f94bc964994
6 files changed
+58
-35
docs/cli/README.md
+8
@@ -1,3 +1,7 @@
1
+---
2
+toc_depth: 4
3
+---
4
+
5
# vLLM CLI Guide
6
7
The vllm command-line tool is used to run and manage vLLM models. You can start by viewing the help message with:
@@ -42,6 +46,10 @@ Start the vLLM OpenAI Compatible API server.
46
vllm serve --help=page
47
```
48
49
+### Options
50
+
51
+--8<-- "docs/argparse/serve.md"
52
+
53
## chat
54
55
Generate chat completions via the running API server.
docs/configuration/serve_args.md
+1
-1
@@ -5,7 +5,7 @@ The `vllm serve` command is used to launch the OpenAI-compatible server.
5
## CLI Arguments
6
7
The `vllm serve` command is used to launch the OpenAI-compatible server.
8
-To see the available CLI arguments, run `vllm serve --help`!
8
+To see the available options, take a look at the [CLI Reference](../cli/README.md#options)!
9
10
## Configuration file
11
docs/mkdocs/hooks/generate_argparse.py
+20
-3
@@ -16,6 +16,7 @@ sys.modules["blake3"] = MagicMock()
16
sys.modules["vllm._C"] = MagicMock()
17
18
from vllm.engine.arg_utils import AsyncEngineArgs, EngineArgs # noqa: E402
19
+from vllm.entrypoints.openai.cli_args import make_arg_parser # noqa: E402
20
from vllm.utils import FlexibleArgumentParser # noqa: E402
21
22
logger = logging.getLogger("mkdocs")
@@ -24,15 +25,18 @@ logger = logging.getLogger("mkdocs")
25
class MarkdownFormatter(HelpFormatter):
26
"""Custom formatter that generates markdown for argument groups."""
27
27
- def __init__(self, prog):
28
+ def __init__(self, prog, starting_heading_level=3):
29
super().__init__(prog,
30
max_help_position=float('inf'),
31
width=float('inf'))
32
+ self._section_heading_prefix = "#" * starting_heading_level
33
+ self._argument_heading_prefix = "#" * (starting_heading_level + 1)
34
self._markdown_output = []
35
36
def start_section(self, heading):
37
if heading not in {"positional arguments", "options"}:
35
- self._markdown_output.append(f"\n### {heading}\n\n")
38
+ heading_md = f"\n{self._section_heading_prefix} {heading}\n\n"
39
+ self._markdown_output.append(heading_md)
40
41
def end_section(self):
42
pass
@@ -46,9 +50,13 @@ class MarkdownFormatter(HelpFormatter):
50
51
def add_arguments(self, actions):
52
for action in actions:
53
+ if (len(action.option_strings) == 0
54
+ or "--help" in action.option_strings):
55
+ continue
56
57
option_strings = f'`{"`, `".join(action.option_strings)}`'
51
- self._markdown_output.append(f"#### {option_strings}\n\n")
58
+ heading_md = f"{self._argument_heading_prefix} {option_strings}\n\n"
59
+ self._markdown_output.append(heading_md)
60
61
if choices := action.choices:
62
choices = f'`{"`, `".join(str(c) for c in choices)}`'
@@ -81,6 +89,14 @@ def create_parser(cls, **kwargs) -> FlexibleArgumentParser:
89
return cls.add_cli_args(parser, **kwargs)
90
91
92
+def create_serve_parser() -> FlexibleArgumentParser:
93
+ """Create a parser for the serve command with markdown formatting."""
94
+ parser = FlexibleArgumentParser()
95
+ parser.formatter_class = lambda prog: MarkdownFormatter(
96
+ prog, starting_heading_level=4)
97
+ return make_arg_parser(parser)
98
+
99
+
100
def on_startup(command: Literal["build", "gh-deploy", "serve"], dirty: bool):
101
logger.info("Generating argparse documentation")
102
logger.debug("Root directory: %s", ROOT_DIR.resolve())
@@ -95,6 +111,7 @@ def on_startup(command: Literal["build", "gh-deploy", "serve"], dirty: bool):
111
"engine_args": create_parser(EngineArgs),
112
"async_engine_args": create_parser(AsyncEngineArgs,
113
async_args_only=True),
114
+ "serve": create_serve_parser(),
115
}
116
117
# Generate documentation for each parser
requirements/docs.txt
+1
@@ -17,6 +17,7 @@ cloudpickle
17
fastapi
18
msgspec
19
openai
20
+partial-json-parser
21
pillow
22
psutil
23
pybase64
vllm/entrypoints/cli/serve.py
-31
@@ -67,37 +67,6 @@ class ServeSubcommand(CLISubcommand):
67
help="Start the vLLM OpenAI Compatible API server.",
68
description="Start the vLLM OpenAI Compatible API server.",
69
usage="vllm serve [model_tag] [options]")
70
- serve_parser.add_argument("model_tag",
71
- type=str,
72
- nargs='?',
73
- help="The model tag to serve "
74
- "(optional if specified in config)")
75
- serve_parser.add_argument(
76
- "--headless",
77
- action='store_true',
78
- default=False,
79
- help="Run in headless mode. See multi-node data parallel "
80
- "documentation for more details.")
81
- serve_parser.add_argument(
82
- '--data-parallel-start-rank',
83
- '-dpr',
84
- type=int,
85
- default=0,
86
- help="Starting data parallel rank for secondary nodes. "
87
- "Requires --headless.")
88
- serve_parser.add_argument('--api-server-count',
89
- '-asc',
90
- type=int,
91
- default=1,
92
- help='How many API server processes to run.')
93
- serve_parser.add_argument(
94
- "--config",
95
- type=str,
96
- default='',
97
- required=False,
98
- help="Read CLI options from a config file. "
99
- "Must be a YAML with the following options: "
100
- "https://docs.vllm.ai/en/latest/configuration/serve_args.html")
70
71
serve_parser = make_arg_parser(serve_parser)
72
show_filtered_argument_or_group_from_help(serve_parser, ["serve"])
vllm/entrypoints/openai/cli_args.py
+28
@@ -236,6 +236,34 @@ def make_arg_parser(parser: FlexibleArgumentParser) -> FlexibleArgumentParser:
236
register all arguments instead of manually enumerating them here. This
237
avoids code duplication and keeps the argument definitions in one place.
238
"""
239
+ parser.add_argument("model_tag",
240
+ type=str,
241
+ nargs="?",
242
+ help="The model tag to serve "
243
+ "(optional if specified in config)")
244
+ parser.add_argument(
245
+ "--headless",
246
+ action="store_true",
247
+ default=False,
248
+ help="Run in headless mode. See multi-node data parallel "
249
+ "documentation for more details.")
250
+ parser.add_argument(
251
+ "--data-parallel-start-rank",
252
+ "-dpr",
253
+ type=int,
254
+ default=0,
255
+ help="Starting data parallel rank for secondary nodes. "
256
+ "Requires --headless.")
257
+ parser.add_argument("--api-server-count",
258
+ "-asc",
259
+ type=int,
260
+ default=1,
261
+ help="How many API server processes to run.")
262
+ parser.add_argument(
263
+ "--config",
264
+ help="Read CLI options from a config file. "
265
+ "Must be a YAML with the following options: "
266
+ "https://docs.vllm.ai/en/latest/configuration/serve_args.html")
267
parser = FrontendArgs.add_cli_args(parser)
268
parser = AsyncEngineArgs.add_cli_args(parser)
269