Skip to content

Plan and implement with anyr task

Run a two-phase pipeline from the terminal — one model writes a step-by-step plan, a second model executes it. Pick a strong planner and a fast implementer to balance quality and cost.

anyr task runs your request through two models in sequence. First a planning model writes a numbered step-by-step plan. Then an implementation model executes that exact plan. Both phases stream to your terminal, and a token summary prints at the end.

Pairing a strong planner with a fast, cheap implementer gets you most of the quality of the strong model at a fraction of the cost.

anyr task "write a script that dedupes my downloads folder"

Choosing the models

By default both phases use your profile's default model. Override either phase:

anyr task "refactor this CSV parser to stream instead of buffering" \
  --plan-model openai/gpt-5.2 \
  --do-model z-ai/glm-4.7-flash
  • --plan-model <id> — the model that writes the plan. Pick a strong reasoning model.
  • --do-model <id> — the model that follows the plan. A fast model works well here, because the hard thinking already happened.

Any model id from the catalog works. Run anyr models to list them.

Confirmation and cost

Before running, the CLI shows both models with their per-token prices from the catalog and asks for confirmation — a task run makes two model calls.

  • In an interactive terminal: review the line, press Enter to run.
  • In scripts, pipes, or CI the prompt cannot be shown, so pass --yes explicitly.

Scripting with --json

--json suppresses streaming and prints a single JSON object with the plan, the result, and per-phase token usage:

anyr task "summarize RFC 8628 in five bullets" --yes --json | jq -r .result

The object contains task, plan_model, do_model, plan, result, and usage.plan / usage.implement with prompt and completion token counts.

Options

FlagMeaning
--plan-model <id>Model for the planning phase (default: profile default model)
--do-model <id>Model for the implementation phase (default: profile default model)
--yesSkip the confirm prompt (required in non-interactive shells)
--jsonPrint {plan, result, usage} as JSON instead of streaming
--profile <name>Use a named profile
--key sk-ar-v1-...Use an explicit key (or the ANYROUTER_API_KEY environment variable)

Signed out? Run anyr auth login first — see Login with AnyRouter.