Create a Text Completion

Create a Text Completion

Request

This endpoint expects an object.
modelstringRequired
Model identifier or alias.
promptstringRequired=1 character

Legacy completion prompt in Human/Assistant format.

max_tokens_to_sampleintegerRequired>=1
Maximum number of tokens to sample.
metadataobjectOptional
Metadata object for request attribution.
stop_sequenceslist of stringsOptional
Stop generation if any sequence is encountered.
streambooleanOptional
Whether to stream the response.
temperaturedoubleOptional0-1
Sampling temperature between 0 and 1.
top_kintegerOptional>=0

Top-k sampling parameter.

top_pdoubleOptional0-1

Top-p sampling parameter.

Response

This endpoint returns an object.
idstring
Completion identifier
type"completion"
Object type. Always "completion".
completionstring
Generated completion text.
modelstring
Resolved model identifier.
stop_reasonstring
Reason the generation stopped.

Errors

401
Unauthorized
422
Unprocessable Entity