Reference
Last updated: 5 March 2026
Gemini --output-format stream-json event cheatsheet
gemini -p --output-format stream-json writes one JSON object per line (JSONL) with a required type field.
gemini -p --output-format stream-json writes one JSON object per line (JSONL) with a
required type field.
Event types
init
Session initialisation with session ID and model.
{"type":"init","session_id":"abc123def","model":"gemini-2.0-flash-exp","timestamp":"2026-01-15T10:00:00Z"}
message
Text content from user or assistant. Delta messages have delta: true.
{"type":"message","role":"assistant","content":"The command output `hello`.","timestamp":"2026-01-15T10:00:05Z"}
tool_use
Tool invocation with name, ID, and parameters.
{"type":"tool_use","tool_name":"Bash","tool_id":"tool_1","parameters":{"command":"echo hello"},"timestamp":"2026-01-15T10:00:01Z"}
File operation example:
{"type":"tool_use","tool_name":"write_file","tool_id":"tool_2","parameters":{"file_path":"notes.md","content":"hello"},"timestamp":"2026-01-15T10:00:03Z"}
tool_result
Tool completion with status and output.
{"type":"tool_result","tool_id":"tool_1","status":"success","output":"hello","timestamp":"2026-01-15T10:00:02Z"}
result
Final result with status and token usage stats.
{"type":"result","status":"success","stats":{"input_tokens":100,"output_tokens":50},"timestamp":"2026-01-15T10:00:06Z"}
Stats may also include total_cost_usd:
{"type":"result","status":"success","stats":{"input_tokens":100,"output_tokens":50,"total_cost_usd":0.0025},"timestamp":"2026-01-15T10:00:06Z"}
error
Error with message. Terminates the session.
{"type":"error","message":"API key invalid or expired","timestamp":"2026-01-15T10:00:01Z"}
Notes
initis always the first event and containssession_idfor resume.messageevents withrole = "assistant"accumulate to form the final answer text.tool_useandtool_resultevents are paired bytool_id.resultis the terminal event for successful runs;errorfor failures.- Tool names are snake_case (e.g.,
read_file,edit_file,write_file).
Was this helpful?
Thanks for your feedback!
Related Articles
How-To GuidesAdding a RunnerThis guide explains how to add a new engine runner to Untether.How-To GuidesBrowse project filesBrowse your project's directory tree and preview files without leaving Telegram — check a config, review a file, or orient yourself in the repo from your pho...How-To GuidesChat sessionsChat sessions store one resume token per engine per chat (per sender in group chats), so new messages can auto-resume without replying. Reply-to-continue sti...