DevFlow logoDevFlow
ToolsPipelinesExploreDocsPricing
⌘F
DashboardPipeline BuilderAnalytics

Try Pro — Free 7 days

No credit card required

AI Prompt Builder Online — Free LLM Prompt Generator with Token Counter

How to AI Prompt Builder Online

  1. 1

    Start with the default prompt structure — a system message and a user message — or add more sections using the 'Add Message Section' dropdown to include assistant or additional user/system messages.

  2. 2

    Write your prompt content in each message section. Use {{variableName}} syntax anywhere in the text to create dynamic variables that can be filled in later — useful for templating reusable prompts.

  3. 3

    Select your target AI model from the model dropdown. The builder auto-detects the provider (OpenAI, Anthropic, or Google) and formats the payload correctly for that API.

  4. 4

    Monitor real-time token counts per section and the total context window usage bar. The builder warns you if your system prompt is oversized, if you're near the context limit, or if adjacent messages share the same role.

  5. 5

    Fill in detected variable values in the Variables panel on the left. Values are injected into the export output automatically.

  6. 6

    Choose your export format — JSON, cURL, JavaScript fetch, or Python — and view the generated code in the Export Preview panel on the right. Copy with ⌘⇧E or the Copy Export button.

  7. 7

    Reorder message sections using the ↑/↓ arrows next to each section. Remove sections with the trash icon, or reset everything with ⌘⇧K.

AI Prompt Builder Features

  • ✓

    Multi-message prompt builder with system, user, and assistant role sections — the three roles used by all major LLM APIs.

  • ✓

    Per-section token counting: see exactly how many tokens each message consumes for the selected model.

  • ✓

    Context window usage bar: visual progress bar showing how much of the model's context window your prompt fills, with color-coded warnings at 70% and 90%.

  • ✓

    Variable injection: use {{variableName}} syntax in any message and fill values in the Variables panel. Variables are replaced in the exported output.

  • ✓

    Provider-aware exports: automatically formats the payload for OpenAI (chat completions), Anthropic (messages API with system field), and Google Gemini (generateContent).

  • ✓

    Four export formats: raw JSON payload, cURL command (ready to paste in terminal), JavaScript fetch code, and Python code (using openai or anthropic SDK).

  • ✓

    Prompt validation: checks for oversized system prompts (>50% context), near-limit usage (>80%), empty sections, duplicate adjacent roles, and missing user messages.

  • ✓

    Reorder messages: move sections up or down to experiment with prompt structure and ordering.

  • ✓

    Model selector with all major LLMs: GPT-4o, GPT-4.1, o3, Claude Opus/Sonnet, Gemini 2.5, Llama 3, Mistral, and more.

  • ✓

    Auto-persist to localStorage: your prompt structure and variables are saved automatically and restored on reload.

  • ✓

    URL-shareable settings: model and format selections are stored in URL parameters for sharing.

  • ✓

    Runs entirely in your browser — no prompt data is ever sent to a server. Your prompts and templates stay completely private.

  • ✓

    Keyboard shortcuts: ⌘↵ to recount tokens and re-export, ⌘⇧E to copy the export output, ⌘⇧K to clear all messages.

Frequently Asked Questions

What is an AI prompt builder?
An AI prompt builder is a tool that helps you construct structured prompts for Large Language Model (LLM) APIs like OpenAI, Anthropic, and Google Gemini. Instead of manually formatting JSON payloads or writing cURL commands, you fill in message sections with roles (system, user, assistant) and the builder generates ready-to-use API calls with correct formatting for each provider.
Is this prompt builder free?
Yes, DevFlow AI Prompt Builder is completely free with no usage limits. All prompt construction, token counting, and export generation runs directly in your browser — no account required.
Is my prompt data safe?
All processing happens entirely in your browser using JavaScript. No prompt content, messages, or variables are ever transmitted to a server or stored anywhere outside your browser's localStorage. Your prompts and templates stay completely private on your machine.
What is the difference between system, user, and assistant roles?
System messages set the AI's behavior and personality (e.g. 'You are a helpful coding assistant'). User messages are the inputs or questions you send to the AI. Assistant messages represent previous AI responses — useful for multi-turn conversations where the AI needs context from earlier exchanges. Most LLM APIs require at least one user message.
How do variables work?
Use double curly braces {{variableName}} in any message to create a variable. The Variables panel detects all variables across your messages and lets you fill in values. When you export, variables are replaced with their values. This is useful for creating reusable prompt templates — for example, 'You are a {{role}} expert. Explain {{topic}}' can be reused for different roles and topics.
Which AI providers are supported?
The builder auto-detects the provider from your selected model and formats the payload accordingly. OpenAI models (GPT-4o, GPT-4.1, o3, etc.) use the chat completions format. Anthropic models (Claude Opus, Sonnet, Haiku) use the messages API format with the system field separated from messages. Google models (Gemini 2.5, 1.5) use the generateContent format with systemInstruction. The cURL, fetch, and Python exports include the correct endpoint URLs and headers for each provider.
How accurate is the token counter?
Token counts are estimated using the same tokenization approach as the AI Token Counter tool. For OpenAI models, the counts use BPE tokenization (tiktoken). For other providers, counts are close approximations. Actual token counts from the API may vary slightly due to special tokens, tool definitions, or provider-specific encoding.
What is context window usage?
The context window is the maximum number of tokens an LLM can process in a single request (input + output). For example, GPT-4o has a 128K token context window. The usage bar shows how much of this window your prompt fills. If your prompt exceeds 80% of the context, you may not have enough room for the model's response. The builder warns you when you're approaching the limit.
Can I export to Python?
Yes. The Python export generates ready-to-run code using the openai Python SDK for OpenAI models, the anthropic SDK for Claude models, or the google.generativeai SDK for Gemini models. Each includes proper authentication setup, model selection, and response parsing.
Can I export to cURL?
Yes. The cURL export generates a complete command-line request with the correct endpoint URL, headers (including Authorization or X-API-Key), and the JSON payload. You can copy and paste it directly into your terminal.
What does prompt validation check?
The builder checks for five common issues: (1) oversized system prompts using more than 50% of the context window, (2) total prompt near the context limit (>80%), (3) empty message sections, (4) adjacent messages with the same role (which some models handle poorly), and (5) prompts with no user message (required by most LLM APIs). Warnings appear in the Validation Warnings panel.
Does it work offline?
Yes. All prompt building, token counting, and export generation is bundled with the page as pure JavaScript. Once the page has loaded, the AI Prompt Builder works without an internet connection.

Related Developer Tools

  • AI Token CounterCount tokens and estimate API costs for major LLMs instantly.
  • JSON FormatterPrettify, minify, and validate JSON data instantly.
  • cURL to Code ConverterConvert cURL commands to code in 12+ programming languages instantly.
  • Text Case ConverterConvert text between 20+ case formats: camelCase, snake_case, kebab-case, Title Case, and more.