POST
/
v1
/
completions
curl --request POST \
  --url http://localhost:8000/v1/completions \
  --header 'Content-Type: application/json' \
  --data '{
  "prompt": "Say this is a test!"
}'
{
  "id": "cmpl-26a1e10db8544bc3adb488d2d205288b",
  "object": "text_completion",
  "choices": [
    {
      "index": 0,
      "seed": 42,
      "text": "This is indeed a test",
      "tokens": [
        128000,
        2028,
        374,
        13118,
        264,
        1296
      ],
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 7,
    "completion_tokens": 6,
    "total_tokens": 13
  }
}

When streaming mode is used (i.e., stream option is set to true), the response is in MIME type text/event-stream. Otherwise, the content type is application/json. You can view the schema of the streamed sequence of chunk objects in streaming mode here.

Body

application/json

Response

200
application/json
Successfully generated completions.

The response is of type object.