{"at":"2026-11-23T05:09:56.346Z","dir":"sent","era":"server_discover","message":{"id":1,"jsonrpc":"2.0","method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/clientCapabilities":{},"io.modelcontextprotocol/clientInfo":{"name":"didrun-lab","version":"0.1.0"},"io.modelcontextprotocol/protocolVersion":"2026-07-28"}}}}
{"at":"2026-11-23T05:09:56.721Z","dir":"received","era":"server_discover","message":{"error":{"code":-32601,"message":"Method not found"},"id":1,"jsonrpc":"2.0"}}
{"at":"2026-11-23T05:09:56.822Z","dir":"sent","era":"initialize","message":{"id":1,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{},"clientInfo":{"name":"didrun-lab","version":"0.1.0"},"protocolVersion":"2025-11-25"}}}
{"at":"2026-11-23T05:09:57.218Z","dir":"received","era":"initialize","message":{"id":1,"jsonrpc":"2.0","result":{"capabilities":{"prompts":{"listChanged":true},"resources":{"listChanged":true},"tools":{"listChanged":true}},"instructions":"ModelCostSaver predicts the cost of an LLM call before you make it and recommends\nthe cheapest model that still meets the task. It is offline, needs no API\nkeys, and makes no network calls for its core tools.\n\nUse it like this:\n- Before any non-trivial LLM call, call select_optimal_model with the task and\n  an estimated token shape. It returns the cheapest capable model, the\n  reasoning, and a fallbackChain.\n- To forecast cost across candidates, call predict_cost with the prompt.\n- To sanity check a habitual choice (for example always reaching for Opus),\n  call optimize_request with the model you planned to use; it shows the\n  savings of a cheaper capable model.\n- compare_models gives a side-by-side cost table; list_models / get_pricing\n  returns the catalog.\n\nTwo recommendation axes:\n- target=self (default): the cheapest model for YOUR own next inference in\n  this client. In an Anthropic-only client the recommendation stays on\n  Anthropic; a globally cheaper option is surfaced as cheaperIfAvailable.\n- target=code: a model you will call from your own application; all providers\n  are eligible because you supply that key in your app.\n\nCosts are in full-precision USD plus an integer usdMicros (a fractional-cent\ncall never rounds to zero). Token counts are estimates unless you supply exact\ncounts. Every cost result carries catalogVersion and asOf so you can see how\nfresh the pricing is. If a call fails with a rate-limit, quota, or 5xx error,\nretry on the next model in the fallbackChain.","protocolVersion":"2025-11-25","serverInfo":{"name":"modelcostsaver","version":"0.1.0"}}}}
{"at":"2026-11-23T05:09:57.218Z","dir":"sent","era":"initialize","message":{"jsonrpc":"2.0","method":"notifications/initialized"}}
{"at":"2026-11-23T05:09:57.218Z","dir":"sent","era":"initialize","message":{"id":2,"jsonrpc":"2.0","method":"tools/list","params":{}}}
{"at":"2026-11-23T05:09:57.221Z","dir":"received","era":"initialize","message":{"id":2,"jsonrpc":"2.0","result":{"tools":[{"description":"Estimate the cost of a single LLM call for one model from known or estimated token counts. Offline, no keys.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"charsPerToken":{"description":"Override the chars-per-token heuristic divisor.","exclusiveMinimum":0,"type":"number"},"expectedOutputText":{"description":"Expected output text; estimated if outputTokens is absent.","maxLength":2000000,"type":"string"},"inputText":{"description":"Prompt text; estimated to tokens if inputTokens is absent.","maxLength":2000000,"type":"string"},"inputTokens":{"description":"Exact input tokens; optional if inputText is given.","minimum":0,"type":"integer"},"model":{"description":"Model alias or full id, e.g. \"sonnet\" or \"claude-sonnet-4-6\".","type":"string"},"outputTokens":{"description":"Exact output tokens; defaults to the model output cap.","minimum":0,"type":"integer"}},"required":["model"],"type":"object"},"name":"estimate_cost","outputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"asOf":{"type":"string"},"breakdown":{"additionalProperties":false,"properties":{"inputUsd":{"type":"number"},"outputUsd":{"type":"number"}},"required":["inputUsd","outputUsd"],"type":"object"},"catalogVersion":{"type":"string"},"cost":{"additionalProperties":false,"properties":{"cents":{"type":"number"},"usd":{"type":"number"},"usdMicros":{"type":"number"}},"required":["usd","usdMicros","cents"],"type":"object"},"inputTokens":{"type":"number"},"model":{"type":"string"},"outputTokens":{"type":"number"},"pricing":{"additionalProperties":false,"properties":{"inputPerMillion":{"type":"number"},"outputPerMillion":{"type":"number"}},"required":["inputPerMillion","outputPerMillion"],"type":"object"},"provider":{"type":"string"},"tier":{"type":"string"},"tokensWereEstimated":{"type":"boolean"}},"required":["model","provider","tier","inputTokens","outputTokens","tokensWereEstimated","cost","breakdown","pricing","catalogVersion","asOf"],"type":"object"},"title":"Estimate cost"},{"description":"Forecast the cost of a prompt across candidate models before the call. Returns a cheapest-first ranking with assumptions. Offline.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"candidates":{"description":"Candidate models (alias or id); defaults to all chat-capable.","items":{"type":"string"},"maxItems":50,"type":"array"},"charsPerToken":{"exclusiveMinimum":0,"type":"number"},"contextTokens":{"description":"Known context tokens already loaded.","minimum":0,"type":"integer"},"expectedOutputTokens":{"description":"Exact output tokens; else inferred from taskClass/model.","minimum":0,"type":"integer"},"includeLocal":{"type":"boolean"},"inputTokens":{"description":"Exact input tokens (skips prompt estimation).","minimum":0,"type":"integer"},"prompt":{"description":"The prompt to forecast; estimated to tokens if inputTokens absent.","maxLength":2000000,"type":"string"},"providers":{"description":"Axis 1: provider availability allowlist (spec 5.4).","items":{"enum":["anthropic","gemini","openai","local"],"type":"string"},"type":"array"},"target":{"description":"Axis 2: \"self\" (default) applies the client scope; \"code\" considers all providers.","enum":["self","code"],"type":"string"},"taskClass":{"description":"Drives the default output cap.","enum":["slot_fill","classify_route","draft_short","summarise","plan_decompose","synthesise","reason_hard","gate_safety"],"type":"string"}},"type":"object"},"name":"predict_cost","outputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"asOf":{"type":"string"},"catalogVersion":{"type":"string"},"cheaperIfAvailable":{"additionalProperties":false,"properties":{"cost":{"additionalProperties":false,"properties":{"usd":{"type":"number"},"usdMicros":{"type":"number"}},"required":["usd","usdMicros"],"type":"object"},"model":{"type":"string"},"provider":{"type":"string"},"reason":{"type":"string"}},"required":["model","provider","cost","reason"],"type":"object"},"cheapest":{"anyOf":[{"$ref":"#/properties/forecasts/items"},{"type":"null"}]},"forecasts":{"items":{"additionalProperties":false,"properties":{"assumptions":{"items":{"type":"string"},"type":"array"},"cost":{"additionalProperties":false,"properties":{"usd":{"type":"number"},"usdMicros":{"type":"number"}},"required":["usd","usdMicros"],"type":"object"},"model":{"type":"string"},"predictedInputTokens":{"type":"number"},"predictedOutputTokens":{"type":"number"},"provider":{"type":"string"},"tier":{"type":"string"}},"required":["model","provider","tier","predictedInputTokens","predictedOutputTokens","cost","assumptions"],"type":"object"},"type":"array"},"notes":{"items":{"type":"string"},"type":"array"},"providerScope":{"items":{"type":"string"},"type":"array"},"scopeSource":{"type":"string"}},"required":["forecasts","cheapest","providerScope","scopeSource","notes","catalogVersion","asOf"],"type":"object"},"title":"Predict cost"},{"description":"Pick the single cheapest model that meets the task tier, capabilities, and budget, with full reasoning and a fallbackChain. Offline.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"estimatedInputTokens":{"description":"Estimated input tokens for the forecast.","minimum":0,"type":"integer"},"estimatedOutputTokens":{"description":"Estimated output tokens for the forecast.","minimum":0,"type":"integer"},"includeLocal":{"type":"boolean"},"maxCostUsd":{"description":"Budget ceiling for the predicted call cost.","minimum":0,"type":"number"},"providers":{"description":"Axis 1: provider availability allowlist (spec 5.4).","items":{"enum":["anthropic","gemini","openai","local"],"type":"string"},"type":"array"},"requiredCapabilities":{"description":"Capabilities the model must support.","items":{"enum":["chat","tools","vision","streaming"],"type":"string"},"type":"array"},"target":{"description":"Axis 2: \"self\" (default) applies the client scope; \"code\" considers all providers.","enum":["self","code"],"type":"string"},"task":{"description":"Free-text task; used for the tier heuristic when taskClass is absent.","maxLength":20000,"type":"string"},"taskClass":{"description":"Explicit task class; overrides the heuristic.","enum":["slot_fill","classify_route","draft_short","summarise","plan_decompose","synthesise","reason_hard","gate_safety"],"type":"string"}},"required":["estimatedInputTokens","estimatedOutputTokens"],"type":"object"},"name":"select_optimal_model","outputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"asOf":{"type":"string"},"budgetExceeded":{"type":"boolean"},"catalogVersion":{"type":"string"},"cheaperIfAvailable":{"additionalProperties":false,"properties":{"model":{"type":"string"},"predictedCost":{"$ref":"#/properties/selected/anyOf/0/properties/predictedCost"},"provider":{"type":"string"},"reason":{"type":"string"}},"required":["model","provider","predictedCost","reason"],"type":"object"},"fallbackChain":{"items":{"type":"string"},"type":"array"},"providerScope":{"items":{"type":"string"},"type":"array"},"reasoning":{"items":{"type":"string"},"type":"array"},"rejected":{"items":{"additionalProperties":false,"properties":{"model":{"type":"string"},"reason":{"type":"string"}},"required":["model","reason"],"type":"object"},"type":"array"},"runnerUp":{"additionalProperties":false,"properties":{"model":{"type":"string"},"predictedCost":{"$ref":"#/properties/selected/anyOf/0/properties/predictedCost"}},"required":["model","predictedCost"],"type":"object"},"scopeSource":{"type":"string"},"selected":{"anyOf":[{"additionalProperties":false,"properties":{"model":{"type":"string"},"predictedCost":{"additionalProperties":false,"properties":{"usd":{"type":"number"},"usdMicros":{"type":"number"}},"required":["usd","usdMicros"],"type":"object"},"provider":{"type":"string"},"tier":{"type":"string"}},"required":["model","provider","tier","predictedCost"],"type":"object"},{"type":"null"}]},"shortfallUsd":{"type":"number"}},"required":["selected","rejected","reasoning","fallbackChain","catalogVersion","asOf"],"type":"object"},"title":"Select optimal model"},{"description":"Compare models side by side for a fixed token shape, cheapest first, with the multiple of the cheapest. Offline.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"inputTokens":{"description":"Input tokens for the comparison.","minimum":0,"type":"integer"},"models":{"description":"Models to compare (alias or id).","items":{"type":"string"},"maxItems":50,"minItems":1,"type":"array"},"outputTokens":{"description":"Output tokens for the comparison.","minimum":0,"type":"integer"},"providers":{"description":"Axis 1: provider availability allowlist (spec 5.4).","items":{"enum":["anthropic","gemini","openai","local"],"type":"string"},"type":"array"},"target":{"description":"Axis 2: \"self\" (default) applies the client scope; \"code\" considers all providers.","enum":["self","code"],"type":"string"}},"required":["models","inputTokens","outputTokens"],"type":"object"},"name":"compare_models","outputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"asOf":{"type":"string"},"catalogVersion":{"type":"string"},"cheaperIfAvailable":{"additionalProperties":false,"properties":{"cost":{"additionalProperties":false,"properties":{"usd":{"type":"number"},"usdMicros":{"type":"number"}},"required":["usd","usdMicros"],"type":"object"},"model":{"type":"string"},"provider":{"type":"string"},"reason":{"type":"string"}},"required":["model","provider","cost","reason"],"type":"object"},"cheapest":{"anyOf":[{"$ref":"#/properties/rows/items"},{"type":"null"}]},"mostCapable":{"anyOf":[{"$ref":"#/properties/rows/items"},{"type":"null"}]},"providerScope":{"items":{"type":"string"},"type":"array"},"rows":{"items":{"additionalProperties":false,"properties":{"capabilities":{"items":{"type":"string"},"type":"array"},"cost":{"additionalProperties":false,"properties":{"usd":{"type":"number"},"usdMicros":{"type":"number"}},"required":["usd","usdMicros"],"type":"object"},"model":{"type":"string"},"provider":{"type":"string"},"relativeToCheapest":{"type":"string"},"tier":{"type":"string"}},"required":["model","provider","tier","capabilities","cost","relativeToCheapest"],"type":"object"},"type":"array"},"scopeSource":{"type":"string"},"unknownModels":{"items":{"type":"string"},"type":"array"}},"required":["rows","cheapest","mostCapable","unknownModels","providerScope","scopeSource","catalogVersion","asOf"],"type":"object"},"title":"Compare models"},{"description":"Return the model catalog with pricing, optionally filtered. capabilities are arrays. Offline.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"capability":{"description":"Require a capability.","enum":["chat","tools","vision","streaming"],"type":"string"},"includeLocal":{"description":"Include local / self-hosted $0 models (off by default).","type":"boolean"},"maxInputPerMillion":{"description":"Only models at or below this input price per 1M tokens.","minimum":0,"type":"number"},"provider":{"description":"Filter to a single provider.","enum":["anthropic","gemini","openai","local"],"type":"string"},"tier":{"description":"Filter to a single tier.","enum":["trivial","fast","standard","reasoning"],"type":"string"}},"type":"object"},"name":"list_models","outputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"asOf":{"type":"string"},"catalogVersion":{"type":"string"},"count":{"type":"number"},"models":{"items":{"additionalProperties":false,"properties":{"alias":{"type":"string"},"capabilities":{"items":{"type":"string"},"type":"array"},"id":{"type":"string"},"inputPerMillion":{"type":"number"},"license":{"type":"string"},"outputCap":{"type":"number"},"outputPerMillion":{"type":"number"},"provider":{"type":"string"},"tier":{"type":"string"}},"required":["id","alias","provider","tier","capabilities","inputPerMillion","outputPerMillion"],"type":"object"},"type":"array"},"source":{"type":"string"}},"required":["models","count","catalogVersion","asOf","source"],"type":"object"},"title":"List models / pricing"},{"description":"Return the model catalog with pricing, optionally filtered. capabilities are arrays. Offline.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"capability":{"description":"Require a capability.","enum":["chat","tools","vision","streaming"],"type":"string"},"includeLocal":{"description":"Include local / self-hosted $0 models (off by default).","type":"boolean"},"maxInputPerMillion":{"description":"Only models at or below this input price per 1M tokens.","minimum":0,"type":"number"},"provider":{"description":"Filter to a single provider.","enum":["anthropic","gemini","openai","local"],"type":"string"},"tier":{"description":"Filter to a single tier.","enum":["trivial","fast","standard","reasoning"],"type":"string"}},"type":"object"},"name":"get_pricing","outputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"asOf":{"type":"string"},"catalogVersion":{"type":"string"},"count":{"type":"number"},"models":{"items":{"additionalProperties":false,"properties":{"alias":{"type":"string"},"capabilities":{"items":{"type":"string"},"type":"array"},"id":{"type":"string"},"inputPerMillion":{"type":"number"},"license":{"type":"string"},"outputCap":{"type":"number"},"outputPerMillion":{"type":"number"},"provider":{"type":"string"},"tier":{"type":"string"}},"required":["id","alias","provider","tier","capabilities","inputPerMillion","outputPerMillion"],"type":"object"},"type":"array"},"source":{"type":"string"}},"required":["models","count","catalogVersion","asOf","source"],"type":"object"},"title":"List models / pricing"},{"description":"Check whether a cheaper capable model exists for a call you plan to make, and report the savings. Offline.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"crossProvider":{"description":"Consider other providers too (may need a different API key). Default false.","type":"boolean"},"currentModel":{"description":"The model you plan to call (alias or id).","type":"string"},"includeLocal":{"type":"boolean"},"inputTokens":{"description":"Input tokens for the call.","minimum":0,"type":"integer"},"outputTokens":{"description":"Output tokens for the call.","minimum":0,"type":"integer"},"providers":{"description":"Axis 1: provider availability allowlist (spec 5.4).","items":{"enum":["anthropic","gemini","openai","local"],"type":"string"},"type":"array"},"target":{"description":"Axis 2: \"self\" (default) applies the client scope; \"code\" considers all providers.","enum":["self","code"],"type":"string"},"taskClass":{"description":"Task class; sets the tier the recommendation must still meet.","enum":["slot_fill","classify_route","draft_short","summarise","plan_decompose","synthesise","reason_hard","gate_safety"],"type":"string"}},"required":["currentModel","inputTokens","outputTokens"],"type":"object"},"name":"optimize_request","outputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","additionalProperties":false,"properties":{"alreadyOptimal":{"type":"boolean"},"asOf":{"type":"string"},"catalogVersion":{"type":"string"},"current":{"anyOf":[{"additionalProperties":false,"properties":{"model":{"type":"string"},"provider":{"type":"string"},"tier":{"type":"string"},"usd":{"type":"number"},"usdMicros":{"type":"number"}},"required":["model","provider","tier","usd","usdMicros"],"type":"object"},{"type":"null"}]},"providerScope":{"items":{"type":"string"},"type":"array"},"reasoning":{"items":{"type":"string"},"type":"array"},"recommended":{"anyOf":[{"$ref":"#/properties/current/anyOf/0"},{"type":"null"}]},"savingsPct":{"type":"number"},"savingsUsd":{"type":"number"},"scopeSource":{"type":"string"}},"required":["current","recommended","savingsUsd","savingsPct","alreadyOptimal","reasoning","providerScope","scopeSource","catalogVersion","asOf"],"type":"object"},"title":"Optimize request"}]}}}
