Skip to main content
Glama

OpenRouter ChatGPT Plugin

Analytics, Cost Optimization & MCP Tools for ChatGPT and Codex.

An open-source OpenRouter plugin that combines OpenRouter's official MCP server with a private analytics bridge for account spend, usage analysis, model comparison, cost anomaly detection, and cost optimization.

Version status (2026-10-11): RouterLens personal operations 0.5.0, with a sanitized public Worker candidate and a separate legacy root application 0.3.0 Alpha.

Reviewed source snapshot

The standalone RouterLens Worker candidate adds request details, spend investigations, persistent reports, experiment comparisons, and versioned model presets with routing validation/export. The historical directory name remains; use its own install/build/test workflow.

Private source 00ade82f2876cf3d1f396046527c56bd110cb919 deployed successfully on 2026-10-11. Hosting success is distinct from live acceptance and scheduled notification delivery. Public identity and deployment placeholders remain unconfigured. No team version, paid inference or production model switch is included.

Related MCP server: Langfuse MCP Server

What it does

Account

  • Remaining OpenRouter credit

  • Today / yesterday / 7-day / 30-day spend

  • Usage trends

Models

  • Live model search through OpenRouter's official MCP

  • Latest models

  • Pricing and context windows

  • Provider endpoints

  • Side-by-side model comparison

  • Benchmark/ranking evidence through OpenRouter's official MCP

Analytics

  • Spend by model

  • Requests by model

  • Spend by provider

  • Spend by API key

  • Token/cache/reasoning-token analysis

  • Cost anomaly detection

  • Cost optimization evidence

Developer

  • Generation inspection through OpenRouter's official MCP

  • OpenRouter docs search

  • API-key metadata and limits

  • Live Analytics schema discovery

Architecture

ChatGPT / Codex
      |
      +----------------------+
      |                      |
OpenRouter official MCP   RouterLens MCP
      |                      |
Models / Providers        Credits / Analytics
Benchmarks / Docs         Cost Doctor / Key metadata
Generations / Tests       Model comparison
      |                      |
      +---------- OpenRouter-+

The official MCP handles capabilities OpenRouter already exposes well. RouterLens adds the private account-analysis layer.

Why two MCP servers?

Duplicating OpenRouter's official model and generation tools would create unnecessary maintenance. RouterLens focuses on the missing workflow layer:

  • account analytics

  • cost attribution

  • cost anomalies

  • cost optimization

  • API-key usage visibility

  • normalized model/provider comparisons

RouterLens tools

Tool

Purpose

get_account_summary

Balance and today/yesterday/7D/30D spend

get_analytics_meta

Live Analytics API schema

query_usage

Generic spend/request/token breakdowns

analyze_cost_anomalies

Rolling-baseline spend spike detection

analyze_cost_optimization

Evidence-backed optimization opportunities

list_api_keys

Read-only key metadata, limits, usage

compare_models

Live price/context/provider comparison

routerlens_status

Configuration diagnostics

Self-hosting

Requirements:

  • Node.js 20+

  • Vercel or another Next.js-compatible host

  • OpenRouter Management API Key

Environment variables:

OPENROUTER_MANAGEMENT_KEY=
MCP_AUTH_TOKEN=

Install and build:

npm install
npm run check

Run locally:

npm run dev

Endpoints:

  • MCP: /api/mcp

  • Health: /api/health

Security

  • Management Keys are read from server environment variables.

  • Secrets are never returned by MCP tools.

  • API-key listing only exposes metadata and hashes returned by OpenRouter.

  • V0.3 contains no key create/update/delete tools.

  • The self-hosted MCP endpoint is protected by MCP_AUTH_TOKEN.

  • Account data is queried from OpenRouter on demand and is not persisted by RouterLens.

See SECURITY.md and docs/security.md.

Plugin package

The repository contains the portable ChatGPT/Codex plugin files:

  • plugin.json

  • mcp.json

  • .mcp.json

  • .codex-plugin/plugin.json

  • skills/openrouter/SKILL.md

The plugin connects to:

  1. OpenRouter official MCP: https://mcp.openrouter.ai/mcp

  2. RouterLens analytics MCP: your self-hosted endpoint

Roadmap

0.3 Alpha

  • Read-only analytics

  • Cost Doctor

  • Cost anomalies

  • API-key metadata

  • Model comparison

Next

  • Hosted multi-user OAuth flow

  • Encrypted per-user OpenRouter credentials

  • Secure key write actions

  • Presets and routing builder

  • Guardrails and workspace governance

  • Optional dashboard and recurring cost reports

License

Apache-2.0.

This is an independent open-source project and is not affiliated with or endorsed by OpenRouter.

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    Enables querying Langfuse analytics, cost metrics, and usage data across multiple projects. Provides tools for trace analysis, model/service cost breakdowns, and daily usage trends through natural language queries.
    24
    50 npm
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI-powered analytics from Stripe, PayPal, and Google Analytics 4 (BigQuery) data sources with built-in guardrails and automated workflows for financial and web performance insights.
    ISC
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants like Claude or ChatGPT to query OpenRouter's 300+ models for pricing, context length, capabilities, and rankings through tools such as model-card, compare-models, cheapest-for, cost-estimator, and usage-rankings, using a public, key-less API with 6-hour caching.
    129 npm
    1
    MIT