Review by a stronger model
Let a fast model do the work, and give it a stronger model to consult on the one decision that needs it.
- Pick the two models.
- Give the worker a reviewer to call.
- Send the reviewer a short brief.
- Offer the reviewer only when it earns its cost.
- Read what each model cost.
1. Pick the two models
Two seats, two models. The worker reads the task and writes the answer. The reviewer answers one question, briefly, when the worker asks it.
| Seat | Does | Model in this recipe |
|---|---|---|
| worker | reads the task, drafts the answer, decides when to ask | anthropic/claude-sonnet-4.5 |
| reviewer | answers one question, in a few lines | anthropic/claude-opus-5.5 |
The samples below put anthropic/claude-sonnet-4.5 in both seats, so they run as they stand. Set REVIEWER to the reviewer's model IDModel IDThe name a request calls a model by, lab/model, copied from Models.More on Models →, from the table or from Models.
2. Give the worker a reviewer to call
The reviewer is a tool in the worker's tools, like any function of yours (Tools and function calling). When the worker calls ask_reviewer, your code sends its question to the reviewer's model, in a request of its own, and returns the reply as the call's result. The worker reads it and finishes the answer.
Yacine builds the delivery app for a pharmacy chain in Sétif. His agent checks each change before it ships, and a change that touches payments goes past the stronger model first.
import json
import os
from openai import OpenAI
API_KEY = os.environ["OPENDUNES_API_KEY"]
BASE_URL = "https://opendunes.com/v1"
MODEL = "anthropic/claude-sonnet-4.5"
REVIEWER = "anthropic/claude-sonnet-4.5"
WORKER_BRIEF = (
"You check changes before they ship. When a decision is risky, call "
"ask_reviewer once, with a short question: the decision, the files, "
"the risks. Never paste whole diffs."
)
REVIEWER_BRIEF = (
"You review engineering plans. Name hidden assumptions, missing "
"rollback steps and missing tests. Five lines at most."
)
TASK = (
"Change: move payment records to a new monthly table.\n"
"Files: db/0042_payments.sql, app/payments/save.py\n"
"Question: ship it, or send it back?"
)
SIGNALS = ["schema change", "payment path", "no rollback step"]
RISKY = ["schema change", "payment path", "no tests"]
MAX_STEPS = 6
client = OpenAI(base_url=BASE_URL, api_key=API_KEY)
spent = {"worker": 0.0, "reviewer": 0.0}
def ask_reviewer(question):
reply = client.chat.completions.create(
model=REVIEWER,
max_tokens=300,
messages=[
{"role": "system", "content": REVIEWER_BRIEF},
{"role": "user", "content": question},
],
)
spent["reviewer"] += reply.usage.cost
return reply.choices[0].message.content
review_tool = {
"type": "function",
"function": {
"name": "ask_reviewer",
"description": "Ask a senior reviewer one short question.",
"parameters": {
"type": "object",
"properties": {"question": {"type": "string"}},
"required": ["question"],
},
},
}
offer = any(signal in RISKY for signal in SIGNALS)
extra = {"tools": [review_tool]} if offer else {}
task = TASK + "\nSignals: " + ", ".join(SIGNALS)
messages = [
{"role": "system", "content": WORKER_BRIEF},
{"role": "user", "content": task},
]
for step in range(MAX_STEPS):
reply = client.chat.completions.create(
model=MODEL,
messages=messages,
**extra,
)
spent["worker"] += reply.usage.cost
message = reply.choices[0].message
if not message.tool_calls:
break
messages.append(message)
for call in message.tool_calls:
question = json.loads(call.function.arguments)["question"]
messages.append(
{
"role": "tool",
"tool_call_id": call.id,
"content": ask_reviewer(question),
}
)
print(message.content)
print(spent)The cURL sample is the worker's first turn: its answer carries the ask_reviewer call your code runs.
The same review can run in one request, with the advisor helperHelperA tool run for you when a model reaches for it mid-answer: a web search, a page read, a sandbox. Named opendunes:‹name›.More on Helpers →, opendunes:advisor: OpenDunes calls the stronger model for the worker, and you write no loop. Helpers shows how. The loop above is the version you own: you see every question, and you decide what the reviewer reads.
3. Send the reviewer a short brief
The reviewer's request is a request like any other, charged on its own. The reviewer sees its brief and the worker's question, and nothing else: not the conversation, not the task. This is the request ask_reviewer sends, with the reviewer's model in place.
{
"model": "anthropic/claude-opus-5.5",
"max_tokens": 300,
"messages": [
{
"role": "system",
"content": "You review engineering plans. Five lines at most."
},
{
"role": "user",
"content": "Payments move to a monthly table, no rollback. Safe to ship?"
}
]
}max_tokens caps the reviewer's answer, and with it the reviewer's share of the charge.
| Goes in the question | Stays out |
|---|---|
| the decision to review | the whole conversation |
| the files it touches | whole diffs and logs |
| the risks the worker sees | keys, customer data |
| the answer it expects: ship or send back | anything the decision does not turn on |
Don't forward the whole conversation to the reviewer. It reads every token you send, at its own rates, and the stronger model's rates are the higher ones.
Tell the worker, in its brief, what a question to the reviewer holds, and cap the reviewer's answer with max_tokens.
4. Offer the reviewer only when it earns its cost
Most tasks never need the reviewer. The samples offer ask_reviewer only when a task carries a signal from RISKY; for any other task, tools is not sent, and the request stays on the worker alone.
| Signal on the task | The worker gets |
|---|---|
none from RISKY | no reviewer: one model, one charge per turn |
| a schema change, a payment path, no tests | ask_reviewer, to call once if it helps |
Your code knows these signals before the first request: the files a change touches, whether tests ran, how much money moves. Set them in SIGNALS from there.
5. Read what each model cost
Each request is charged on its own, at its model's rates, and usage.cost on each answer carries its charge in DADAThe Algerian dinar, the one currency the docs show.More on Balance and charges →. The samples keep two sums: worker, every turn of the worker, and reviewer, every call to the reviewer. Activity, in the app, lists each request under its model. What to do on each status: Errors and retries.
A reviewer that is a person, not a model: Human approval on tool calls.
Last modified on