Create a text completion from the given prompt
Request
Provide your bearer token in the Authorization
header when making requests to protected resources. Example:Authorization: Bearer ********************
or
Body Params application/jsonRequired
{
"model": "string",
"prompt": "string",
"max_tokens": 0,
"temperature": 0,
"top_p": 0,
"n": 0,
"stream": true,
"stop": "string",
"suffix": "string",
"echo": true
}
Request Code Samples
curl --location '/v1/completions' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "string",
"prompt": "string",
"max_tokens": 0,
"temperature": 0,
"top_p": 0,
"n": 0,
"stream": true,
"stop": "string",
"suffix": "string",
"echo": true
}'
Responses
Response created successfully
{
"id": "string",
"object": "text_completion",
"created": 0,
"model": "string",
"choices": [
{
"text": "string",
"index": 0,
"finish_reason": "string"
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0,
"prompt_tokens_details": {
"cached_tokens": 0,
"text_tokens": 0,
"audio_tokens": 0,
"image_tokens": 0
},
"completion_tokens_details": {
"text_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 0
}
}
}
Modified at 2026-05-23 05:25:06