Completions
POST /v1/completions continues one prompt, or a list of prompts, with a Base model. It follows OpenAI's completions API, so the openai SDK calls it with client.completions.create(...). Sample continuations shows the tasks, and the API reference has the schema of every field.
Request fields
prompt is required. Apart from model and max_tokens, a field that you leave out, or sets to null, gets OpenAI's default, or the value that turns a vLLM field off. The model's own generation_config.json never sets a default.
A field marked vLLM comes from vLLM, the engine that runs the Base models in Inference, and is not in OpenAI's API. A field marked vllm-lens comes from vllm-lens, the vLLM plugin that reads and changes the residual stream. A field marked Inference comes from Inference itself. The openai SDK sends these kinds only in extra_body (Send vLLM's fields).
What to continue
| Field | Default | What it does |
|---|---|---|
model | the default model | The id of a model from GET /v1/models, such as llama-8b. Left out, the model that the list marks default. |
prompt | required | A text, a list of token ids, or a list of texts or of token-id lists. A list has at least one prompt, a token-id list has at least one id, and each id is 0 or more. The empty text "" is the BOS token alone, so the model writes from its start. |
max_tokens | the context left | The most tokens to write for each choice. The rules are under this table. |
n | 1 | The number of choices to write for each prompt, from 1. |
stop | none | A text, or a list of at most 4 texts, none of them empty. The model stops before it writes one of them. |
echo | false | Put the prompt in front of the generated text. |
add_special_tokens | true | vLLM. Add the model's special tokens, such as BOS, to a text prompt. Inference adds none to token ids. With false, the empty text has no tokens, and the API refuses it. |
The rules of max_tokens:
- It is at least 1. With
echo, 0 returns the prompt and writes nothing. - Left out or
null, it is the model'smax_model_lenless the prompt's tokens as the Hold counts them. It is at least 1 and at most 32,000, and at most 15,600 withoutstream. - A request with more than one prompt, or with
nabove 1, must set it. - A request writes at most 32,000 tokens in all: the prompts ×
n×max_tokens(Size caps). - Without
stream, a value above 15,600 gets 400deadline_infeasible. Inference cannot write more within the API's 14-minute wait (Requests without a stream). - Each prompt and
max_tokenstogether must fit the model'smax_model_len(Prompt too long). - Near the end of your tokens, the API lowers it to what this month's tokens can hold. The header
X-Acs-Max-Tokens-Clampedthen says so (Near the end of your tokens). - A Job's request that leaves it out gets it by these rules for a request without
stream, when you submit the Job. In a Loom Branch, it is 16 when you leave it out.
How to sample
| Field | Default | What it does |
|---|---|---|
temperature | 1 | Divide the scores of the tokens by this number before sampling, from 0 to 100. 0 takes the likeliest token each time. |
top_p | 1 | Sample only from the likeliest tokens whose probabilities add up to top_p. More than 0 and at most 1. |
top_k | 0 | vLLM. Sample only from the top_k likeliest tokens. 0 or -1 turns the filter off. |
min_p | 0 | vLLM. Leave out the tokens less likely than min_p times the likeliest token, from 0 to 1. 0 turns the filter off. |
presence_penalty | 0 | Make a token that is already in the generated text less likely, or more likely for a negative number, from -2 to 2. |
frequency_penalty | 0 | As presence_penalty, but more for each time that the token is already in the generated text, from -2 to 2. |
repetition_penalty | 1 | vLLM. Make the tokens of the prompt and the generated text less likely by this factor, more than 0. 1 turns the penalty off. |
seed | none | Sample with this seed, from 0 to 9,223,372,036,854,775,807, as on the old platform. The API sends all the digits of a large seed to Inference, so each seed samples its own tokens. With output_residual_stream or apply_steering_vectors, choice i samples with seed + i, so seed + n - 1 is at most 9,223,372,036,854,775,807. |
blue_noise | false | Inference. Pick each token with draws that push apart. The unlikely tokens then come spread out instead of in runs. Only on a model whose capabilities.blue_noise is true (Blue noise sampling). |
At temperature 0, or with the same seed, the same request on the same model gets the same tokens and log probabilities again, with one exception. vLLM batches your request with other requests. The batch can change a log probability by a little, and now and then a token where two tokens are almost equally likely. A test on vLLM 0.23 on 2026-08-24 measured it on llama-8b and llama-405b. At temperature 0, the other requests on the GPU moved the prompt log probabilities of one request by up to 0.21 bits per token. On llama-8b, batch-invariant mode keeps the other requests from changing them, when GET /v1/models marks the model with capabilities.batch_invariant.
With blue_noise and no seed, the API sends a seed of its own, so each request samples anew. Blue noise reads the low 32 bits of the seed. Seeds that differ by a multiple of 4,294,967,296 draw the same numbers.
What to return
| Field | Default | What it does |
|---|---|---|
logprobs | none | Return the log probability of each generated token, and of the logprobs likeliest tokens at its position. 0 to 1,000. |
prompt_logprobs | none | vLLM. Return the log probability of each prompt token, and of the likeliest tokens at its position. 0 to 1,000, or -1 for the whole vocabulary of one prompt. Not with stream. |
return_tokens_as_token_ids | false | vLLM. With logprobs, name each token as token_id:<id> in tokens and in the keys of top_logprobs, in place of its text. |
stream | false | Send the Completion as Server-Sent Events. |
stream_options | none | Only with stream. {"include_usage": true} adds a last chunk with the usage of the request. With "continuous_usage_stats": true (vLLM), each chunk has the usage of its choice so far, with or without include_usage. |
output_residual_stream | none | vllm-lens. Return the Activations at these Layers, or true for every Layer. false returns none. With a list of prompts or n above 1, each choice has its own, and the request does not stream. |
apply_steering_vectors | none | vllm-lens. Add these Steering vectors to the residual stream of each prompt and choice. With a list of prompts or n above 1, the request does not stream. |
structured_outputs | none | vLLM. Force the generated text into a shape: one of choice, regex, json, grammar, or json_object. Only on a model whose capabilities.structured_outputs is true, and not with output_residual_stream, apply_steering_vectors, batch_invariant, or blue_noise. |
Read token probabilities, Read Activations, Steer a Completion, and Get structured outputs show these fields in use.
Other fields
| Field | Default | What it does |
|---|---|---|
priority | 0 | vLLM. 0 or more. A request with a lower number runs first. Requests with the same number wait in the order that they arrived. null is 0. A text of digits, such as "5", and true or false count as their number. |
user | none | OpenAI's id for the person who asked. Inference gets it and does nothing with it. |
batch_invariant | false | true runs the request on Inference's batch-invariant server. Only for a model whose capabilities.batch_invariant is true, which can be llama-8b only, and not with output_residual_stream or apply_steering_vectors (Batch-invariant mode). The openai SDK sends it in extra_body. |
Strict validation
The API checks the type of every field before the request reaches Inference, and it refuses what it does not know. A wrong value never falls back to a default, as Base models explains.
- A field that the API does not know gets 400 with the code
invalid_request(Unknown field). - A value of the wrong type gets 400, with
paramset to the field. A number in a string, such as"2", is not a number, except forpriorityandseed.1and"true"are not booleans. A whole number such as1is valid for a decimal field such astemperature. - The API checks the ranges of
max_tokens,n,logprobs,prompt_logprobs,seed,priority, and the sampling fields in How to sample. It checks thatpromptand its token-id lists are not empty, that each token id is 0 or more, and that nostoptext is empty. Onllama-8b,llama-405b, andtrinity-truebase, it also checks that each token id is in the model's vocabulary, and the message names the position, such asprompt[1][3]. It also checks the shape of the Activations and Steering vector fields, the schema rules ofstructured_outputsthat Inference holds, and the size caps. - The API refuses
nabove 1 at atemperaturebelow 0.00001, where Inference picks the likeliest token each time. - The API refuses
stream_optionswithoutstream: true, andprompt_logprobswithstream: true. - The API refuses
blue_noise: truefor a model whosecapabilities.blue_noiseinGET /v1/modelsisfalse. - Inference checks the other values, for example that each token id of a prompt is in the model's vocabulary. The API passes on Inference's 400, with Inference's message and
param.
This request sends max_tokens as a string, so the API refuses it:
curl "$ACS_API_BASE/completions" \
-H "Authorization: Bearer $ACS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "llama-8b", "prompt": "The sky is", "max_tokens": "2"}'{
"error": {
"message": "Invalid type for 'max_tokens': expected a number.",
"type": "invalid_request_error",
"param": "max_tokens",
"code": "invalid_request"
},
"request_id": "req_9f2c4e1a7b3d4c5e8f6a0b1c2d3e4f5a"
}Size caps
Each cap keeps one request from using too much memory in the API or in Inference. A request over a cap gets 400 invalid_request_error, with param set to the field, and does not reach Inference. The caps count a prompt's tokens as the Hold counts them, with the model's tokenizer.
| Cap | Field | Why |
|---|---|---|
The prompts × n is at most 1,024, and n is at most 128 | n | Inference takes at most 1,024 prompts in one request. 128 is OpenAI's limit on n. |
The prompts × n × max_tokens is at most 32,000, and a max_tokens of 0 counts as 1 | max_tokens | The Hold of a request is then at most its prompt and 32,000 tokens. |
At most 4 stop texts | stop | OpenAI's limit. |
prompt_logprobs: -1 takes at most 256 prompt tokens in all × n, or 16 with output_residual_stream | prompt_logprobs | Each prompt token then has a log probability for each token of the vocabulary (128,256 for meta-llama/Llama-3.1-8B). Inference holds them all in memory. |
At most 3,232,000 top log probabilities of the generated tokens: the prompts × n × max_tokens × (logprobs + 1). That is 32,000 tokens with 100 top tokens each, or 3,228 with 1,000. With max_tokens left out, the API counts the tokens that it gives the request. | logprobs | The answer of the largest request is then about 100 MB, as it was when logprobs took 100 at most. The API reads it whole before it answers. |
At most 33,554,432 (2^25) top log probabilities of the prompt. Each prompt token × n has k + 1 for prompt_logprobs k, and k + 1 more for logprobs k with echo. | prompt_logprobs or logprobs | Inference holds each one in memory, and the answer includes each one. |
Layers × tokens × the model's hidden size is at most 33,554,432 (2^25) for the captures of one request. The tokens are the prompt's and max_tokens, for each choice. | output_residual_stream | The API reads the Activations of a capture as one text, and answers all the captures of a request in one text. |
At most 8 Steering vectors, and 2,097,152 (2^21) numbers in total. A vector with position_spans counts once for each position of its spans, and one with generated_tokens once for each of those tokens. | apply_steering_vectors | The API sends the numbers to Inference as float32: at most 8 MiB for each choice. |
The Steering vectors' numbers × the prompts × n is at most 16,777,216 (2^24). That is 2^21 numbers for 8 choices, or 2^14 numbers for all 1,024. | apply_steering_vectors | The API sends Inference the vectors again for each prompt and each choice. A request then sends Inference at most 64 MiB of them. |
| At most 16,384 bytes as compact JSON | structured_outputs | Inference checks each shape in its API server, and the requests on the same server wait while it does. |
The prompts × the bytes of structured_outputs as compact JSON is at most 262,144. That is 16 prompts at 16,384 bytes. n does not count. | structured_outputs | Inference checks the shape again for each prompt, and once for all the choices of a prompt. |
A grammar of at most 8,192 bytes and 128 rules, counting start and each rule with attributes, such as r[capture]: | structured_outputs | Inference turns a GBNF grammar into Lark first, which takes about half a second at 1,000 rules. A longer chain of rules can overflow the stack of the thread that compiles it. |
A json schema, or a %json schema in a grammar, nests objects and arrays at most 64 levels deep | structured_outputs | Inference refuses a deeper schema. |
A json or %json schema is at most 128 schemas deep. Its depth adds, once, the nesting of each part that a $ref names | structured_outputs | Inference compiles a schema on one of its threads, and each part that a $ref names can add its whole depth. A deeper schema can overflow that thread's stack and stop Inference for every User. |
llama-8b has a hidden size of 4,096, so the captures of one request are at most 8,192 Layers × tokens. That is all 32 Layers for 256 tokens, 1 Layer for 8,192 tokens, or 1 Layer for 8 choices of 1,024 tokens each.
The whole request body is at most 8 MiB on every route, and a larger body gets 413 (Status codes). The body can cap the Steering vectors first: in JSON, 8 MiB holds about 699,000 numbers of 12 characters each. Encoded Steering vectors take about a tenth of those bytes, so eight vectors over all 32 Layers of meta-llama/Llama-3.1-8B fit.
This request asks for 2 choices of 16,001 tokens, which is 32,002 tokens in all:
curl "$ACS_API_BASE/completions" \
-H "Authorization: Bearer $ACS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "llama-8b", "prompt": "The sky is", "max_tokens": 16001, "n": 2}'{
"error": {
"message": "At most 32000 generated tokens in all: n = 2 times max_tokens = 16001 for each of 1 prompts is 32002.",
"type": "invalid_request_error",
"param": "max_tokens",
"code": "invalid_request"
},
"request_id": "req_9f2c4e1a7b3d4c5e8f6a0b1c2d3e4f5a"
}Batch-invariant mode
With batch_invariant: true, Inference runs the request on a server of its own, which starts vLLM in its batch-invariant mode. In that mode, the kernels add the numbers of each prompt in an order that does not depend on the batch. ACS measured the numbers below on 2026-11-12, on llama-8b with vLLM 0.32 on an L40S. Each comparison read a prompt's log probabilities and 16 generated tokens at temperature 0, with the top 5 log probabilities of each position.
| Topic | What holds |
|---|---|
| Models | llama-8b only, when its capabilities.batch_invariant in GET /v1/models is true (Keys of capabilities). A model whose capabilities.batch_invariant is false gets 400 with param batch_invariant. |
| Other requests on the GPU | The tokens and log probabilities were the same, bit for bit, in a request with 3 or 11 other prompts. They were the same beside 12 other requests that generated 256 tokens each. A prompt of 3,000 tokens, which vLLM reads in two steps, was the same too. Without the mode, the top 5 tokens changed at some position in each comparison. Where they stayed the same, a log probability moved by up to 0.26 bits in a batch. Beside other requests, it moved by up to 0.27 bits. For the long prompt, it moved by 0.86 bits in a batch and 0.33 bits beside other requests. In a test on vLLM 0.23, 405B on eight GPUs lost the invariance beside other requests, so the mode is not for llama-405b. |
| Copies of one prompt in one request | In the test, 4 copies of one prompt in one request matched the prompt's request alone. |
| Speed | 12 requests of 256 tokens at once generated 291.4 tokens a second in the mode. Without it, they generated 416.7. The same work took 1.43 times as long. |
| Generated tokens | In each comparison above, the batch did not change the generated tokens or their top log probabilities. Above temperature 0 without a seed, each request samples other tokens. |
| Activations and Steering vectors | Not with output_residual_stream or apply_steering_vectors: 400 with param batch_invariant. The mode is not tested with them. |
| Starts | The server keeps no container warm. A request after 10 minutes without one waits for a start. GET /v1/models/llama-8b/status shows the model's other server only. |
| Tokens a month | The request counts as a Completion of llama-8b, at the same price in tokens. |
The mode does not promise the same numbers on another GPU type, another vLLM version, or another pin of the model. Each server tells the API its mode, and the API checks it. An answer from a server in the other mode gets 502 upstream_server_error, with none of its text (Inference fails).
This request reads the log probability of each prompt token in batch-invariant mode:
curl "$ACS_API_BASE/completions" \
-H "Authorization: Bearer $ACS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "llama-8b", "prompt": "The sky is", "max_tokens": 1, "temperature": 0, "prompt_logprobs": 0, "batch_invariant": true}'The openai SDK sends the field in extra_body:
import os
from openai import OpenAI
client = OpenAI(base_url=os.environ["ACS_API_BASE"], api_key=os.environ["ACS_API_KEY"])
completion = client.completions.create(
model="llama-8b",
prompt="The sky is",
max_tokens=1,
temperature=0,
extra_body={"prompt_logprobs": 0, "batch_invariant": True},
)
print(completion.choices[0].text)With Activations, the same request gets 400:
curl "$ACS_API_BASE/completions" \
-H "Authorization: Bearer $ACS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "llama-8b", "prompt": "The sky is", "max_tokens": 1, "temperature": 0, "batch_invariant": true, "output_residual_stream": [0]}'{
"error": {
"message": "Leave out output_residual_stream, or batch_invariant: batch-invariant mode is not tested with Activations or Steering vectors.",
"type": "invalid_request_error",
"param": "batch_invariant",
"code": "invalid_request"
},
"request_id": "req_9f2c4e1a7b3d4c5e8f6a0b1c2d3e4f5a"
}Response fields
The Quickstart shows a whole Completion.
| Field | What it is |
|---|---|
id | The id of the Completion, from Inference. |
object | Always "text_completion". |
created | When Inference made the Completion, in Unix seconds. |
model | The model that wrote it. |
choices | One choice for each prompt and each of its n samples, in the order of their index. |
usage | The prompt_tokens, completion_tokens, and total_tokens of the whole request. prompt_tokens counts each prompt once, whatever n is. A request with Activations or Steering vectors and more than one choice pays each prompt once for each choice (The Hold). |
activations | The Activations, only when the request has output_residual_stream and one choice. With more than one choice, each choice has its own. |
Each choice has these fields:
| Field | What it is |
|---|---|
index | p * n + i for choice i of prompt p. |
text | The generated text. With echo, the prompt comes first. |
logprobs | null, or the lists that logprobs asks for. |
finish_reason | "length" when the choice reached max_tokens or the model's context length. "stop" when the model wrote its end-of-text token or a stop text. Inference can add other reasons. |
stop_reason | The stop text that ended the choice, or null. With finish_reason "stop", null means that the model wrote its end-of-text token. |
prompt_logprobs | null, or the list that prompt_logprobs asks for, with null for the first prompt token. |
activations | The choice's Activations, only when the request has output_residual_stream and more than one choice. |
In a stream, each data: event is a chunk with the same id, object, created, and model. Its choices has the next text of one choice, with finish_reason and stop_reason null until the last chunk of that choice. With include_usage, a last chunk has "choices": [] and the usage of the whole request. The Activations come in a last chunk of their own, and data: [DONE] ends the stream. The stream also starts with a : keepalive comment line and has one every 5 seconds, which SSE clients skip (Requests with a stream).
Log probabilities
A log probability in logprobs or prompt_logprobs is the natural logarithm of the probability that the model gives a token at a position. It comes from a log-softmax of the model's scores, the logits, over every token of its vocabulary. vLLM computes it from the logits before any sampling setting changes them, in its default mode raw_logprobs, which Inference keeps.
| Topic | What holds |
|---|---|
| Sampling settings | temperature, top_p, top_k, min_p, presence_penalty, frequency_penalty, repetition_penalty, seed, and blue_noise do not change a log probability. They change only which token Inference picks. |
| The whole vocabulary | The probabilities at one position add up to 1 over the whole vocabulary. The k likeliest tokens of logprobs or prompt_logprobs add up to less. |
structured_outputs | Inference takes the tokens that the shape does not allow out of the logits before it computes the log probabilities of a generated token. Those log probabilities then add up to 1 over the allowed tokens only, and a token outside the shape gets -9999.0. The log probabilities of the prompt do not change. |
| Steering vectors | A Steering vector changes the residual stream, so the log probabilities are the steered model's. |
| The prompt | prompt_logprobs gives the log probability of each prompt token after the tokens before it. The sampling settings and structured_outputs apply to generated tokens only. |
| A probability of 0 | The log probability is -9999.0, as in OpenAI's API, not minus infinity. |
| Other requests on the GPU | They can change a log probability. How to sample and Batch-invariant mode give the sizes that ACS measured. |
| Precision | vLLM computes the log-softmax in float32 from the model's logits. ACS has not measured how much the number format of the logits limits the precision of a log probability. |
Not in the API
The API does not take these fields and routes of OpenAI's API:
best_of. vLLM accepts it and ignores it, so the API refuses it as an unknown field.nreturns each choice instead.suffix. vLLM supports it only for models that fill in the middle of a text.logit_bias.- Chat. The API applies no chat template (No chat template).
POST /v1/chat/completionsgets 400invalid_request_errorwith the messageThis API serves Base models, which have no chat format: send POST /v1/completions with a prompt instead of POST /v1/chat/completions with messages.
Work in the background
How the API runs Jobs, harvests, Loom Nodes, and Playground Runs without a client, in what order, and what happens when it restarts.
Models
The Base models that the API serves, the fields and limits of each one, and the route that says whether a model is Warm or how far its start has got.