Skip to content

feat: Issue 131 add cost tiered example#164

Merged
JackChen-me merged 2 commits into
open-multi-agent:mainfrom
HuXiangyu123:issue-131-cost-tiered-pipeline-clean
Apr 24, 2026
Merged

feat: Issue 131 add cost tiered example#164
JackChen-me merged 2 commits into
open-multi-agent:mainfrom
HuXiangyu123:issue-131-cost-tiered-pipeline-clean

Conversation

@HuXiangyu123
Copy link
Copy Markdown
Contributor

What

achieve #131
Added
1.cost-tiered-pipeline.ts
a new patterns/cost-tiered-pipeline.ts example that runs the same four-stage runTasks() pipeline twice:

1. A flagship-only baseline
2. A tiered model mix

The example captures token usage via onTrace, estimates USD cost from a dated PRICING table, 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 lint passes
  • npm test passes
  • Added/updated tests for changed behavior (not needed; example-only change)
  • No new runtime dependencies

Notes

  • The example supports both anthropic and openai-compatible provider paths.
  • Taking into account model performance and input/output pricing, the counterpart gpt following model has been selected.(date 26.4.24)
    '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 },
  • Verified locally with an OpenAI-compatible endpoint and a GPT tiered mix.

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

@JackChen-me JackChen-me merged commit ef4089a into open-multi-agent:main Apr 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Example: cost-optimization tiered pipeline

2 participants