ToolBunny Logo
ToolBunny
Back to Homepage

Chat History Payload Formatter

Convert standard conversational text files instantly into API structural JSON code arrays.

Load Preset Sample Transcript:
Auto-detects roles (`User:`, `Assistant:`, etc.)
Speaker Role AliasesComma-separated names
User Names / Labels:
Assistant Names / Labels:
Formatted Code Output:
[
  {
    "role": "system",
    "content": "You are an expert TypeScript and Next.js architect. Always return production-ready code."
  },
  {
    "role": "user",
    "content": "How do I handle server actions in Next.js 14?"
  },
  {
    "role": "assistant",
    "content": "Next.js 14 Server Actions allow you to run asynchronous server code directly from components.\n\nHere is a basic example:\n\n```tsx\n'use server'\n\nexport async function updateUser(formData: FormData) {\n  const name = formData.get('name');\n  await db.user.update({ where: { id: 1 }, data: { name } });\n}\n```"
  },
  {
    "role": "user",
    "content": "Thanks! Can I invoke this inside a form element?"
  },
  {
    "role": "assistant",
    "content": "Yes, pass it directly to the `action` attribute of any `<form>` tag!"
  }
]
Total Turns
5
User Turns
2
Assistant
2
System
1
Total Words
88
Est. Tokens
~145

Parsed Role & Message Turn Breakdown (5 Turns)

Visual verification of extracted conversation turns
#1 system (System)88 chars · ~23 tokens

You are an expert TypeScript and Next.js architect. Always return production-ready code.

#2 user (User)45 chars · ~12 tokens

How do I handle server actions in Next.js 14?

#3 assistant (Assistant)301 chars · ~79 tokens

Next.js 14 Server Actions allow you to run asynchronous server code directly from components. Here is a basic example: ```tsx 'use server' export async function updateUser(formData: FormData) { const name = formData.get('name'); await db.user.update({ where: { id: 1 }, data: { name } }); } ```

#4 user (User)48 chars · ~13 tokens

Thanks! Can I invoke this inside a form element?

#5 assistant (Assistant)68 chars · ~18 tokens

Yes, pass it directly to the `action` attribute of any `<form>` tag!

About This Tool

The Chat History Payload Formatter is a developer productivity tool designed to convert unstructured chat transcripts, exported ChatGPT logs, Discord/Slack conversations, and raw human-AI dialogues into ready-to-use API JSON payloads.

Whether you are building RAG pipelines, fine-tuning custom models with JSONL datasets, or executing API calls through OpenAI, Anthropic Claude, Google Gemini, or Ollama, converting plain text dialogue into structured arrays usually requires tedious manual formatting or writing custom Python scripts. This tool automates role detection, speaker alias mapping, system prompt prepending, and payload formatting in real time inside your browser.

How to Use

  1. Paste Raw Chat Log: Enter or paste any transcript into the input area, or click one of the preset sample buttons (ChatGPT Export, Discord Log, or Human/AI Dialogue).
  2. Configure Role Aliases & Rules: Specify custom speaker names for user and assistant roles, toggle reasoning token stripping, or prepend a system instruction if desired.
  3. Select Target Schema: Switch between OpenAI Messages, Anthropic Claude, Google Gemini, Ollama/Llama, Fine-Tuning JSONL, Python SDK, or cURL Command tabs.
  4. Copy or Download Payload: Click Copy Code to copy the formatted payload directly to your clipboard, or click Download to export a .json, .jsonl, .py, or .sh file.

Common Use Cases & FAQ