System Prompt
Prompt
Variables
⌘↵
~0 tok
⚠ Prompt changed —
Edit schema or regenerate from prompt
Language:
What is structured JSON output?
Instead of a paragraph of text, the AI returns structured data you can use directly in code, spreadsheets, or other tools.

For example, asking "Show me sightseeing points in Paris" normally returns prose. With JSON mode, you get:
{"points":[{"name":"Eiffel Tower","category":"Landmark","duration":"2 hours"},...]}
We'll suggest a schema based on your prompt. You can edit it before confirming. The schema tells the AI exactly what fields to return.
⚗ Gemini Prompt Lab — How to Use
v1.1 · Single HTML file · All data stored locally
Getting Started
🔑
Enter your Gemini API key
Paste your key into the API Key field in the header. The dot turns green when a valid-looking key is detected. Your key is stored in localStorage and sent only to Google's API — never anywhere else.
🤖
Choose a model
gemini-2.5-flash-lite is the fastest and cheapest — good for iteration. gemini-2.5-flash is a thinking model and may take 2–4 minutes on complex prompts — this is normal, not a hang. gemini-3.0-flash is a capacity-limited preview and may return 503 errors under load.
📄
Open as a local file
This tool makes API calls directly from your browser. It must be opened by double-clicking the HTML file or dragging it into a browser tab — not inside a sandboxed iframe — otherwise the fetch will be blocked by the browser.
Writing Prompts
✏️
Prompt editor
Write your prompt in the centre panel. {{variableName}} tokens are highlighted in amber — these are placeholders replaced with variable values before the prompt is sent. A live estimated token count is shown in the run toolbar.
🔧
System Prompt optional
Click System Prompt at the top of the editor to expand a collapsible field. Use it for a persona or standing instructions that apply to every run — e.g. You are a concise travel expert. Always respond in bullet points. A purple dot appears when a system prompt is active.
📋
Copy Prompt
The Copy prompt button in the tab bar copies the raw prompt text including {{variable}} tokens as written — not the injected version with values substituted in.
Variables
🧩
Defining variables
Type {{anyName}} in the prompt — the variable is automatically created in the Variables tab with an empty value. You can also click + Add Variable in the Variables tab manually. Every {{name}} token is replaced with its value at run time.
Autocomplete
Type {{ in the editor to open a dropdown of all defined variables. Tab cycles through options. Enter selects the highlighted item. ↑ ↓ navigates. Esc dismisses.
🎯
Jump to variable shortcut
Cmd+Click (Mac) or Ctrl+Click (Windows) on any {{variable}} token in the editor to jump to the Variables tab with the cursor placed in that variable's value field — ready to type.
🛡️
Run guards
Run is blocked if any {{variable}} token is undefined, or if a defined variable has an empty value. Both cases show a toast with the offending variable names.
Running
▶️
Run shortcut
Click ▶ Run or press ⌘↵ (Mac) / Ctrl+Enter (Windows) from anywhere. Status cycles: idle → running → done / error / aborted. Elapsed time is shown live in the toolbar.
Cancel / Abort
The Cancel button appears as soon as a run starts. Clicking it sets the status to aborted (amber) and shows ⚠ Aborted by user. The HTTP request may complete in the background but the result is discarded.
⏱️
Slow responses
After 90 seconds a warning banner appears. This is expected for gemini-2.5-flash on complex prompts — it is a thinking model. You can cancel or keep waiting.
Output
📊
Collapsible JSON tree new
When the model returns valid JSON, it renders as an interactive tree. Depth 0–1 is expanded by default. Deeper nodes show a summary like [10 items] and expand on click. Copy always copies raw JSON regardless of expand/collapse state.
🔗
Grounding sources
If the model returns grounding metadata (search sources), clickable source chips appear below the output. Each chip links to the original source.
Structured JSON Output
🗂️
JSON mode new
Check Get structured JSON output at the bottom of the editor. A schema editor appears — Gemini suggests a schema based on your prompt which you can freely edit. At run time the schema is appended as instructions and response_mime_type: application/json is set, constraining the output to valid JSON.
⚠️
JSON mode guards
Run is blocked if the schema contains invalid JSON (border turns red). If you edit the prompt after generating a schema, a stale banner appears — click ⟳ Regenerate for a fresh suggestion. Unchecking hides the panel but preserves your schema.
Version History
💾
Saving a version
After a successful run a Save Version panel slides up. Give it a name (auto-suggested as v1, v2…), mark it ✓ Pass or ✗ Fail, and add an optional annotation. The + Save button in the output toolbar reopens this panel if you dismissed it. Up to 20 versions are kept (free tier).
🕐
Restoring a version
Click any version in the left sidebar to restore that prompt, variables, system prompt, and JSON schema to the editor. Versions survive page refresh — they are stored in localStorage.
🗑️
Deleting a version
Hover a version in the sidebar — an × appears top-right. Click to delete permanently.
Compare Mode new
Enabling compare mode
Click ⊞ Compare in the header. The button turns blue and the output area splits into two side-by-side panes — A (blue) and B (purple). Click again to exit and return to single-pane view. All existing output and saved versions are unaffected.
🤖
Choosing models
Two model dropdowns appear in the compare bar — one per pane. They default to gemini-2.5-flash-lite (A) vs gemini-2.5-flash (B), the most natural speed-vs-quality comparison. You can also run the same model twice with a different system prompt or different variable values to isolate what changed.
Running both sides shortcut
Click ▶▶ Run Both or press ⌘↵ / Ctrl+Enter — both API calls fire in parallel. Each pane shows its own live elapsed timer and status pill (running → done / error / aborted). ✕ Cancel aborts both simultaneously. JSON tree and grounding chips render per-pane independently.
💾
Saving from compare
Each pane has its own Copy and + Save buttons. Versions saved from compare runs appear in the sidebar with a small A or B badge so you always know which side they came from.
Export
💻
Copy as JavaScript
Click </> Code in the run toolbar to open the code export modal. By default it generates an injected JavaScript fetch() snippet — values already baked in, ready to run. If your prompt uses variables, a With variables checkbox appears — tick it to get a language dropdown. Choose from JavaScript, TypeScript, Python, Dart, Kotlin, Swift, or Go. The generated snippet declares your variables at the top by name so you can edit them. API key is always a placeholder — replace with your key or an environment variable. Click Copy Code to copy.
Keyboard Shortcuts
⌨️
All shortcuts
⌘↵ / Ctrl+Enter  — Run prompt (or Run Both in compare mode)
Cmd+Click / Ctrl+Click on {{var}}  — Jump to variable value
Tab in autocomplete  — Cycle options
Enter in autocomplete  — Select highlighted option
↑ ↓ in autocomplete  — Navigate options
Esc  — Dismiss autocomplete or close any modal