HTTP API reference¶
nvserve serve implements the parts of the OpenAI API that text generation needs. Requests
and responses are JSON. Errors use OpenAI's shape:
{"error": {"message": "...", "type": "invalid_request_error"}}, with status 400 for bad
requests and 500 for server errors.
GET /health¶
Returns ok while the server is running.
GET /v1/models¶
Lists the one model being served:
{"object": "list", "data": [{"id": "qwen3-30b-a3b", "object": "model", "created": 0, "owned_by": "nvserve"}]}
POST /v1/chat/completions¶
| Field | Type | Notes |
|---|---|---|
model |
string | accepted and ignored: the server has one model |
messages |
array | roles system, user and assistant. content is a string, or an array of {"type": "text", "text": ...} parts |
max_tokens, max_completion_tokens |
integer | default: the server's --default-max-tokens; capped at the context left |
temperature |
number | default 1.0, as in OpenAI's API; 0 is greedy |
top_p |
number | default 1.0 |
top_k |
integer | not in OpenAI's API; default off |
seed |
integer | makes sampling reproducible |
stop |
string or array | generation ends before the first match |
stream |
boolean | server-sent events, ending with data: [DONE] |
chat_template_kwargs.enable_thinking |
boolean | reasoning models (Qwen3): false answers directly. Default: on, or off with --no-think |
The response follows OpenAI's chat.completion object:
{
"id": "chatcmpl-3",
"object": "chat.completion",
"created": 1764140000,
"model": "qwen3-30b-a3b",
"choices": [{
"index": 0,
"message": {"role": "assistant", "content": "Paris.", "reasoning_content": "The user asks..."},
"logprobs": null,
"finish_reason": "stop"
}],
"usage": {"prompt_tokens": 26, "completion_tokens": 24, "total_tokens": 50}
}
- Reasoning:
reasoning_contentappears only when a reasoning model thought before answering. - Finish reason:
finish_reasonisstopat end of turn or at a stop string, andlengthatmax_tokensor when the context is full. - Streaming: each chunk is a
chat.completion.chunkwithdelta.contentordelta.reasoning_content. The last chunk carriesfinish_reason.
POST /v1/completions¶
| Field | Type | Notes |
|---|---|---|
prompt |
string, or an array of one string | exactly one prompt per request |
max_tokens, temperature, top_p, top_k, seed, stop, stream |
as for chat |
The response is a text_completion object with choices[0].text. The prompt is used as-is,
with no chat template, and the output keeps its leading whitespace.
Not supported¶
- Tools and function calling,
response_formatand JSON mode. logprobs,n > 1,presence_penalty,frequency_penalty,logit_bias.- Embeddings, images and audio.
- Several models per server: start one server per model.
Unknown fields are ignored.