feat: Issue 131 add cost tiered example#164
Merged
JackChen-me merged 2 commits intoApr 24, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
achieve #131
Added
1.cost-tiered-pipeline.ts
a new
patterns/cost-tiered-pipeline.tsexample that runs the same four-stagerunTasks()pipeline twice:The example captures token usage via
onTrace, estimates USD cost from a datedPRICINGtable, prints a side-by-side comparison table,and asserts that the tiered run achieves at least 40% cost savings.
Also add a one-line entry for the example in
examples/README.md.Prerequisites
OPENAI_API_KEY='your_KEY'
OPENAI_BASE_URL='your_URL'
LLM_PROVIDER='openai'
Why
Fixes #131
This makes the cost story behind per-agent model assignment concrete with a runnable example, instead of leaving it as an abstract framework capability.
Checklist
npm run lintpassesnpm testpassesNotes
anthropicandopenai-compatibleprovider paths.'gpt-5.5': { input: 5, output: 30 },
'gpt-5.4': { input: 2.5, output: 15 },
'gpt-5.4-mini': { input: 0.75, output: 4.5 },
Local run achieved
55.1%cost savings versus the baseline,Models: researcher=gpt-5.5, classifier=gpt-5.5, drafter=gpt-5.5, reviewer=gpt-5.5
Tokens — input: 6229, output: 2606
Estimated USD cost — $0.1093
Wall time — 56.02s
Models: researcher=gpt-5.4-mini, classifier=gpt-5.4-mini, drafter=gpt-5.4, reviewer=gpt-5.5
Tokens — input: 5914, output: 2199
Estimated USD cost — $0.0491
Wall time — 62.88s