The Problem
Claude Opus is brilliant but expensive. Claude Sonnet is fast and cheap but sometimes needs a second opinion on strategic decisions. What if Sonnet could ask Opus for advice — but only when it actually needs it?
The Advisor Pattern
We built an open-source implementation where Sonnet (the executor) has a tool called ask_advisor. During task execution, Sonnet autonomously decides when to consult Opus (the advisor) — and has a budget of N calls to use wisely.
from advisor import AdvisorClientclient = AdvisorClient()
result = client.run(
"Design a 3-shot video storyboard for a product ad",
executor="claude-sonnet-4-6",
advisor="claude-opus-4-6",
max_advisor_calls=3,
)
print(result.text) # Opus-informed output at Sonnet prices
How It Works
The pattern uses standard Claude API custom tools — no special features needed:
- Define an
ask_advisortool with question + context schema - Sonnet receives the task and decides if it needs advice
- When Sonnet calls
ask_advisor, we intercept and call Opus - Opus's response is fed back as a tool_result
- Sonnet incorporates the advice and continues execution
Real-World Example: Video Production
We integrated this into our AI Video Studio skill. When you ask it to create a video storyboard:
python3 studio.py storyboard
--idea "Product ad for a flatbed semi-trailer"
--shots 3 --duration 5 --lang zhSonnet asks Opus: "What creative direction for a heavy machinery ad?"
Opus advises: "Use contrast — industrial power against epic landscape. Low angle for dominance, aerial for scale. The product should look like it belongs in the scene, not placed."
Sonnet then generates a production-ready JSON storyboard with detailed Seedance prompts, Chinese captions, and narration text — all informed by Opus's creative direction.
Cost Comparison
| Approach | Cost (typical task) | Quality |
|---|---|---|
| Everything on Opus | $$$ | Excellent |
| Everything on Sonnet | $ | Good |
| Advisor Pattern | $$ (80% cheaper than Opus-only) | Excellent on decisions, Good on execution |
When Sonnet Consults Opus
The beauty is that Sonnet decides autonomously:
- Creative direction → asks advisor
- Trade-off decisions → asks advisor
- Quality review → asks advisor
- Routine execution → proceeds alone
Get Started
pip install anthropic
export ANTHROPIC_API_KEY="sk-ant-..."
Standalone
git clone https://github.com/iPythoning/claude-advisor-pattern
python advisor.py "Your complex task here" --max-calls 3
With AI Video Studio
git clone https://github.com/iPythoning/ai-video-studio
python studio.py storyboard --idea "Your video concept" --shots 3
Repos:
- claude-advisor-pattern — Standalone library
- ai-video-studio — Full video production pipeline with advisor integration
Built with Claude API · OpenClaw