Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,11 @@ Package managers have shown install size for decades. Almost no MCP server shows

| Profile | Tools | Context |
|---------|-------|---------|
| `full` *(default)* | 19 | 14,011 |
| `full` *(default)* | 19 | 14,014 |
| `trading` | 8 | 5,411 |
| `media` | 7 | 6,795 |
| `research` | 5 | 2,752 |
| `chat` | 3 | 2,079 |
| `research` | 5 | 2,755 |
| `chat` | 3 | 2,082 |

Running `--profile trading` instead of the default costs **61% less context** for the same trading
workflow. If you only ever ask about markets, that is the single cheapest change you can make.
Expand Down
6 changes: 3 additions & 3 deletions docs/mcp-schema-overhead.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ Written 2026-09-01, verified against `@modelcontextprotocol/sdk` 1.29.0. Numbers

| Profile | Tools | Context |
|---------|-------|---------|
| `full` *(default)* | 19 | 14,011 |
| `full` *(default)* | 19 | 14,014 |
| `trading` | 8 | 5,411 |
| `media` | 7 | 6,795 |
| `research` | 5 | 2,752 |
| `chat` | 3 | 2,079 |
| `research` | 5 | 2,755 |
| `chat` | 3 | 2,082 |

Descriptions are ~54% of it, input schemas ~42%. `--profile trading` costs 61% less than the
default for the same workflow.
Expand Down
2 changes: 1 addition & 1 deletion scripts/verify-prices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ const PROBES: Probe[] = [
// drift apart are invisible until an invoice says otherwise.
...([
["powerful", "openai/gpt-5.4-pro"],
["reasoning", "openai/gpt-5.6-sol"],
["reasoning", "anthropic/claude-opus-5"], // gpt-5.6-sol cut to $4/$20 2026-08-21
["coding", "anthropic/claude-opus-5"],
["fast", "google/gemini-3.5-flash"],
["glm", "zai/glm-5.2"],
Expand Down
4 changes: 2 additions & 2 deletions src/tools/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,13 +432,13 @@ Notable modes:
- mode:"glm" → Zhipu GLM-5 / 5.2 / 5.1 / 5-Turbo (strong at coding)
- mode:"free" → free models (no cost)

Pick directly: model:"anthropic/claude-opus-5", model:"moonshot/kimi-k3", model:"openai/gpt-5.6-sol", model:"xai/grok-4.5", model:"nvidia/gpt-oss-120b" (free).
Pick directly: model:"anthropic/claude-opus-5.5", model:"openai/gpt-6-sol", model:"xai/grok-4.7", model:"moonshot/kimi-k3", model:"nvidia/gpt-oss-120b" (free).

Run blockrun_models to see all available models with pricing.`,
annotations: TOOL_ANNOTATIONS.generative,
inputSchema: {
message: z.string().describe("Your message to the AI"),
model: z.string().optional().describe("Specific model ID (e.g., 'moonshot/kimi-k3', 'openai/gpt-5.6-sol', 'zai/glm-5')"),
model: z.string().optional().describe("Specific model ID (e.g., 'openai/gpt-6-sol', 'anthropic/claude-sonnet-5.5', 'zai/glm-5')"),
mode: z.enum(["fast", "balanced", "powerful", "cheap", "reasoning", "free", "coding", "glm"]).optional().describe("Routing mode: powerful/reasoning = frontier models (Opus 5, GPT-5.6-sol, Kimi K3), coding = code-specialized, glm = Zhipu GLM (great for coding), cheap = budget models, free = $0 models (ignored if model specified)"),
system: z.string().optional().describe("Optional system prompt"),
max_tokens: z.number().optional().default(1024).describe("Max tokens in response"),
Expand Down
31 changes: 23 additions & 8 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,15 @@ export const BASE_RPC_URLS = [
// presence in the catalogue is NECESSARY BUT NOT SUFFICIENT for health;
// absence from it is NOT SUFFICIENT for death — probe before deleting.
//
// OpenAI (28): gpt-6-astra ($10/$50, 1M — the GPT-6 flagship; listed by
// OpenAI (31): gpt-6-astra ($10/$50, 1M — the GPT-6 flagship; listed by
// 2026-09-08 ABOVE the $5/$30 default, so it carries a CHAT_PRICE_PER_MTOKEN
// row), gpt-5.6-sol ($5/$30, 1M, deepest reasoning), gpt-5.6-terra
// row), gpt-6-sol ($2/$10, 1M — the cost-efficient GPT-6 tier), gpt-6-luna
// ($0.1/$0.5, 1M — fast, low-cost GPT-6); all three GPT-6 bill input 2x and
// output 1.5x past 272K input; gpt-5.1 ($1.25/$10, 400K). gpt-5.6-sol ($4/$20, 1M, deepest
// reasoning; CUT from $5/$30 on 2026-08-21), gpt-5.6-terra
// ($2/$12, 1M — the balanced default; CUT from $2.5/$15), gpt-5.6-luna
// ($0.2/$1.2, 1M, no reasoning; CUT from $1/$6), plus the 2026-08 "pro
// reasoning mode" trio: gpt-5.6-sol-pro ($5/$30), gpt-5.6-terra-pro ($1/$6 —
// reasoning mode" trio: gpt-5.6-sol-pro ($4/$20), gpt-5.6-terra-pro ($1/$6 —
// deliberately HALF the standard Terra rate, per the gateway registry, not a
// pricing bug), gpt-5.6-luna-pro ($0.1/$0.6). gpt-5.5 ($5/$30), gpt-5.5-pro
// ($30/$180 — ties gpt-5.4-pro for priciest model served), chat-latest
Expand All @@ -52,9 +55,11 @@ export const BASE_RPC_URLS = [
// gpt-5.3-codex ($1.75/$14), gpt-5.2-pro ($21/$168), gpt-5.4-mini,
// gpt-5-mini, gpt-5.4-nano, gpt-4.1{,-mini,-nano}, gpt-4o{,-mini},
// o1 ($15/$60), o3 ($2/$8), o3-mini, o4-mini
// Anthropic (10): claude-fable-5.1 ($10/$50, 1M — listed by 2026-09-08 ABOVE
// the default, so it carries a price row), claude-opus-5 ($5/$25, 1M, 128k out — newest Opus,
// step-change over 4.8 at the same price; live-probed 2026-08-12),
// Anthropic (12): claude-fable-5.1 ($10/$50, 1M — listed by 2026-09-08 ABOVE
// the default, so it carries a price row), claude-opus-5.5 ($4/$20, 1M, 128k
// out — newest Opus, cheaper than Opus 5, thinking always on),
// claude-sonnet-5.5 ($2/$10, 1M, 128k out — newest Sonnet), claude-opus-5
// ($5/$25, 1M, 128k out; live-probed 2026-08-12),
// claude-opus-4.8 ($5/$25, 1M), claude-fable-5 ($10/$50, 1M),
// claude-opus-4.7 ($5/$25, 1M), claude-sonnet-5 ($2/$10, 1M — CUT from
// $3/$15; both gateways 2026-09-08. On the native path the price row IS the
Expand All @@ -74,7 +79,9 @@ export const BASE_RPC_URLS = [
// ZAI (4): glm-5.2 ($1.4/$4.4, 1M), glm-5.1 ($1.4/$4.4), glm-5 ($1/$3.2 —
// Z.AI RAISED the list rate; still the cheapest ZAI, but no longer a
// cheap-tier pick), glm-5-turbo ($1.2/$4)
// xAI (3): grok-4.5 ($2/$6, 500K, native search), grok-4.3 ($1.25/$2.5, 1M),
// xAI (5): grok-4.7 ($2/$6, 500K, vision, always-on reasoning), grok-4.6
// ($2/$6, 500K), grok-4.5 ($2/$6, 500K) — all three 2x at >=200K input and
// native Live Search; grok-4.3 ($1.25/$2.5, 1M),
// grok-build-0.1 ($1/$2, coding)
// MiniMax (2): minimax-m3 ($0.3/$1.2, 1M), minimax-m2.7 ($0.3/$1.2, 200K)
// Qwen (3): qwen3.7-max ($1.475/$4.425, 1M), qwen3.7-plus ($0.32/$1.28, 1M),
Expand Down Expand Up @@ -310,6 +317,7 @@ export const CHAT_PRICE_PER_MTOKEN: Record<string, { input: number; output: numb
// rate instead of the $5/$30 worst case, which would price a qwen3.7-flash
// call like a frontier one and lock small budgets out of the cheap path.
"anthropic/claude-opus-5": { input: 5, output: 25 },
"anthropic/claude-opus-5.5": { input: 4, output: 20 },
"anthropic/claude-opus-4.8": { input: 5, output: 25 },
"anthropic/claude-opus-4.7": { input: 5, output: 25 },
"anthropic/claude-opus-4.5": { input: 5, output: 25 },
Expand All @@ -319,26 +327,33 @@ export const CHAT_PRICE_PER_MTOKEN: Record<string, { input: number; output: numb
// over-books budget.spent (1.5x here) and trips caps early. The catalogue
// sweep fails on an anthropic/* row above the Base rate for this reason.
"anthropic/claude-sonnet-5": { input: 2, output: 10 },
"anthropic/claude-sonnet-5.5": { input: 2, output: 10 },
// The rest of the Anthropic family: in no tier, but every one of them is
// reachable as an explicit `model` — and that path goes to the NATIVE
// /v1/messages endpoint, where this table is also what reconstructs the ledger
// entry (see anthropicCallCost). A missing id there books nothing at all.
"anthropic/claude-sonnet-4.6": { input: 3, output: 15 },
"anthropic/claude-sonnet-4.5": { input: 3, output: 15 },
"anthropic/claude-haiku-4.5": { input: 1, output: 5 },
"openai/gpt-5.6-sol": { input: 5, output: 30 },
// CUT from $5/$30 on 2026-08-21 (both gateways and the account sheet).
"openai/gpt-5.6-sol": { input: 4, output: 20 },
"openai/gpt-5.5": { input: 5, output: 30 },
"openai/gpt-5.6-terra": { input: 2, output: 12 },
"openai/gpt-6-sol": { input: 2, output: 10 },
"openai/gpt-5.1": { input: 1.25, output: 10 },
"openai/gpt-5.3-codex": { input: 1.75, output: 14 },
"openai/gpt-5-mini": { input: 0.25, output: 2 },
"openai/gpt-5.6-luna": { input: 0.2, output: 1.2 },
"openai/gpt-6-luna": { input: 0.1, output: 0.5 },
"openai/gpt-5.4-nano": { input: 0.2, output: 1.25 },
"google/gemini-3.1-pro": { input: 2, output: 12 },
"google/gemini-3.5-flash": { input: 1.5, output: 9 },
"google/gemini-3-flash-preview": { input: 0.5, output: 3 },
"google/gemini-2.5-flash": { input: 0.3, output: 2.5 },
"google/gemini-3.5-flash-lite": { input: 0.3, output: 2.5 },
"moonshot/kimi-k3": { input: 3, output: 15 },
"xai/grok-4.7": { input: 2, output: 6 },
"xai/grok-4.6": { input: 2, output: 6 },
"xai/grok-4.5": { input: 2, output: 6 },
"xai/grok-4.3": { input: 1.25, output: 2.5 },
"xai/grok-build-0.1": { input: 1, output: 2 },
Expand Down
22 changes: 18 additions & 4 deletions test/chat.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,27 @@ const LIVE_CHARGE_100K: Array<[string | undefined, string | undefined, number]>
[undefined, "openai/gpt-5.2-pro", 1.026640],
[undefined, "openai/o1", 0.727420],
[undefined, "anthropic/claude-fable-5", 0.486310],
[undefined, "openai/gpt-5.6-sol", 0.244171],
[undefined, "openai/gpt-5.6-sol", 0.195125], // cut to $4/$20 2026-08-21; re-probed 2026-10-02
[undefined, "anthropic/claude-opus-5", 0.243655],
[undefined, "openai/gpt-5.6-terra", 0.098269],
[undefined, "google/gemini-3.5-flash", 0.073951],
[undefined, "zai/glm-5", 0.049346],
[undefined, "deepseek/deepseek-v4-pro", 0.064790],
// Added 2026-10-02 (live 402, same prompt).
[undefined, "openai/gpt-6-astra", 0.486310],
[undefined, "openai/gpt-6-sol", 0.098063],
[undefined, "openai/gpt-6-luna", 0.005854],
[undefined, "openai/gpt-5.1", 0.062051],
[undefined, "anthropic/claude-fable-5.1", 0.486310],
[undefined, "anthropic/claude-opus-5.5", 0.195125],
[undefined, "anthropic/claude-sonnet-5.5", 0.098063],
[undefined, "xai/grok-4.6", 0.097650],
[undefined, "xai/grok-4.7", 0.097650],
// Tier routing: the charge is that of the member the loop settles on, so each
// tier is pinned against its most expensive member's live quote.
["powerful", undefined, 1.460020], // gpt-5.4-pro
["balanced", undefined, 0.244171], // gpt-5.5
["reasoning", undefined, 0.243655], // gpt-5.6-sol / opus-5
["reasoning", undefined, 0.243655], // opus-5
["coding", undefined, 0.243655], // claude-opus-5
["fast", undefined, 0.073951], // gemini-3.5-flash
["glm", undefined, 0.049346], // glm-5.x
Expand Down Expand Up @@ -98,7 +108,9 @@ test("estimateChatCost prices an unknown model at the catalog ceiling, not a gue
// (seven as of 2026-09-08 — `npm run verify:prices` sweeps the live catalogue
// and fails the moment an eighth appears without a row).
const unknown = estimateChatCost(1024, undefined, "someone/brand-new-model", undefined, 100_000);
assert.equal(unknown, estimateChatCost(1024, undefined, "openai/gpt-5.6-sol", undefined, 100_000));
// gpt-5.5 sits exactly at the $5/$30 ceiling (gpt-5.6-sol did until its
// 2026-08-21 cut to $4/$20).
assert.equal(unknown, estimateChatCost(1024, undefined, "openai/gpt-5.5", undefined, 100_000));
assert.ok(unknown >= 0.244171);
});

Expand Down Expand Up @@ -434,6 +446,8 @@ test("anthropicCallCost normalises the gateway's echo to the catalogue key and n
["claude-sonnet-4.6-20260301", "anthropic/claude-sonnet-4.6"],
["claude-opus-5-20260101", "anthropic/claude-opus-5"],
["anthropic/claude-opus-5", "anthropic/claude-opus-5"],
["claude-opus-5-5", "anthropic/claude-opus-5.5"],
["claude-sonnet-5-5-20261001", "anthropic/claude-sonnet-5.5"],
];
for (const [echo, key] of ECHOES) {
const booked = anthropicCallCost(echo, 100_000, 1024);
Expand All @@ -445,7 +459,7 @@ test("anthropicCallCost normalises the gateway's echo to the catalogue key and n
// A sibling with NO row returns null — the estimate fallback — rather than
// borrowing its major version's rate. This is the mechanism that would have
// let claude-fable-5.1 book fable-5's row before it had one of its own.
for (const unlisted of ["claude-sonnet-5-1", "claude-sonnet-5.1", "claude-fable-5-2", "claude-opus-5-5-20270101", "claude-opus-5x", "claude-does-not-exist"]) {
for (const unlisted of ["claude-sonnet-5-1", "claude-sonnet-5.1", "claude-fable-5-2", "claude-opus-5-6-20270101", "claude-opus-5x", "claude-does-not-exist"]) {
assert.equal(anthropicCallCost(unlisted, 100_000, 1024), null, `${unlisted} has no row and must not borrow one`);
}
});
Expand Down
Loading