# Plan and implement with anyr task

> Run a two-phase pipeline from the terminal: one model plans, a second model executes the plan.


# `anyr task`

`anyr task` runs a request through two models in sequence: a planning model writes a numbered plan, then an implementation model executes it. Both phases stream to your terminal and a token summary prints at the end. A strong planner with a fast, cheap implementer keeps most of the quality at lower cost.

```bash
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
```

By default both phases use your profile's default model. Any id from [the catalog](https://anyrouter.dev/models) works (`anyr models` lists them).

Before running, the CLI shows both models with their per-token prices and asks for confirmation, since a task makes two model calls. Without a terminal (scripts, pipes, CI) pass `--yes`.

`--json` suppresses streaming and prints one object with `task`, `plan_model`, `do_model`, `plan`, `result`, and `usage.plan` / `usage.implement` (prompt and completion tokens):

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

| Flag | Meaning |
| --- | --- |
| `--plan-model <id>` | Model for the planning phase (default: profile default model) |
| `--do-model <id>` | Model for the implementation phase (default: profile default model) |
| `--yes` | Skip the confirm prompt (required in non-interactive shells) |
| `--json` | Print `{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 ([Login](/cli/login)).


## Related

- [Delegate tasks between coding agents](/docs/cli/delegate.md)
- [Login with AnyRouter](/docs/cli/login.md)
