Text

Generate text from a prompt. The default verb.

marmot [prompt...]              # alias for `marmot run`
marmot run [prompt...]          # explicit

Providers: openrouter, anthropic, openai, vercel, cloudflare, ollama. On first run, marmot detects available API keys in the env and auto-configures a default in this order: ollamaopenroutervercelcloudflareopenaianthropic. Override any time with marmot setup, marmot config set, or --provider.

Prompt sources

Prompt is concatenated from up to four sources, joined by a blank line:

  1. Preset's prompt field (when --preset / @<name> is in use)
  2. Positional argument
  3. -p / --prompt-file <path>
  4. Piped stdin (when stdin is not a TTY)
git diff | marmot 'summarize this for the changelog'
cat user.txt | marmot -p ./prompts/system.txt 'one-line summary'

--system <text> / --system-file <path> for the system prompt. Both system and prompt fields are concatenated when set in both a preset and at runtime — see Presets — Merge rules.

A prompt of any kind satisfies the requirement — a user prompt (positional / --prompt-file / piped stdin) or a system prompt (--system / --system-file / preset's system). This enables the "preset-as-task" pattern where the preset's system carries the full instruction and the user just supplies an attachment:

# A preset with only `system` set, and a PDF attached at the runtime call:
marmot @pdf-to-md --file ./bank-info.pdf -o out.md

Attachments by themselves are not enough — there must be at least one prompt (user or system) for the model to act on.

Multimodal input

Vision and PDF/document inputs are flags on marmot run. Whether they work depends on whether the model accepts them — non-vision text models reject.

marmot --provider openai --model gpt-4o --image ./screenshot.png 'what is in this?'
marmot --image ./before.png --image ./after.png 'what changed?'
cat photo.jpg | marmot --image - 'caption this'

marmot --provider anthropic --model claude-sonnet-4-6 --file ./paper.pdf 'summarize'
curl -s https://example.com/doc.pdf | marmot --file - 'list section headings'

Stdin can carry one of: text prompt, image (via --image -), or file (via --file -).

Output

Default is plain text on stdout — pipe-friendly.

marmot 'haiku about caching' > poem.txt
git diff | marmot --stream 'commit message under 60 chars' | pbcopy

--json for the structured envelope:

{
  "ok": true,
  "provider": "openrouter",
  "model": "openai/gpt-oss-120b",
  "text": "…",
  "usage": { "inputTokens": 18, "outputTokens": 42, "totalTokens": 60 },
  "finishReason": "stop",
  "timestamp": "2026-05-02T14:05:00.000Z"
}

--stream streams tokens as they arrive; implies text mode (no envelope).

Structured output (object mode)

Pass any of --schema, --schema-file, --schema-module to switch to object mode. Output is always the JSON envelope with output (parsed object) instead of text.

marmot --schema-file ./entities.json 'extract entities' < article.txt | jq .output

Object mode rejects --stream and --text.

Flags

For cross-cutting flags (--provider, --api-key, -o, -q, --quiet, --retries, --timeout) see Common flags. -q / --quiet (0.10.0+) suppresses stdout (file output via -o is still written). With -o set on an interactive terminal, stdout stays silent by default; when piped, it still emits — see Stdout decision matrix. Run-specific:

FlagDescription
--model <id>Model id. Defaults to provider's default. Validated against cached model list.
--system <text>Inline system prompt.
--system-file <path>System prompt from a file.
-p, --prompt-file <path>Prompt from a file.
--image <path>Image input. Repeatable. - reads stdin.
--image-mime <mime>Override sniffed mime for --image -.
--file <path>Document/PDF input. Repeatable. - reads stdin.
--file-mime <mime>Override sniffed mime for --file -.
--schema <json>Inline JSON Schema (object mode).
--schema-file <path>JSON Schema from a file.
--schema-module <path>Local module exporting a Zod schema as default or schema. Trusted-code only: the module is executed with full Node privileges — do not point it at code you didn't write or audit.
--stream / --no-streamStream tokens. Implies text. --no-stream overrides a preset's stream: true.
--json / --no-jsonEmit structured envelope (default is text). --no-json overrides a preset's json: true.
--text / --no-textPlain text (now the default; flag kept for back-compat). --no-text overrides a preset's text: true.
--temperature <n>Sampling temperature. Provider-specific range, typically 0–2.
--max-tokens <n>Hard cap on completion tokens.
--top-p <n>Top-p / nucleus sampling, 0–1.
--seed <n>Reproducibility seed (provider-specific).
--stop <text>Stop sequence. Repeatable.
--reasoning <effort>Thinking/reasoning effort: low, medium, or high. Maps to Anthropic thinking budget, OpenAI reasoning_effort, OpenRouter reasoning.effort.
--provider-option <key=value>Generic passthrough. Repeatable. Lands in providerOptions[<provider>] for niche params not covered by a dedicated flag.

--json, --text, and --stream are mutually exclusive in spirit (text is default; --json overrides; --stream forces text).

Presets

run accepts a text-mode preset for any of its flags, plus the positional prompt. Preset values fill slots when the runtime flag is omitted; runtime values follow the merge rule for that field — scalars replace, lists append, prompt-like text concatenates. See Presets — Merge rules.

# Save a coding-review preset.
marmot preset create code-review \
  --mode text \
  --provider anthropic --model claude-sonnet-4-6 \
  --system 'You are a senior engineer reviewing code.' \
  --temperature 0.2

# Use it. The runtime prompt concatenates with any preset prompt;
# runtime --file appends to a preset file list.
marmot @code-review --file ./auth.ts 'flag any subtle bugs'

# Override booleans defensively.
marmot @code-review --no-stream --json 'one-line summary'

Preset-able fields for text mode: prompt, promptFile, system, systemFile, schema, schemaFile, schemaModule, file (list), image (list), temperature, maxTokens, topP, seed, stop (list), reasoning, providerOption, output, stream, text, json, retries, timeout, session.

Sampling and reasoning

Sampling controls (--temperature, --max-tokens, --top-p, --seed, --stop) and --reasoning are forwarded to the provider when supported and silently dropped when not. Use --provider-option for anything outside the standard set.

marmot --temperature 0.2 --max-tokens 400 'rewrite as a one-paragraph abstract'
marmot --reasoning high 'plan the migration step by step'
marmot --stop '###' --stop 'END' 'continue until you hit a delimiter'
marmot --provider openai --provider-option logprobs=true --json 'classify this'