Skip to main content
POST
/
dedicated
/
v1
/
completions
Completions
curl --request POST \
  --url https://api.friendli.ai/dedicated/v1/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "(endpoint-id)",
  "bad_word_tokens": [
    {
      "tokens": [
        123
      ]
    }
  ],
  "bad_words": [
    "<string>"
  ],
  "embedding_to_replace": [
    123
  ],
  "encoder_no_repeat_ngram": 123,
  "encoder_repetition_penalty": 123,
  "eos_token": [
    123
  ],
  "forced_output_tokens": [
    123
  ],
  "frequency_penalty": 123,
  "logprobs": 123,
  "max_tokens": 200,
  "max_total_tokens": 123,
  "min_p": 123,
  "min_tokens": 123,
  "min_total_tokens": 123,
  "n": 123,
  "no_repeat_ngram": 123,
  "presence_penalty": 123,
  "repetition_penalty": 123,
  "response_format": {
    "type": "<string>",
    "json_schema": {
      "schema": {}
    }
  },
  "seed": [
    123
  ],
  "stop": [
    "<string>"
  ],
  "stop_tokens": [
    {
      "tokens": [
        123
      ]
    }
  ],
  "stream": true,
  "stream_options": {
    "include_usage": true
  },
  "temperature": 123,
  "token_index_to_replace": [
    123
  ],
  "top_k": 1,
  "top_p": 123,
  "xtc_threshold": 123,
  "xtc_probability": 123,
  "prompt": "Say this is a test!"
}'
{
  "id": "cmpl-26a1e10db8544bc3adb488d2d205288b",
  "model": "(endpoint-id)",
  "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
  }
}
Generate text based on the given text prompt. To request successfully, it is mandatory to enter a Friendli Token (e.g. flp_XXX) value in the Bearer Token field. Refer to the authentication section on our introduction page to learn how to acquire this variable and visit here to generate your token. 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.

Authorizations

Authorization
string
header
required

Headers

X-Friendli-Team
string | null

Body

application/json
  • CompletionsDedicatedBodyWithPrompt
  • CompletionsDedicatedBodyWithTokens
model
string
required
Examples:
prompt
required
Examples:
bad_word_tokens
TokenSequence · object[] | null
bad_words
string[] | null
embedding_to_replace
number[] | null
encoder_no_repeat_ngram
integer | null
encoder_repetition_penalty
number | null
eos_token
integer[] | null
forced_output_tokens
integer[] | null
frequency_penalty
number | null
logprobs
integer | null
max_tokens
integer | null
Examples:
max_total_tokens
integer | null
min_p
number | null
min_tokens
integer | null
min_total_tokens
integer | null
n
integer | null
no_repeat_ngram
integer | null
presence_penalty
number | null
repetition_penalty
number | null
response_format
object | null
  • Json Schema
  • Json Object
  • Regex
  • Text
seed
stop
string[] | null
stop_tokens
TokenSequence · object[] | null
stream
boolean | null
default:false
stream_options
object | null
temperature
number | null
token_index_to_replace
integer[] | null
top_k
integer | null
Examples:
top_p
number | null
xtc_threshold
number | null
xtc_probability
number | null

Response

id
string
required
object
string
required
Allowed value: "text_completion"
usage
object
required
choices
CompletionsChoice · object[]
required
model
string | null