OpenAI 호환 서버
문서 상태
소유: LLMOps · 기준: vLLM HyperAccel 0.0.5 · 최종 확인: 2026-10-15
개요
vLLM은 OpenAI의 Completions API와 Chat API를 구현한 HTTP 서버를 제공합니다. LPU는 플랫폼 플러그인으로 붙으므로
vllm serve로 띄운 서버가 그대로 OpenAI 호환 API를 엽니다. 서버 자체에 대한 자세한 설명은
vLLM 문서를 참고합니다.
서버 실행
| vllm serve Qwen/Qwen3-8B --max-model-len 16384 --no-enable-prefix-caching --no-async-scheduling
|
로그에 플랫폼 플러그인 bertha가 활성화되었다고 나오고 Application startup complete.로 끝나면 준비된 것입니다.
기본 주소는 http://localhost:8000/v1입니다. 외부에서 접근하려면 --host 0.0.0.0을, 다른 포트를 쓰려면
--port를 지정합니다.
컨테이너로 띄우는 방법은 설치에 있습니다.
서버 상태 확인
| curl http://localhost:8000/health # 상태
curl http://localhost:8000/v1/models # 서빙 중인 모델
curl http://localhost:8000/metrics # Prometheus 지표
|
cURL로 요청
Completions API
| curl http://localhost:8000/v1/completions \
-H "Content-Type: application/json" \
-d '{
"model": "Qwen/Qwen3-8B",
"prompt": "Hello! How is the weather today?",
"max_tokens": 100,
"temperature": 0.7,
"top_p": 0.9
}'
|
Chat Completions API
| curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "Qwen/Qwen3-8B",
"messages": [
{"role": "system", "content": "You are a helpful AI assistant."},
{"role": "user", "content": "Please tell me how to sort a list in Python."}
],
"max_tokens": 200,
"temperature": 0.5
}'
|
스트리밍
| curl -N http://localhost:8000/v1/completions \
-H "Content-Type: application/json" \
-d '{
"model": "Qwen/Qwen3-8B",
"prompt": "Write a short poem about the sea.",
"max_tokens": 100,
"stream": true
}'
|
OpenAI Python SDK로 요청
| import openai
client = openai.OpenAI(
base_url="http://localhost:8000/v1",
api_key="EMPTY", # --api-key를 지정하지 않으면 vLLM은 키를 검사하지 않습니다
)
print([m.id for m in client.models.list().data])
|
Completions
| response = client.completions.create(
model="Qwen/Qwen3-8B",
prompt="Hello, my name is",
max_tokens=150,
temperature=0.7,
)
print(response.choices[0].text)
print(f"Tokens used: {response.usage.total_tokens}")
|
Chat Completions
| response = client.chat.completions.create(
model="Qwen/Qwen3-8B",
messages=[
{"role": "system", "content": "You are a friendly coding tutor."},
{"role": "user", "content": "Please write code to print numbers from 1 to 10 using a loop."},
],
max_tokens=200,
temperature=0.5,
)
print(response.choices[0].message.content)
|
스트리밍
| stream = client.chat.completions.create(
model="Qwen/Qwen3-8B",
messages=[{"role": "user", "content": "Tell me about the LPU."}],
max_tokens=200,
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
|
hyperaccel-sdk 저장소에는 바로 실행할 수 있는 클라이언트 vllm/examples/openai_completion_client.py가 있습니다
(--stream을 붙이면 스트리밍).
배칭
여러 요청이 동시에 들어오면 스케줄러가 한 배치로 묶어 처리하고, 실행 중에 끝난 요청을 빼고 새 요청을
넣습니다(continuous batching). 별도의 배칭 옵션이나 API는 필요 없습니다. 입력 토큰과 max_tokens의 합은
--max-model-len을 넘을 수 없습니다.
LPU 지표
/metrics는 vLLM 기본 지표에 더해 플러그인이 내보내는 LPU 지표를 제공합니다.
| 지표 |
의미 |
vllm:lpu_prefill_requests |
지금 prefill 단계인 요청 수 |
vllm:lpu_decode_requests |
지금 decode 단계인 요청 수 |
vllm:lpu_scheduled_tokens |
이번 스텝에 스케줄된 토큰 수 |
vllm:lpu_batch_utilization |
LPU 토큰 예산 대비 스케줄된 토큰 비율 (0.0 – 1.0) |
vllm:lpu_step_duration_seconds |
모델 실행 스텝 하나의 소요 시간 |
TTFT, TPOT 같은 요청 단위 지표는 vLLM 기본 지표에 있습니다. 커널 단위로 더 깊이 보려면
프로파일링을 참고합니다.
다음