Skip to main content
POST
/
dedicated
/
v1
/
chat
/
completions
Chat completions
curl --request POST \
  --url https://api.friendli.ai/dedicated/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "messages": [
    {
      "content": "You are a helpful assistant.",
      "role": "system"
    },
    {
      "content": "Hello!",
      "role": "user"
    }
  ],
  "model": "(endpoint-id)"
}'
{
  "id": "chatcmpl-4b71d12c86d94e719c7e3984a7bb7941",
  "model": "(endpoint-id)",
  "object": "chat.completion",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello there, how may I assist you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 9,
    "completion_tokens": 11,
    "total_tokens": 20
  },
  "created": 1735722153
}
Given a list of messages forming a conversation, the model generates a response. 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
model
string
required
Examples:
messages
Messages · array
required
  • System
  • User
  • Assistant
  • Tool
Examples:
chat_template_kwargs
object | null
eos_token
integer[] | null
frequency_penalty
number | null
logit_bias
object | null
logprobs
boolean | null
max_tokens
integer | null
Examples:
min_p
number | null
n
integer | null
parallel_tool_calls
boolean | null
presence_penalty
number | null
repetition_penalty
number | null
seed
stop
string[] | null
stream
boolean | null
default:false
stream_options
object | null
parse_reasoning
boolean | null
include_reasoning
boolean | null
temperature
number | null
tool_choice
top_k
integer | null
top_logprobs
integer | null
top_p
number | null
xtc_threshold
number | null
xtc_probability
number | null
tools
Tool · object[] | null
min_tokens
integer | null
response_format
object | null
  • Json Schema
  • Json Object
  • Regex
  • Text

Response

id
string
required
choices
ChatChoice · object[]
required
usage
object
required
object
string
required
Allowed value: "chat.completion"
created
integer
required
model
string | null