AI agents and MCP servers LinkedIn GitHub @expertvagabond

Lab

Which OpenRouter setting saves money?

Same prompt, every routing option, measured.

Matthew Karsten with a purple cap beside the title Which OpenRouter setting saves money?

Most OpenRouter routing options are described in general terms. This lab measures them instead. It sends the same support-triage prompt through each strategy in the repo's src/strategies.ts and prints, from each response, the provider that served it, the model that ran, the latency, the tokens, the cached tokens, and the cost.

Sample results

These rows are from a run recorded in the repo:

  • default: DeepInfra, deepseek/deepseek-chat-v3.1, 916 ms, 4 cached tokens, $0.00022
  • sort:price: DeepInfra, deepseek/deepseek-chat-v3.1, 257 ms, 570 cached tokens, $0.00015

The same prompt produced 570 cached tokens under sort:price and 4 under the default. The full run had 12 calls and cost $0.0165 in total.

The cache row hit on its first call because an earlier run had already written the cache. The cold call in that earlier run cost $0.01158, so the warm read was a 74% cut, per the repo's notes.

The code and the full results table are in the openrouter-routing-lab repo.

More labs

  • Thumbnail: Catch AI agent regressions before you ship
  • Thumbnail: Add OAuth to your MCP server
  • Thumbnail: Deploy a model to RunPod Serverless

← All posts