On a real model
The same writer → reviewer flow, run on a real model instead of the dry harness.
- the
afe-first-flowfolder from Your first flow. - an OpenRouter API key in the environment,
OPENROUTER_API_KEY.
- the same ticket, run on a real model, with its tokens and its cost in the ledger.
Steps
-
Get a key at openrouter.ai and export it:
export OPENROUTER_API_KEY=sk-or-... -
Replace
config/models.yamlwith a cheap real model:config/models.yaml# yaml-language-server: $schema=../../../../schemas/afe.dev-v1alpha1.jsonapiVersion: afe.dev/v1alpha1kind: Modelmetadata:name: cheapannotations:afe.dev/description: A cheap model for drafts and reviewsspec:provider: openroutermodel: deepseek/deepseek-v4-flashapiKeyEnv: OPENROUTER_API_KEY -
Run the flow without
--dry, so the harness calls the model:afe run writer-reviewer -i request.yaml -c config/ --local -
Answer the approval at the prompt: type
approve. -
The ticket ends with
T-0001 ticket_done. The model's tokens and cost are recorded in the ticket's ledger. Read Budgets and loop guards to see where.
Troubleshooting
Symptom: the run prints an error event and exits with code 1, with a 401 status in the
message.
Cause: OPENROUTER_API_KEY is missing, misspelled, or was not exported in this shell.
Fix: export it again and re-run. afe never reads a key from a file, only from the
environment.
Symptom: the run takes much longer than the dry harness, then fails with a 429 status.
Cause: the model is rate-limited on your OpenRouter account.
Fix: wait, or switch config/models.yaml to another model. afe retries a 429 three times
with a backoff before it gives up.