FriendliAI Dedicated.Chat API
The Dedicated.Chat API from FriendliAI — 2 operation(s) for dedicated.chat.
The Dedicated.Chat API from FriendliAI — 2 operation(s) for dedicated.chat.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/friendliai-dedicated-chat-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
openapi: 3.2.0
info:
title: Friendli Suite API Reference Container.Audio Dedicated.Chat API
description: This is an OpenAPI reference of Friendli Suite API.
termsOfService: https://friendli.ai/terms-of-service
contact:
name: FriendliAI Support Team
email: support@friendli.ai
version: 0.1.0
servers:
- url: https://api.friendli.ai
tags:
- name: Dedicated.Chat
paths:
/dedicated/v1/chat/completions:
post:
tags:
- Dedicated.Chat
summary: Chat completions
description: Generate a model response from a list of messages comprising a conversation. Compatible with the OpenAI Chat Completions API, with support for streaming, tool calls, and structured outputs.
operationId: dedicatedChatComplete
security:
- token: []
parameters:
- name: X-Friendli-Team
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
description: ID of team to run requests as (optional parameter).
title: X-Friendli-Team
description: ID of team to run requests as (optional parameter).
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/DedicatedChatCompletionBody'
responses:
'200':
description: Successfully generated a chat response.
content:
application/json:
schema:
$ref: '#/components/schemas/DedicatedChatCompleteSuccess'
examples:
Example:
value:
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
'422':
description: Unprocessable Entity
x-speakeasy-name-override: complete
x-mint:
metadata:
title: Dedicated Chat Completions
sidebarTitle: Chat Completions
og:title: Dedicated Chat Completions
description: Generate a model response from a list of messages comprising a conversation. Compatible with the OpenAI Chat Completions API, with support for streaming, tool calls, and structured outputs.
og:description: Generate a model response from a list of messages comprising a conversation. Compatible with the OpenAI Chat Completions API, with support for streaming, tool calls, and structured outputs.
href: /openapi/dedicated/inference/chat-completions
content: 'Generate a model response from a list of messages comprising a conversation. Compatible with the OpenAI Chat Completions API, with support for streaming, tool calls, and structured outputs.
To request successfully, it is mandatory to enter a **Personal API Key** (e.g. flp_XXX) value in the **Bearer Token** field.
Refer to the [authentication section](/openapi/introduction#authentication) on our introduction page to learn how to acquire this variable and [visit here](https://friendli.ai/suite/~/setting/keys) to generate your API Key.
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](/openapi/dedicated/inference/chat-completions-chunk-object).'
/dedicated/v1/chat/completions#stream:
post:
tags:
- Dedicated.Chat
summary: Stream chat completions
description: Generate a model response from a list of messages comprising a conversation. Compatible with the OpenAI Chat Completions API, with support for streaming, tool calls, and structured outputs.
operationId: dedicatedChatStream
security:
- token: []
parameters:
- name: X-Friendli-Team
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
description: ID of team to run requests as (optional parameter).
title: X-Friendli-Team
description: ID of team to run requests as (optional parameter).
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/DedicatedChatCompletionStreamBody'
responses:
'200':
description: Successfully generated a chat response.
content:
text/event-stream:
x-speakeasy-sse-sentinel: '[DONE]'
examples:
Example:
value: 'data: {"id":"chatcmpl-4b71d12c86d94e719c7e3984a7bb7941","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant","content":"This"},"finish_reason":null,"logprobs":null}],"usage":null,"created":1726294381}
data: {"id":"chatcmpl-4b71d12c86d94e719c7e3984a7bb7941","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":" is"},"finish_reason":null,"logprobs":null}],"usage":null,"created":1726294381}
...
data: {"id":"chatcmpl-4b71d12c86d94e719c7e3984a7bb7941","object":"chat.completion.chunk","choices":[{"index":0,"delta":{},"finish_reason":"stop","logprobs":null}],"usage":null,"created":1726294383}
data: {"id":"chatcmpl-4b71d12c86d94e719c7e3984a7bb7941","object":"chat.completion.chunk","choices":[],"usage":{"prompt_tokens":8,"completion_tokens":4,"total_tokens":12},"created":1726294402}
data: [DONE]
'
schema:
$ref: '#/components/schemas/DedicatedChatCompletionStreamSuccess'
'422':
description: Unprocessable Entity
x-speakeasy-name-override: stream
x-mint:
metadata:
title: Dedicated Stream Chat Completions
sidebarTitle: Stream Chat Completions
og:title: Dedicated Stream Chat Completions
description: Generate a model response from a list of messages comprising a conversation. Compatible with the OpenAI Chat Completions API, with support for streaming, tool calls, and structured outputs.
og:description: Generate a model response from a list of messages comprising a conversation. Compatible with the OpenAI Chat Completions API, with support for streaming, tool calls, and structured outputs.
content: 'Generate a model response from a list of messages comprising a conversation. Compatible with the OpenAI Chat Completions API, with support for streaming, tool calls, and structured outputs.
To request successfully, it is mandatory to enter a **Personal API Key** (e.g. flp_XXX) value in the **Bearer Token** field.
Refer to the [authentication section](/openapi/introduction#authentication) on our introduction page to learn how to acquire this variable and [visit here](https://friendli.ai/suite/~/setting/keys) to generate your API Key.
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](/openapi/dedicated/inference/chat-completions-chunk-object).'
components:
schemas:
StreamedChatChoice:
properties:
index:
type: integer
title: Index
description: The index of the choice in the list of generated choices.
examples:
- 0
logprobs:
anyOf:
- $ref: '#/components/schemas/ChatLogprobs'
- type: 'null'
delta:
$ref: '#/components/schemas/StreamedChatChoiceDelta'
finish_reason:
anyOf:
- type: string
enum:
- stop
- length
- tool_calls
- 'null'
- type: 'null'
title: Finish Reason
description: 'Termination condition of the generation. `stop` means the API returned the full chat completions generated by the model without running into any limits.
`length` means the generation exceeded `max_tokens` or the conversation exceeded the max context length.
`tool_calls` means the API has generated tool calls.'
type: object
required:
- index
- delta
title: StreamedChatChoice
ChatCompleteBodyToolChoice:
properties:
type:
type: string
const: function
title: Type
description: The type of the tool. Currently, only `function` is supported.
function:
$ref: '#/components/schemas/ChatCompleteBodyToolChoiceFunction'
type: object
required:
- type
- function
title: ChatCompleteBodyToolChoice
DedicatedChatCompletionStreamSuccess:
$ref: '#/components/schemas/StreamedChatResult'
title: DedicatedChatCompletionStreamSuccess
PromptTokensDetails:
properties:
cached_tokens:
anyOf:
- type: integer
- type: 'null'
title: Cached Tokens
description: Cached tokens present in the prompt.
type: object
title: PromptTokensDetails
AssistantMessageToolCall:
properties:
id:
type: string
title: Id
description: The ID of tool call.
type:
type: string
const: function
title: Type
description: The type of tool call.
function:
$ref: '#/components/schemas/AssistantMessageToolCallFunction'
description: The function specification
type: object
required:
- id
- type
- function
title: AssistantMessageToolCall
AssistantMessage:
properties:
role:
type: string
const: assistant
title: Role
description: The role of the messages author.
content:
anyOf:
- type: string
- type: 'null'
title: Content
description: The content of assistant message. Required unless `tool_calls` is specified.
reasoning_content:
anyOf:
- type: string
- type: 'null'
title: Reasoning Content
description: The intermediate reasoning content of assistant message.
reasoning:
anyOf:
- type: string
- type: 'null'
title: Reasoning
description: The intermediate reasoning content of assistant message. This field is a compatible option for the 'reasoning_content' field.
name:
anyOf:
- type: string
- type: 'null'
title: Name
description: The name for the participant to distinguish between participants with the same role.
tool_calls:
anyOf:
- items:
$ref: '#/components/schemas/AssistantMessageToolCall'
type: array
- type: 'null'
title: Tool Calls
type: object
required:
- role
title: AssistantMessage
ResponseFormat:
oneOf:
- $ref: '#/components/schemas/ResponseFormatJsonSchema'
title: Json Schema
- $ref: '#/components/schemas/ResponseFormatJsonObject'
title: Json Object
- $ref: '#/components/schemas/ResponseFormatRegex'
title: Regex
- $ref: '#/components/schemas/ResponseFormatText'
title: Text
description: 'The enforced format of the model''s output.
Note that the content of the output message may be truncated if it exceeds the `max_tokens`. You can check this by verifying that the `finish_reason` of the output message is `length`.
For more detailed information, please refer [here](https://friendli.ai/docs/guides/structured-outputs).
***Important***
You must explicitly instruct the model to produce the desired output format using a system prompt or user message (e.g., `You are an API generating a valid JSON as output.`).
Otherwise, the model may result in an unending stream of whitespace or other characters.
**When `response_format` is specified, `min_tokens` field is unsupported.**'
discriminator:
propertyName: type
mapping:
json_object: '#/components/schemas/ResponseFormatJsonObject'
json_schema: '#/components/schemas/ResponseFormatJsonSchema'
regex: '#/components/schemas/ResponseFormatRegex'
text: '#/components/schemas/ResponseFormatText'
ChatLogprobsContentTopLogprob:
properties:
token:
type: string
title: Token
description: The token.
logprob:
type: number
title: Logprob
description: The log probability of this token.
bytes:
anyOf:
- items:
type: integer
type: array
- type: 'null'
title: Bytes
description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
type: object
required:
- token
- logprob
title: ChatLogprobsContentTopLogprob
ResponseFormatJsonObject:
properties:
type:
type: string
const: json_object
title: Type
description: 'The type of the response format: `json_object`'
type: object
required:
- type
title: ResponseFormatJsonObject
FunctionResult:
properties:
arguments:
type: string
title: Arguments
description: 'The arguments for calling the function, generated by the model in JSON format.
Ensure to validate these arguments in your code before invoking the function since the model may not always produce valid JSON.'
name:
type: string
title: Name
description: The name of the function to call.
type: object
required:
- arguments
- name
title: FunctionResult
UserMessageContentMultiModal:
oneOf:
- $ref: '#/components/schemas/TextContent'
title: Text
- $ref: '#/components/schemas/AudioContent'
title: Audio
- $ref: '#/components/schemas/ImageContent'
title: Image
- $ref: '#/components/schemas/VideoContent'
title: Video
discriminator:
propertyName: type
mapping:
audio_url: '#/components/schemas/AudioContent'
image_url: '#/components/schemas/ImageContent'
text: '#/components/schemas/TextContent'
video_url: '#/components/schemas/VideoContent'
VideoContent:
properties:
type:
type: string
const: video_url
title: Type
description: The type of the message content.
video_url:
$ref: '#/components/schemas/VideoData'
description: The video URL data.
type: object
required:
- type
- video_url
title: VideoContent
ChatLogprobsContent:
properties:
token:
type: string
title: Token
description: The token.
logprob:
type: number
title: Logprob
description: The log probability of this token.
bytes:
anyOf:
- items:
type: integer
type: array
- type: 'null'
title: Bytes
description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
top_logprobs:
items:
$ref: '#/components/schemas/ChatLogprobsContentTopLogprob'
type: array
title: Top Logprobs
description: List of the most likely tokens and their log probability, at this token position.
type: object
required:
- token
- logprob
- top_logprobs
title: ChatLogprobsContent
AudioContent:
properties:
type:
type: string
const: audio_url
title: Type
description: The type of the message content.
audio_url:
$ref: '#/components/schemas/AudioData'
description: The audio URL data.
type: object
required:
- type
- audio_url
title: AudioContent
TextContent:
properties:
type:
type: string
const: text
title: Type
description: The type of the message content.
text:
type: string
title: Text
description: The text content of the message.
type: object
required:
- type
- text
title: TextContent
ToolMessage:
properties:
role:
type: string
const: tool
title: Role
description: The role of the messages author.
content:
type: string
title: Content
description: The content of tool message that contains the result of tool calling.
tool_call_id:
type: string
title: Tool Call Id
description: The ID of tool call corresponding to this message.
name:
anyOf:
- type: string
- type: 'null'
title: Name
description: An optional name of the tool call corresponding to this message.
type: object
required:
- role
- content
- tool_call_id
title: ToolMessage
AssistantMessageToolCallFunction:
properties:
name:
type: string
title: Name
description: The name of function
arguments:
type: string
title: Arguments
description: The arguments of function in JSON schema format to call the function.
type: object
required:
- name
- arguments
title: AssistantMessageToolCallFunction
StreamedToolCallResult:
properties:
type:
type: string
const: function
title: Type
description: The type of the tool.
id:
anyOf:
- type: string
- type: 'null'
title: Id
description: The ID of the tool call.
index:
type: integer
title: Index
description: The index of the tool call being generated.
function:
$ref: '#/components/schemas/StreamedFunctionResult'
type: object
required:
- type
- index
- function
title: StreamedToolCallResult
ChatUsage:
properties:
prompt_tokens:
type: integer
title: Prompt Tokens
description: Number of tokens in the prompt.
examples:
- 5
completion_tokens:
type: integer
title: Completion Tokens
description: Number of tokens in the generated chat completions.
examples:
- 7
total_tokens:
type: integer
title: Total Tokens
description: Total number of tokens used in the request (`prompt_tokens` + `completion_tokens`).
examples:
- 12
prompt_tokens_details:
anyOf:
- $ref: '#/components/schemas/PromptTokensDetails'
- type: 'null'
description: Breakdown of tokens used in the prompt.
type: object
required:
- prompt_tokens
- completion_tokens
- total_tokens
title: ChatUsage
ToolCallResult:
properties:
type:
type: string
const: function
title: Type
description: The type of the tool.
id:
type: string
title: Id
description: The ID of the tool call.
function:
$ref: '#/components/schemas/FunctionResult'
type: object
required:
- type
- id
- function
title: ToolCallResult
ResponseFormatText:
properties:
type:
type: string
const: text
title: Type
description: 'The type of the response format: `text`'
type: object
required:
- type
title: ResponseFormatText
DedicatedChatCompleteSuccess:
$ref: '#/components/schemas/ChatResult'
title: DedicatedChatCompleteSuccess
ResponseFormatRegex:
properties:
type:
type: string
const: regex
title: Type
description: 'The type of the response format: `regex`'
schema:
type: string
title: Schema
description: The schema of the output. Lookaheads or lookbehinds (e.g., `\a`, `\z`, `^`, `$`, `(?=)`, `(?!)`, `(?<=...)`, `(?<!...)`) are not supported. Group specials (e.g., `\w`, `\W`, `\d`, `\D`, `\s`, `\S`) do not support non-ASCII characters. Unicode escape patterns (e.g., `\N`, `\p`, `\P`) are not supported. Additionally, conditional matching (`(?(`) and back-references can cause inefficiency.
type: object
required:
- type
- schema
title: ResponseFormatRegex
SystemMessage:
properties:
role:
type: string
const: system
title: Role
description: The role of the messages author.
content:
type: string
title: Content
description: The content of system message.
name:
anyOf:
- type: string
- type: 'null'
title: Name
description: The name for the participant to distinguish between participants with the same role.
type: object
required:
- role
- content
title: SystemMessage
Message:
oneOf:
- $ref: '#/components/schemas/SystemMessage'
title: System
- $ref: '#/components/schemas/UserMessage'
title: User
- $ref: '#/components/schemas/AssistantMessage'
title: Assistant
- $ref: '#/components/schemas/ToolMessage'
title: Tool
discriminator:
propertyName: role
mapping:
assistant: '#/components/schemas/AssistantMessage'
system: '#/components/schemas/SystemMessage'
tool: '#/components/schemas/ToolMessage'
user: '#/components/schemas/UserMessage'
ChatChoiceMessage:
properties:
content:
anyOf:
- type: string
- type: 'null'
title: Content
description: The contents of the assistant message.
role:
type: string
title: Role
description: Role of the generated message author, in this case `assistant`.
tool_calls:
anyOf:
- items:
$ref: '#/components/schemas/ToolCallResult'
type: array
- type: 'null'
title: Tool Calls
type: object
required:
- role
title: ChatChoiceMessage
Function:
properties:
description:
anyOf:
- type: string
- type: 'null'
title: Description
description: A description of what the function does, used by the model to choose when and how to call the function.
name:
type: string
title: Name
description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
parameters:
additionalProperties: true
type: object
title: Parameters
description: 'The parameters the functions accepts, described as a JSON Schema object.
To represent a function with no parameters, use the value `{"type": "object", "properties": {}}`.
'
type: object
required:
- name
- parameters
title: Function
ChatResult:
properties:
id:
type: string
title: Id
description: A unique ID of the chat completion.
choices:
items:
$ref: '#/components/schemas/ChatChoice'
type: array
title: Choices
usage:
$ref: '#/components/schemas/ChatUsage'
object:
type: string
const: chat.completion
title: Object
description: The object type, which is always set to `chat.completion`.
created:
type: integer
title: Created
description: The Unix timestamp (in seconds) for when the generation completed.
model:
anyOf:
- type: string
- type: 'null'
title: Model
description: The model to generate the completion. For dedicated endpoints, it returns the endpoint ID.
type: object
required:
- id
- choices
- usage
- object
- created
title: ChatResult
StreamedChatResult:
properties:
data:
$ref: '#/components/schemas/StreamedChatData'
type: object
required:
- data
title: StreamedChatResult
ImageContent:
properties:
type:
type: string
const: image_url
title: Type
description: The type of the message content.
image_url:
$ref: '#/components/schemas/ImageData'
description: The image URL data.
type: object
required:
- type
- image_url
title: ImageContent
ResponseFormatJsonSchema:
properties:
type:
type: string
const: json_schema
title: Type
description: 'The type of the response format: `json_schema`'
json_schema:
$ref: '#/components/schemas/ResponseFormatJsonSchemaSchema'
type: object
required:
- type
- json_schema
title: ResponseFormatJsonSchema
StreamedChatData:
properties:
id:
type: string
title: Id
description: A unique ID of the chat completion.
usage:
anyOf:
- $ref: '#/components/schemas/ChatUsage'
- type: 'null'
object:
type: string
const: chat.completion.chunk
title: Object
description: The object type, which is always set to `chat.completion.chunk`.
choices:
items:
$ref: '#/components/schemas/StreamedChatChoice'
type: array
title: Choices
created:
type: integer
title: Created
description: The Unix timestamp (in seconds) for when the token is sampled.
model:
anyOf:
- type: string
- type: 'null'
title: Model
description: The model to generate the completion. For dedicated endpoints, it returns the endpoint ID.
type: object
required:
- id
- object
- choices
- created
title: StreamedChatData
VideoData:
properties:
url:
type: string
title: Url
description: The URL of the video.
type: object
required:
- url
title: VideoData
UserMessage:
properties:
role:
type: string
const: user
title: Role
description: The role of the message's author.
content:
anyOf:
- type: string
description: 'The content of user message, which is plain text.
For **multi-modal format**, use `object[]` type. Support for non-text input is currently in **Beta**.'
- items:
$ref: '#/components/schemas/UserMessageContentMultiModal'
type: array
description: 'The content of user message.
**Multi-modal format** can handle not just text, but also audio, image, and video content, allowing for more complex message structures. Support for non-text input is currently in **Beta**.'
title: Content
name:
anyOf:
- type: string
- type: 'null'
title: Name
description: The name for the participant to distinguish between participants with the same role.
type: object
required:
- role
- content
title: UserMessage
StreamOptions:
properties:
include_usage:
anyOf:
- type: boolean
- type: 'null'
title: Include Usage
description: 'When set to `true`,
the number of tokens used will be included at the end of the stream result in the form of
`"usage": {"completion_tokens": number, "prompt_tokens": number, "total_tokens": number}`.
'
type: object
title: StreamOptions
ChatChoice:
properties:
index:
type: integer
title: Index
description: The index of the choice in the list of generated choices.
examples:
- 0
logprobs:
anyOf:
- $ref: '#/components/schemas/ChatLogprobs'
- type: 'null'
message:
$ref: '#/components/schemas/ChatChoiceMessage'
finish_reason:
type: string
enum:
- stop
- length
- tool_calls
title: Finish Reason
description: 'Termination condition of the generation. `stop` means the API returned the full chat completions generated by the model without running into any limits.
`length` means the generation exceeded `max_tokens` or the conversation exceeded the max context length.
`tool_calls` means the API has generated tool calls.'
type: object
required:
- index
- message
- finish_reason
title: ChatChoice
StreamedChatChoiceDelta:
properties:
content:
anyOf:
- type: string
- type: 'null'
title: Content
description: The contents of the assistant message.
role:
anyOf:
- type: string
- type: 'null'
title: Role
description: Role of the generated message author, in this case `assistant`.
tool_calls:
anyOf:
- items:
$ref: '#/components/schemas/StreamedToolCallResult'
type: array
- type: 'null'
title: Tool Calls
type: object
title: StreamedChatChoiceDelta
ChatLogprobs:
properties:
content:
anyOf:
- items:
$ref: '#/components/schemas/ChatLogprobsContent'
type: array
- type: 'null'
title: Content
description: A list of message content tokens with log probability information.
type: object
title: ChatLogprobs
StreamedFunctionResult:
properties:
arguments:
type: string
title: Arguments
description: 'The arguments for calling the function, generated by the model in JSON format.
Ensure to validate these arguments in your code before invoking the function since the model may not always produce valid JSON.'
name:
anyOf:
- type: string
- type: 'null'
title: Name
description: The name of the function to call.
type: object
required:
- arguments
title: StreamedFunctionResult
ChatCompleteBodyToolChoiceFunction:
properties:
name:
type: string
title: Name
description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
type: object
required:
- name
title: ChatCompleteBodyToolChoiceFunc
# --- truncated at 32 KB (60 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/friendliai/refs/heads/main/openapi/friendliai-dedicated-chat-api-openapi.yml