Serverless.Completions

Completions

Generate text based on the given text prompt.

post/serverless/v1/completions

Request

Headers

X-Friendli-Teamstring nullable

ID of team to run requests as (optional parameter).

Request body

OR

Example request

{
  "model": "meta-llama/Llama-3.1-8B-Instruct",
  "max_tokens": 200,
  "top_k": 1
}

Response

Successfully generated completions.

idstring required

A unique ID of the completion.

object'text_completion' required

The object type, which is always set to text_completion.

modelstring nullable

The model to generate the completion. For dedicated endpoints, it returns the endpoint id.

Example response

{
  "usage": {
    "prompt_tokens": 5,
    "completion_tokens": 7,
    "total_tokens": 12
  },
  "choices": [
    {
      "text": "This is indeed a test",
      "seed": 42,
      "tokens": [
        128000,
        2028,
        374,
        13118,
        264,
        1296
      ]
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.