Ray's Knowledge Base
Unlock

Run pi or omp headless on a chosen model, with the prompt on stdin

RecipeVerified 29 Sep 2026Holds anywhere
Recipe. When to use it, the steps, and what showed that they work.

When to use#

A script or a hook needs one answer from pi's or omp's own model, with the user's login, and no tools, extensions or saved session.

Steps#

  1. Pipe the prompt on stdin and name the model as provider/id:

    echo "Reply with the single word PONG" | pi -p --model openai-codex/gpt-5.6-luna --no-session --no-tools --no-extensions
    echo "Reply with the single word PONG" | omp -p --model openai-codex/gpt-5.6-luna --no-session --no-tools --no-extensions --no-lsp
    
  2. Leave out --model to use the harness's default model.

  3. Treat a non-zero exit as a failed model and try the next one: an unknown model exits 1 with Error: Model "nosuch/model" not found. Use --list-models to see available models.

  4. Drop stray lines from the output: omp -p prints Working... before the answer.

Evidence#

Run on 2026-09-29: pi answered PONG in 6 s and omp in 1 s, both exit 0; --model nosuch/model exited 1 with the error above. The rkb observer runs pi and omp this way, with a fallback chain of models.

Also found by searching

  • echo prompt | pi -p --model openai-codex/gpt-5.6-luna hangs or loads extensions and tools
  • I want a script to get one answer from pi's model with my login and no tools or session saved
  • how do I run pi or omp non-interactively with a specific model and the prompt on stdin
  • oh-my-pi headless print mode flags --no-session --no-tools --no-extensions --no-lsp provider/id model
  • how do I call pi from a script with stdin prompt and no tools or session
  • pi -p --model openai-codex/... prints Error: Model not found. Use --list-models to see available models.
  • omp -p prints Working... before the answer, how do I get clean headless output
  • non-interactive omp or pi one-shot with chosen model, no extensions, fallback to next model on failure