---
title: "Chat render"
method: POST
path: "/dedicated/v1/chat/render"
tags: ["Dedicated.ChatRender"]
---

# Chat render

`POST /dedicated/v1/chat/render`

## Request

- Base URL: `https://api.friendli.ai`
- URL: `https://api.friendli.ai/dedicated/v1/chat/render`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/friendli/apis/friendli-suite-api-reference/docs/dedicated/v1/chat/render/post.ts> (a function with typed inputs; its response is checked against the schema)

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

## Headers

- `X-Friendli-Team` string, nullable: ID of team to run requests as (optional parameter).

## Request body

- DedicatedChatRenderBody
  - `model` string, required: 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.
  - `messages` Message[], required: A list of messages comprising the conversation so far.
    - union
      - SystemMessage
        - `role` 'system', required: The role of the messages author.
        - `content` string, required: The content of system message.
        - `name` string, nullable: The name for the participant to distinguish between participants with the same role.
      - UserMessage
        - `role` 'user', required: The role of the message's author.
        - `content` union, required
          - string: 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**.
          - UserMessageContentMultiModal[]: 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**.
            - union
              - …
        - `name` string, nullable: The name for the participant to distinguish between participants with the same role.
      - AssistantMessage
        - `role` 'assistant', required: The role of the messages author.
        - `content` string, nullable: The content of assistant message. Required unless `tool_calls` is specified.
        - `reasoning_content` string, nullable: The intermediate reasoning content of assistant message.
        - `reasoning` string, nullable: The intermediate reasoning content of assistant message. This field is a compatible option for the 'reasoning_content' field.
        - `name` string, nullable: The name for the participant to distinguish between participants with the same role.
        - `tool_calls` AssistantMessageToolCall[], nullable
          - `id` string, required: The ID of tool call.
          - `type` 'function', required: The type of tool call.
          - `function` AssistantMessageToolCallFunction, required
            - `name` string, required: The name of function
            - `arguments` string, required: The arguments of function in JSON schema format to call the function.
      - ToolMessage
        - `role` 'tool', required: The role of the messages author.
        - `content` string, required: The content of tool message that contains the result of tool calling.
        - `tool_call_id` string, required: The ID of tool call corresponding to this message.
        - `name` string, nullable: An optional name of the tool call corresponding to this message.
  - `chat_template_kwargs` object, nullable: Additional keyword arguments supplied to the template renderer. These parameters will be available for use within the chat template.
  - `tools` Tool[], nullable: 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` 'function', required: The type of the tool. Currently, only `function` is supported.
    - `function` Function, required
      - `description` string, nullable: A description of what the function does, used by the model to choose when and how to call the function.
      - `name` string, required: 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` object, required: The parameters the functions accepts, described as a JSON Schema object. To represent a function with no parameters, use the value `{"type": "object", "properties": {}}`.

## Response `200`

Successfully rendered chat messages into prompt text.

- DedicatedChatRenderSuccess
  - `text` string, required: The rendered text.

## Other responses

- `422`: Unprocessable Entity

---

[API](https://skmtc.dev/friendli/apis/friendli-suite-api-reference.md) - [All operations](https://skmtc.dev/friendli/apis/friendli-suite-api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/friendli/apis/friendli-suite-api-reference/revisions/38fb43993a11?raw)
