> ## Documentation Index
> Fetch the complete documentation index at: https://friendli.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Dedicated Chat Render

> Preview the final prompt text that your Friendli Dedicated Endpoint will send to the model. Useful for debugging chat templates and token counts.

Given a list of messages forming a conversation, the API renders them into the final prompt text that will be sent to the model.

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.


## OpenAPI

````yaml https://github.com/friendliai/friendli-openapi/raw/refs/heads/main/openapi.yaml post /dedicated/v1/chat/render
openapi: 3.1.0
info:
  title: Friendli Suite API Reference
  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
security: []
tags:
  - name: Serverless.Chat
  - name: Serverless.ToolAssistedChat
  - name: Serverless.Messages
  - name: Serverless.ChatRender
  - name: Serverless.Completions
  - name: Serverless.Token
  - name: Serverless.Audio
  - name: Serverless.Model
  - name: Serverless.Knowledge
  - name: Dedicated.Chat
  - name: Dedicated.Messages
  - name: Dedicated.ChatRender
  - name: Dedicated.Completions
  - name: Dedicated.Embeddings
  - name: Dedicated.TextClassification
  - name: Dedicated.Token
  - name: Dedicated.Image
  - name: Dedicated.Audio
  - name: Dedicated.Endpoint
  - name: Container.Chat
  - name: Container.Messages
  - name: Container.Completions
  - name: Container.TextClassification
  - name: Container.Token
  - name: Container.Image
  - name: Container.Audio
  - name: Cost
  - name: Dataset
  - name: File
paths:
  /dedicated/v1/chat/render:
    post:
      tags:
        - Dedicated.ChatRender
      summary: Chat render
      description: >-
        Given a list of messages forming a conversation, the API renders them
        into the final prompt text that will be sent to the model.
      operationId: dedicatedChatRender
      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/DedicatedChatRenderBody'
      responses:
        '200':
          description: Successfully rendered chat messages into prompt text.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DedicatedChatRenderSuccess'
              examples:
                Example:
                  value:
                    text: >
                      <|begin_of_text|><|start_header_id|>system<|end_header_id|>

                      You are a helpful
                      assistant.<|eot_id|><|start_header_id|>user<|end_header_id|>

                      Hello!<|eot_id|><|start_header_id|>assistant<|end_header_id|>
        '422':
          description: Unprocessable Entity
      security:
        - token: []
components:
  schemas:
    DedicatedChatRenderBody:
      properties:
        model:
          type: string
          title: Model
          description: >-
            ID of target endpoint. If you want to send request to specific
            adapter, use the format "YOUR_ENDPOINT_ID:YOUR_ADAPTER_ROUTE".
            Otherwise, you can just use "YOUR_ENDPOINT_ID" alone.
          examples:
            - (endpoint-id)
        messages:
          items:
            $ref: '#/components/schemas/Message'
          type: array
          title: Messages
          description: A list of messages comprising the conversation so far.
          examples:
            - - content: You are a helpful assistant.
                role: system
              - content: Hello!
                role: user
        chat_template_kwargs:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Chat Template Kwargs
          description: >-
            Additional keyword arguments supplied to the template renderer.
            These parameters will be available for use within the chat template.
        tools:
          anyOf:
            - items:
                $ref: '#/components/schemas/Tool'
              type: array
            - type: 'null'
          title: Tools
          description: >-
            A list of tools the model may call.

            Use this to provide a list of functions the model may generate JSON
            inputs for.


            **When `tools` is specified, `min_tokens` and `response_format`
            fields are unsupported.**
      type: object
      required:
        - model
        - messages
      title: DedicatedChatRenderBody
      example:
        messages:
          - content: You are a helpful assistant.
            role: system
          - content: Hello!
            role: user
        model: (endpoint-id)
    DedicatedChatRenderSuccess:
      properties:
        text:
          type: string
          title: Text
          description: The rendered text.
      type: object
      required:
        - text
      title: DedicatedChatRenderSuccess
    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:
            $ref: '#/components/schemas/AssistantMessage'
          system:
            $ref: '#/components/schemas/SystemMessage'
          tool:
            $ref: '#/components/schemas/ToolMessage'
          user:
            $ref: '#/components/schemas/UserMessage'
    Tool:
      properties:
        type:
          type: string
          const: function
          title: Type
          description: The type of the tool. Currently, only `function` is supported.
        function:
          $ref: '#/components/schemas/Function'
      type: object
      required:
        - type
        - function
      title: Tool
    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
    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
    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
    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
    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
    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:
            $ref: '#/components/schemas/AudioContent'
          image_url:
            $ref: '#/components/schemas/ImageContent'
          text:
            $ref: '#/components/schemas/TextContent'
          video_url:
            $ref: '#/components/schemas/VideoContent'
    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
    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
    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
    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
    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
    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
    AudioData:
      properties:
        url:
          type: string
          title: Url
          description: The URL of the audio.
      type: object
      required:
        - url
      title: AudioData
    ImageData:
      properties:
        url:
          type: string
          title: Url
          description: The URL of the image.
      type: object
      required:
        - url
      title: ImageData
    VideoData:
      properties:
        url:
          type: string
          title: Url
          description: The URL of the video.
      type: object
      required:
        - url
      title: VideoData
  securitySchemes:
    token:
      type: http
      description: >-
        When using Friendli Suite API for inference requests, you need to
        provide a **Personal API Key** for authentication and authorization
        purposes.


        For more detailed information, please refer
        [here](https://friendli.ai/docs/openapi/introduction#authentication).
      scheme: bearer

````