# Serve an OpenAI-compatible API with vLLM

vLLM's OpenAI-compatible server is an HTTP server that implements OpenAI's Completions API, Chat API and more, so an OpenAI client talks to your own model by changing its base_url to the vLLM server's /v1 address.

Updated: 2026-12-03

Published: 2026-11-16

## What is the vLLM OpenAI-compatible server?

`vllm serve MODEL` starts vLLM's HTTP server. The [vLLM documentation](https://docs.vllm.ai/en/stable/serving/online_serving/openai_compatible_server/) lists these endpoints:

| Path | Purpose |
|---|---|
| `/v1/completions` | Completions API |
| `/v1/chat/completions` | Chat Completions API |
| `/v1/chat/completions/batch` | Chat Completions batch API |
| `/v1/responses` | Responses API |
| `/v1/embeddings` | Embeddings API |
| `/v1/audio/transcriptions` | Transcriptions API |
| `/v1/audio/translations` | Translation API |

The documented start command with an API key is `vllm serve NousResearch/Meta-Llama-3-8B-Instruct --dtype auto --api-key token-abc123`.

## How do I start the server and call it from my machine?

1. Start the server on the instance with `vllm serve MODEL` and the `--api-key` option.
2. On NVIDIA Brev, forward the server's port to your own machine with `brev port-forward my-instance --port 8000:8000`.
3. Create an `OpenAI` client whose `base_url` is the server's `/v1` address on port `8000` of your own machine.
4. Set the client's `api_key` to the key given to `--api-key`.
5. Send requests to one of the endpoints in the table above, such as `/v1/chat/completions`.

The vLLM documentation's Python example creates an `OpenAI` client whose `base_url` is the server's `/v1` address on port `8000` and whose `api_key` is the key given to `--api-key`.

The [Brev CLI connectivity reference](https://docs.nvidia.com/brev/latest/cli/connectivity.md) describes `brev port-forward` as forwarding a TCP port from your instance to your own machine over SSH; its example is `brev port-forward my-instance --port 8888:8888`.

> **Note:** The `--port` value is `local:remote`: the first number is the port on your machine and the second is the port on your instance.

For a vLLM server on port `8000`, the same form is `--port 8000:8000`. With the port forwarded, port `8000` on your machine reaches the server on the instance, and the client's `base_url` points at that port's `/v1` path.

## How do I set a vLLM API key and call it?

1. Start the server with `--api-key YOUR_KEY`, or set the `VLLM_API_KEY` environment variable instead.
2. In the OpenAI client, set `api_key` to the same value and `base_url` to the server's `/v1` address.
3. Without the key, requests to `/v1` endpoints are refused; with it, they are served.

Pick your own long random value for the key, keep it out of your code, and pass it to the client from an environment variable. The option and the variable are documented in the [vLLM OpenAI-compatible server](https://docs.vllm.ai/en/stable/serving/online_serving/openai_compatible_server/) page.

## Which vllm-openai Docker image do our Launchables use?

As of 2026-11-28, our vLLM Launchables pin the image `vllm/vllm-openai:v0.33.0`.

| Item | Open WebUI + vLLM Launchable | Open Notebook on Nemotron Launchable |
|---|---|---|
| Image | `vllm/vllm-openai:v0.33.0` | `vllm/vllm-openai:v0.33.0`, pinned by digest |
| GPU | 1x NVIDIA L40S 48GB | 1x NVIDIA L40S 48GB |
| Instance type | AWS g6e.xlarge | AWS g6e.xlarge |
| Price | about $2.25/hr (Brev deploy page, 2026-12-03) | about $2.26/hr (Brev console, 2026-11-19) |
| Default model | `Qwen/Qwen3-8B` | `nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-FP8` |
| API port | `8000`, bound to the instance | `8000`, bound to the instance |

## What did our test of a vLLM API show?

Our fresh-deploy test of the Open Notebook on Nemotron Launchable on AWS g6e.xlarge, 2026-11-15, called its vLLM chat API on the instance:

- `/v1/models` listed the chat model 28.0 minutes after create.
- A chat completion asking for "OK" returned `"content":"OK"` with `finish_reason` `stop`.
- After a stop and start, the model was listed and chat answered again about 9.3 minutes after start.

## How do I keep the API private?

Three controls work together:

- Bind the API to the instance. In the [Open WebUI + vLLM Launchable](https://www.9owls.com/launchables/open-webui-vllm/), the vLLM API is bound to the instance itself and is not exposed publicly; you reach it through the port forward.
- Set an API key. The `--api-key` option, or the `VLLM_API_KEY` environment variable, authenticates requests to endpoints under the `/v1`, `/v2`, `/inference` and `/cohere` path prefixes.
- Choose how a port is exposed. On NVIDIA Brev, Secure Links protect HTTP services with Brev authentication, and TCP/UDP ports are exposed to all IP addresses or only to the deployer's IP address ([NVIDIA Brev Launchables](https://docs.nvidia.com/brev/latest/concepts/launchables.md)).

## How do I run it on NVIDIA Brev?

Deploy the [Open WebUI + vLLM Launchable](https://www.9owls.com/launchables/open-webui-vllm/). It runs vLLM v0.33.0 (image `vllm/vllm-openai:v0.33.0`) with `Qwen/Qwen3-8B` on one NVIDIA L40S 48GB GPU, and Open WebUI as a chat interface on the same API. The deploy steps are in [how to deploy a Launchable on NVIDIA Brev](https://www.9owls.com/guides/deploy-a-launchable-on-nvidia-brev/).

Next steps for a vLLM API on NVIDIA Brev:

- [Run Open WebUI with vLLM on a cloud GPU](https://www.9owls.com/guides/run-open-webui-with-vllm-on-a-cloud-gpu/) explains how Open WebUI connects to the vLLM API.
- [Serve NVIDIA Nemotron with vLLM](https://www.9owls.com/guides/serve-nvidia-nemotron-with-vllm/) calls a Nemotron checkpoint through the same OpenAI-compatible API.
- [NVIDIA L4 vs L40S for LLM inference](https://www.9owls.com/compare/nvidia-l4-vs-l40s-for-llm-inference/) compares GPU memory and model fit.
- [Ollama vs vLLM](https://www.9owls.com/compare/ollama-vs-vllm/) compares a single-user model server with one built for many concurrent users.
- [Stop, start and delete an NVIDIA Brev instance](https://www.9owls.com/guides/stop-start-and-delete-an-nvidia-brev-instance/) ends GPU charges when you are done.

## What if vLLM will not start because of GPU memory?

If the server stops at startup with `ValueError: No available memory for the cache blocks`, read [what we saw with two vLLM servers on a shared GPU](https://www.9owls.com/guides/vllm-cache-blocks-memory-error/). It covers two vLLM servers on one GPU, the `--gpu-memory-utilization` share and the settings the vLLM docs name.

## Built your own vLLM stack? Can NightKeeper package it as a Launchable?

NightKeeper packages your repository as an NVIDIA Brev Launchable, proves it on a fresh GPU and keeps it running. Point NightKeeper at your repository, review the pull request whose GitHub Actions workflow smoke-tests the stack on a fresh NVIDIA Brev instance, then create the Launchable in the Brev console with the settings NightKeeper provides. Your Brev API key stays in your repository's GitHub secrets. NightKeeper never sees it.

[Create your Launchable](https://www.9owls.com/nightkeeper/start/) or [read about NightKeeper](https://www.9owls.com/nightkeeper/).

## Sources: where do these facts come from?

- [vLLM OpenAI-compatible server](https://docs.vllm.ai/en/stable/serving/online_serving/openai_compatible_server/), read 2026-11-16
- [Brev CLI connectivity reference](https://docs.nvidia.com/brev/latest/cli/connectivity.md), read 2026-11-16
- [NVIDIA Brev Launchables](https://docs.nvidia.com/brev/latest/concepts/launchables.md), read 2026-11-16
- Launchable records for Open WebUI + vLLM and Open Notebook on Nemotron (images, GPU, prices), read 2026-11-28
- 9owls fresh-deploy test record for the Open Notebook on Nemotron Launchable, 2026-11-15

## How was this page made?

9owls published this page. The server, endpoint and API key facts come from the vLLM documentation, and the port-forward facts from the NVIDIA Brev documentation, read on the dates above. The image, GPU and price rows come from our Launchable records, each with its own date. The test values come from our fresh-deploy test on 2026-11-15. Found an error? Tell us on the [company page](https://www.9owls.com/company/#contact).

What changed on 2026-11-28: added the API key steps, the pinned image and hardware table, our recorded test values and the link to the cache-blocks error page.

## Related pages

- [Open WebUI + vLLM](https://www.9owls.com/launchables/open-webui-vllm/)
- [Run Open WebUI with vLLM on a cloud GPU](https://www.9owls.com/guides/run-open-webui-with-vllm-on-a-cloud-gpu/)
- [Ollama vs vLLM](https://www.9owls.com/compare/ollama-vs-vllm/)
- [Chat and model serving](https://www.9owls.com/topics/chat-and-model-serving/)
- [vLLM No available memory for the cache blocks on a shared GPU](https://www.9owls.com/guides/vllm-cache-blocks-memory-error/)
- [NightKeeper](https://www.9owls.com/nightkeeper/)

[All guides](https://www.9owls.com/guides/)
