RAG Chat Completion
Create a chat completion with context retrieved from items or files in a vector store collection. Reasoning effort, thinking budget, and the express variant follow the Chat Completions behavior.
Body
application/jsonChat Completion RAG Request Payload
-
collection string required
The vector store collection to search for relevant context.
-
model string required
The model that will be inferred for chat completion. A
-normalizesuffix is accepted for compatibility and ignored; every response is normalized. -
messages array of objects required
The message context to use for the chat completion request, separated by system, user, assistant, tool, and developer roles.
at least 1 items -
max_tokens integer
Deprecated name for
max_. If both are sent,completion_ tokens max_takes precedence.completion_ tokens -
max_completion_tokens integer
Maximum completion tokens, including reasoning and visible output.
default 32768at least 1 -
reasoning_effort string
Shorthand for
reasoning.effort. Configured models map this level to their supported reasoning control.ultramaxxhighhighmediumlowminimalnone -
reasoning object
Reasoning controls. Configured models map effort through their database profile. Models advertising
reasoning.supports_max_tokens: truein/v1/models?format=openrouter(amax_tokensproperty under thereasoningparameter in the default list) enforce the budget; other models accept it without enforcing it. -
n integer
The number of chat completion choices to generate for each input message.
default 1 -
seed integer
If you would like a different response from the same message, changing the seed will change the response. A null value generates a random seed.
-
temperature number (float)
A value between 0.0 and 2.0 that controls the randomness of the model's output. When set closer to 1, such as 0.8, the outcome is more unpredictable and creative. Values nearing 0, like 0.2, produce more predictable and less creative results. A temperature of zero requests greedy decoding; exact reproducibility depends on the model engine.
default 1range 0–2 -
top_p number (float)
A value between 0.0 and 1.0 that controls the probability of the model generating a particular token. A higher value will result in more diverse outputs, while a lower value will result in more repetitive outputs.
default 1range 0–1 -
stop string or array of strings
The strings the model stops generating at, up to 4. A single string is accepted as shorthand for a one-item array.
-
frequency_penalty number (float)
A value between -2.0 and 2.0 that controls how much the model penalizes generating repetitive responses.
default 0range -2–2 -
presence_penalty number (float)
A value between -2.0 and 2.0 that controls how much the model penalizes generating responses that contain certain words or phrases.
default 0range -2–2 -
stream boolean
Indicates whether the response should be streamed.
-
logprobs boolean
Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the content of message.
-
top_logprobs integer
An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. Optional:
logprobs: truealone returns the sampled token's log probability. Requireslogprobsto be true.range 0–20 -
tool_choice string or object
Controls which (if any) tool is called by the model. A tool choice other than
nonerequirestools. -
tools array of objects
A list of function tools the model may call.
Responses
OK
application/json, text/event-stream · chat-completion-response-payload
Bad Request, including a request that failed validation (the message names the rejected field)
application/json · error-payload
The API key is missing, unknown or not active. Send it as Authorization: Bearer <key>.
application/json · error-payload
curl https://api.vultrinference.com/v1/chat/completions/RAG \
-H "Authorization: Bearer $VULTR_INFERENCE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4.1-flash",
"collection": "handbook",
"messages": [
{
"role": "user",
"content": "How many vacation days do new hires get?"
}
]
}'import os
import requests
response = requests.post(
"https://api.vultrinference.com/v1/chat/completions/RAG",
headers={"Authorization": f"Bearer {os.environ['VULTR_INFERENCE_API_KEY']}"},
json={
"model": "deepseek-v4.1-flash",
"collection": "handbook",
"messages": [
{
"role": "user",
"content": "How many vacation days do new hires get?",
},
],
},
)
print(response.json())const response = await fetch("https://api.vultrinference.com/v1/chat/completions/RAG", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.VULTR_INFERENCE_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "deepseek-v4.1-flash",
"collection": "handbook",
"messages": [
{
"role": "user",
"content": "How many vacation days do new hires get?"
}
]
}),
});
console.log(await response.json());{
"id": "string",
"object": "string",
"created": 0,
"model": "string",
"choices": [
{
"index": 0,
"message": {
"role": "system",
"content": null,
"reasoning": null,
"tool_calls": []
},
"logprobs": {
"content": []
},
"finish_reason": "stop",
"native_finish_reason": "string"
}
],
"usage": {
"completion_tokens": 0,
"prompt_tokens": 0,
"total_tokens": 0,
"prompt_tokens_details": {
"cached_tokens": 0
},
"completion_tokens_details": {
"reasoning_tokens": 0
}
}
}