POST
/
v1
/
completions
curl --location --request POST 'https://api.writer.com/v1/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
  "model": "palmyra-x-002-instruct",
  "prompt": "Tell me a story",
  "max_tokens": 2048,
  "temperature": 0.7,
  "stream": false
}'
{
  "choices": [
    {
      "text": "Sure! Here's a search engine optimized article about...",
      "log_probs": null
    }
  ],
  "model": "palmyra-x-002-instruct"
}

Authorizations

Authorization
string
headerrequired

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
model
string
required

The identifier of the model to be used for processing the request.

prompt
string
required

The input text that the model will process to generate a response.

max_tokens
integer

The maximum number of tokens that the model can generate in the response.

temperature
number

Controls the randomness of the model's outputs. Higher values lead to more random outputs, while lower values make the model more deterministic.

top_p
number

Used to control the nucleus sampling, where only the most probable tokens with a cumulative probability of top_p are considered for sampling, providing a way to fine-tune the randomness of predictions.

stop

Specifies stopping conditions for the model's output generation. This can be an array of strings or a single string that the model will look for as a signal to stop generating further tokens.

best_of
integer

Specifies the number of completions to generate and return the best one. Useful for generating multiple outputs and choosing the best based on some criteria.

random_seed
integer

A seed used to initialize the random number generator for the model, ensuring reproducibility of the output when the same inputs are provided.

stream
boolean

Determines whether the model's output should be streamed. If true, the output is generated and sent incrementally, which can be useful for real-time applications.

Response

200 - application/json
choices
object[]
required

A list of choices generated by the model, each containing the text of the completion and associated metadata such as log probabilities.

model
string

The identifier of the model that was used to generate the responses in the 'choices' array.