Skip to content
ChainOpt

Three commands from install to first finding

The whole of ChainOpt is a Python package and a CLI that runs on your machine. Nothing is uploaded and there is no account to sign into.

  1. step 1 of 3

    Add the SDK

    ChainOpt is in private beta and is not on PyPI yet, so the install line comes with your invite. Once it is in, ChainOpt patches the httpx transport your client already uses, and outbound calls to OpenAI and Anthropic are recorded without touching your pipeline code. Works with LangChain, LangGraph, and the raw provider SDKs.

    chainopt init

    wrote .chainopt/config.toml

    patched httpx transport

  2. step 2 of 3

    Map the pipeline

    Point the CLI at your source. It walks the call graph and infers what each step is for, whether that is routing, extraction, summarizing or validation, and writes a structured map of the pipeline.

    chainopt analyze ./src

    resolved 7 call sites across 6 steps

    wrote pipeline_map.json

  3. step 3 of 3

    Read the findings

    Once your application has run, ChainOpt compares what the map predicted against what actually executed, and ranks the waste it found. Each finding opens onto the runs it was drawn from, which is the section below.

    chainopt findings

    redundancy steps 3, 6 +$38.20/mo

    oversizing step 4 +$21.40/mo

    parallelism step 5 -8.4s/run

Three findings from one pipeline

A finding says what kind of waste it is, how confident the match is, what it is worth, and which calls it was drawn from. Open one and you get the prompts and the responses, so you can check the reasoning before you touch the code.

redundancy2,000 runs analyzed

Steps 3 and 6 do the same work

+$38.20/mo recoverable

prompt similarity
0.94
output similarity
0.89
duplicate calls
2,000

Both calls send near-identical prompts and return summaries with the same structure. Step 6 can most likely be dropped and its downstream context filled from step 3's response.

step 3 · sonnet

prompt
Summarize the ticket below in two sentences for triage. State the customer's problem and what they have already tried.
response
The customer cannot complete checkout: the payment step returns a generic error after they enter card details. They have retried on two browsers and cleared their cache.

step 6 · sonnet

prompt
Give a two-sentence summary of this ticket so it can be routed. Cover the problem and any steps the customer already took.
response
Checkout fails for this customer with an unspecified error once card details are submitted. They have already tried a second browser and cleared their cache.
Matched by prompt embedding, then confirmed against output structure.
oversizing2,000 runs analyzed

Step 4 sends a filled-in template to a frontier model

+$21.40/mo recoverable

current model
opus
cheapest match
haiku
output match
0.99

The step's outputs never deviate from a fixed shape and the prompt supplies every value, so the task does not need the model it is being sent to. ChainOpt replays the observed calls against smaller models and names the cheapest one that reproduced the same outputs.

step 4 · opus

prompt
Return a JSON routing plan with keys queue, priority and owner. queue is one of billing, technical or account. Ticket category: billing. Severity: 2. Region: EU.
response
{"queue": "billing", "priority": "P2", "owner": "billing-eu"}

step 4 · haiku, replayed

prompt
Return a JSON routing plan with keys queue, priority and owner. queue is one of billing, technical or account. Ticket category: billing. Severity: 2. Region: EU.
response
{"queue": "billing", "priority": "P2", "owner": "billing-eu"}
Detected from output-schema stability, then replayed against smaller models.
parallelism2,000 runs analyzed

Step 5 waits on step 3 and never reads it

-8.4sper run, no change to spend

time spent waiting
8.4s
values passed on
none
safe to reorder
yes

Step 5 is awaited after step 3 because of how the two were written, not because it needs anything step 3 produces. Started together, the pair finishes when the slower of the two finishes rather than when both have run end to end.

step 3 · sonnet, output

prompt
Summarize the ticket below in two sentences for triage.
response
The customer cannot complete checkout: the payment step returns a generic error after they enter card details. They have retried on two browsers and cleared their cache.

step 5 · haiku, next call

prompt
Retrieve the three most relevant help-center articles for account_id 41822 and category billing.
response
kb-2831 Card declined at checkout; kb-1190 Payment retry limits; kb-0442 Updating a saved card.
Derived from the call graph: no value produced by step 3 reaches step 5.

Illustrative example, not measured results.

current
$59.60
$141.00optimized
$81.40

Amber is what the two cost findings above account for. Teal is what the pipeline still costs once both are applied.

The parallelism finding returns time rather than spend, so it is not in these bars.

Those three findings came out of one six-step pipeline. Yours is probably larger.