v1
latestOpenAPI 3.1.0Apache-2.02026-07-13136499.6 KBCompletions
Create completions
This function processes completion requests by using the chat completions endpoint.
Returns
Returns a Response containing either:
- A streaming SSE connection for real-time completions
- A single JSON response for non-streaming completions
Errors
Returns an error status code if:
- The request processing fails
- The streaming/non-streaming handlers encounter errors
- The underlying inference service returns an error
post/v1/completions
Request body
Example request
{
"best_of": 1,
"logit_bias": {
"1234567890": 0.5,
"1234567891": -0.5
},
"logprobs": 1,
"max_tokens": 4096,
"model": "meta-llama/Llama-3.3-70B-Instruct",
"n": 1,
"seed": 123,
"suffix": "json(\"\\n\")",
"temperature": 0.7,
"top_p": 1,
"user": "user-1234"
}Response
Chat completions
Example response
{
"choices": [
{
"text": "This is a test",
"index": 0,
"logprobs": null,
"finish_reason": "stop"
}
],
"id": "cmpl-1234567890",
"model": "meta-llama/Llama-3.3-70B-Instruct",
"object": "text_completion",
"system_fingerprint": "system-fingerprint",
"usage": {
"completion_tokens": 10,
"completion_tokens_details": {
"accepted_prediction_tokens": 10,
"reasoning_tokens": 10
},
"prompt_tokens": 10,
"prompt_tokens_details": {
"cached_tokens": 10
},
"total_tokens": 20
}
}