Conversation Message Builder
Build and test chat completion message arrays with visual role-based editing
Output JSON(0 ({count} messages))
[]
What is a Conversation Message Builder?
A conversation message builder is a visual tool for constructing the message arrays used by AI chat completion APIs. When you call OpenAI's Chat Completions API, Anthropic's Messages API, or Google's Gemini API, you send an ordered array of messages — each with a role (system, user, or assistant) and content. This tool lets you build those arrays visually instead of writing JSON by hand.
Hand-writing message arrays is tedious and error-prone, especially for multi-turn conversations, few-shot prompting setups, or complex system prompts. Missing a comma, mismatching quotes, or getting the role names wrong leads to API errors that can be hard to debug. Our builder gives you a visual interface with role-based color coding, reordering, and real-time JSON output.
The tool supports both OpenAI/Google format (system messages in the array) and Anthropic format (system prompt separated from messages). Switch between formats with a single click, and copy the ready-to-use JSON directly into your code.
How to Use the Message Builder
Building a message array takes just a few clicks:
- Add messages — Click the "+ System", "+ User", or "+ Assistant" buttons to add messages. Each role is color-coded: purple for system, blue for user, green for assistant.
- Write content — Type or paste your message content in each text area. The JSON output updates automatically as you type.
- Reorder messages — Use the up/down arrow buttons to rearrange message order. You can also change a message's role using the dropdown.
- Choose output format — Select "OpenAI / Google" or "Anthropic" from the format dropdown. For Anthropic, system messages are automatically extracted to a separate field.
- Copy JSON — Click "Copy JSON" to copy the formatted output to your clipboard, ready to paste into your code or API testing tool.
Understanding Message Roles
Each message in a chat completion array has a specific role that tells the model how to interpret it:
System Role
The system message sets the overall behavior and constraints for the AI. It acts as persistent instructions that influence every response. Common system prompts include persona definitions ("You are a senior developer"), output format requirements ("Always respond in JSON"), safety constraints ("Never provide medical advice"), or domain context. The system message is typically the first message in the array.
User Role
User messages represent input from the human user. These are the questions, instructions, or data that the model should process. In multi-turn conversations, user messages alternate with assistant messages to create a conversation history.
Assistant Role
Assistant messages represent previous responses from the AI model. Including assistant messages in the array lets you provide conversation history or implement few-shot prompting — where you show the model examples of desired input/output pairs before asking your actual question.
Common Use Cases
- Few-shot prompting — Build conversation examples where user messages show inputs and assistant messages show desired outputs, teaching the model the pattern.
- System prompt testing — Quickly prototype different system prompts and see how they combine with user messages in the final JSON.
- API testing — Generate message arrays for tools like Postman, curl, or API playgrounds without manually formatting JSON.
- Cross-provider migration — Convert message arrays between OpenAI and Anthropic formats when switching providers.
- Documentation — Build example conversations for API documentation or team onboarding materials.
Frequently Asked Questions
What is a chat completion message array?
A chat completion message array is the input format used by AI APIs like OpenAI, Anthropic, and Google. It is an ordered list of messages, each with a "role" (system, user, or assistant) and "content" (the message text). The model uses this conversation history to generate contextually appropriate responses.
What is the difference between OpenAI and Anthropic message formats?
OpenAI includes system messages directly in the message array with role: "system". Anthropic separates the system prompt into a dedicated "system" parameter outside the messages array, and the messages array only contains "user" and "assistant" roles. Our builder handles this conversion automatically when you switch output formats.
What does the system message do?
The system message sets the behavior, personality, and constraints for the AI model. It is processed before the conversation and acts as persistent instructions. Common uses include defining the assistant's role ("You are a customer support agent"), setting output format requirements, or establishing safety guidelines. Not all API calls need a system message, but it is recommended for production applications.
Why does message order matter?
Message order defines the conversation flow. Models process messages sequentially, and the order affects how the model interprets context. System messages should come first, followed by alternating user and assistant messages. Putting messages out of order (e.g., two user messages in a row without an assistant response) can confuse the model or trigger API errors with some providers.
Can I use this builder for multi-turn conversations?
Yes. The builder supports unlimited messages, making it ideal for constructing multi-turn conversation histories. You can add user and assistant messages in alternating order to simulate a full conversation, then copy the resulting JSON to use in your API calls or for testing prompt chains.
Related Tools
Explore more tools for building with AI APIs:
- Prompt Format Converter — Convert between OpenAI, Anthropic, and Google prompt formats
- Tool/Function Definition Linter — Validate tool definitions for function calling
- JSON Schema Generator for AI — Generate schemas for structured outputs
Related Tools
Tool/Function Definition Linter
Validate and lint your AI function calling definitions for OpenAI, Anthropic, and Google formats
JSON Schema Generator for AI
Generate JSON schemas from sample data optimized for AI function calling and structured outputs
Prompt Format Converter
Convert prompts between OpenAI, Anthropic Claude, Google Gemini, and other AI provider formats