langchain - 💡(How to fix) Fix Feature: WhichModel integration for cost-aware model routing [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langchain-ai/langchain#36565Fetched 2026-04-08 03:01:05
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Timeline (top)
closed ×1commented ×1labeled ×1

Code Example

{"mcpServers":{"whichmodel":{"url":"https://whichmodel.dev/mcp"}}}
RAW_BUFFERClick to expand / collapse

Feature request

Motivation:

LangChain applications that route between multiple LLMs need real-time pricing data to make cost-optimal decisions. LangSmith provides observability/cost tracking after the fact, but there's no built-in way to make cost-aware routing decisions at runtime.

Proposal:

WhichModel is a free MCP server that tracks pricing and capabilities across 100+ models (Anthropic, OpenAI, Google, Meta, Mistral, Cohere, etc.), refreshed every 4 hours.

Since LangChain/LangGraph has native MCP support via the MCP adapter, WhichModel already works out of the box. I'd like to propose:

  1. Adding WhichModel to the LangChain docs/examples as a cost-aware routing tool
  2. Optionally, a langchain-whichmodel integration package

MCP Config (zero-install):

{"mcpServers":{"whichmodel":{"url":"https://whichmodel.dev/mcp"}}}

4 tools:

  • recommend_model — cost-optimized suggestions by task type, complexity, budget
  • compare_models — head-to-head comparison with volume cost projections
  • get_pricing — raw pricing data with filters
  • check_price_changes — pricing change tracker

Example use case: A LangGraph agent could call recommend_model at each routing step to dynamically select the cheapest model that meets the task's requirements, instead of hardcoding model choices.

No API key needed for free tier (1,000 req/mo). MIT licensed.

Links:

extent analysis

TL;DR

Integrate WhichModel into LangChain to enable cost-aware routing decisions by utilizing its MCP server for real-time pricing data.

Guidance

  • Evaluate the feasibility of adding WhichModel to LangChain docs/examples as a cost-aware routing tool to provide users with a straightforward way to make cost-optimal decisions.
  • Consider developing a langchain-whichmodel integration package to streamline the process of using WhichModel with LangChain.
  • Review the provided MCP config and 4 tools (recommend_model, compare_models, get_pricing, check_price_changes) to understand how they can be leveraged for cost-aware routing.
  • Assess the example use case of a LangGraph agent calling recommend_model to dynamically select the cheapest model that meets task requirements.

Example

{
  "mcpServers": {
    "whichmodel": {
      "url": "https://whichmodel.dev/mcp"
    }
  }
}

This MCP config example demonstrates how to integrate WhichModel into LangChain.

Notes

The proposed integration relies on the MCP adapter in LangChain/LangGraph, and WhichModel's free tier has a limit of 1,000 requests per month.

Recommendation

Apply workaround by integrating WhichModel into LangChain to enable cost-aware routing decisions, as it provides a viable solution for making real-time pricing data available.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

langchain - 💡(How to fix) Fix Feature: WhichModel integration for cost-aware model routing [1 comments, 2 participants]