@blockrun/franklin 3.30.0 → 3.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -456,7 +456,7 @@ function formatCompactSummary(raw) {
456
456
  function pickCompactionModel(primaryModel) {
457
457
  // Free parent → free compaction (no silent charge)
458
458
  if (primaryModel.startsWith('nvidia/') || primaryModel === 'blockrun/free') {
459
- return 'nvidia/llama-4-maverick';
459
+ return 'nvidia/qwen3-next-80b-a3b-instruct';
460
460
  }
461
461
  // Use cheapest capable model for summarization to save cost
462
462
  // Tier down: opus/pro → sonnet, sonnet → haiku, everything else → flash (cheapest capable)
@@ -249,7 +249,7 @@ export function parseGroundingResponse(raw) {
249
249
  * choice so both quality gates have the same cost profile. Override via
250
250
  * `FRANKLIN_EVALUATOR_MODEL` to experiment with accuracy/cost trade-offs. */
251
251
  export function evaluatorModel() {
252
- return process.env.FRANKLIN_EVALUATOR_MODEL || 'nvidia/llama-4-maverick';
252
+ return process.env.FRANKLIN_EVALUATOR_MODEL || 'nvidia/qwen3-next-80b-a3b-instruct';
253
253
  }
254
254
  // ─── Run grounding check ─────────────────────────────────────────────────
255
255
  const MAX_EVAL_TOKENS = 512;
package/dist/agent/llm.js CHANGED
@@ -237,12 +237,16 @@ export function extractApiErrorMessage(errorBody) {
237
237
  */
238
238
  export function modelHasExtendedThinking(model) {
239
239
  const m = model.toLowerCase();
240
- // Excluded: Opus 4.7+ uses adaptive thinking; sending `thinking: enabled`
241
- // causes the API to 400.
240
+ // Excluded: Opus 4.7+, Sonnet 5, and Fable 5 use adaptive / always-on
241
+ // thinking; sending an explicit `thinking: enabled` causes the API to 400.
242
242
  if (m.includes('opus-4.8') || m.includes('opus-4-8'))
243
243
  return false;
244
244
  if (m.includes('opus-4.7') || m.includes('opus-4-7'))
245
245
  return false;
246
+ if (m.includes('fable-5') || m.includes('fable5'))
247
+ return false;
248
+ if (m.includes('sonnet-5') || m.includes('sonnet5'))
249
+ return false;
246
250
  return (m.includes('opus-4.6') || m.includes('opus-4-6') ||
247
251
  m.includes('opus-4.5') || m.includes('opus-4-5') ||
248
252
  m.includes('opus-4.1') || m.includes('opus-4-1') ||
@@ -422,10 +426,10 @@ export class ModelClient {
422
426
  // strings (now retired routing profiles) end up at the same place
423
427
  // without needing dedicated entries.
424
428
  const FALLBACKS = {
425
- 'blockrun/auto': 'nvidia/llama-4-maverick',
426
- 'blockrun/free': 'nvidia/llama-4-maverick',
429
+ 'blockrun/auto': 'nvidia/qwen3-next-80b-a3b-instruct',
430
+ 'blockrun/free': 'nvidia/qwen3-next-80b-a3b-instruct',
427
431
  };
428
- return FALLBACKS[model] || 'nvidia/llama-4-maverick';
432
+ return FALLBACKS[model] || 'nvidia/qwen3-next-80b-a3b-instruct';
429
433
  }
430
434
  /**
431
435
  * USDC actually charged for the most recent stream. 0 if no payment
@@ -1398,7 +1398,10 @@ export async function interactiveSession(config, getUserInput, onEvent, onAbortR
1398
1398
  const hasTools = responseParts.some(p => p.type === 'tool_use');
1399
1399
  const hasThinking = responseParts.some(p => p.type === 'thinking');
1400
1400
  if (!hasText && !hasTools && !hasThinking) {
1401
- const EMPTY_FALLBACK_MODELS = ['nvidia/llama-4-maverick', 'nvidia/deepseek-v4-flash', 'zai/glm-5.2'];
1401
+ // Free-only recovery chain — a free/empty-response session must NEVER
1402
+ // fall back to a paid model (would silently charge the wallet). Both
1403
+ // entries are $0 nvidia models.
1404
+ const EMPTY_FALLBACK_MODELS = ['nvidia/qwen3-next-80b-a3b-instruct', 'nvidia/llama-4-maverick'];
1402
1405
  const nextModel = EMPTY_FALLBACK_MODELS.find(m => m !== config.model && !turnFailedModels.has(m));
1403
1406
  if (nextModel && recoveryAttempts < 2) {
1404
1407
  recoveryAttempts++;
@@ -25,16 +25,26 @@ const MODEL_MAX_OUTPUT = {
25
25
  // (anthropic/claude-opus-4.8 maxOutput: 128000). Bumping from 32k to
26
26
  // 128k unlocks the full headroom — runaway generations are gated
27
27
  // separately by CAPPED_MAX_TOKENS / ESCALATED_MAX_TOKENS budgets.
28
+ 'anthropic/claude-fable-5': 128_000,
28
29
  'anthropic/claude-opus-4.8': 128_000,
29
30
  'anthropic/claude-opus-4.7': 128_000,
30
31
  'anthropic/claude-opus-4.6': 32_000,
32
+ 'anthropic/claude-opus-4.5': 32_000,
33
+ 'anthropic/claude-sonnet-5': 128_000,
31
34
  'anthropic/claude-sonnet-4.6': 64_000,
35
+ 'anthropic/claude-sonnet-4.5': 64_000,
32
36
  'anthropic/claude-haiku-4.5-20251001': 16_384,
37
+ 'openai/gpt-5.6-sol': 128_000,
38
+ 'openai/gpt-5.6-terra': 128_000,
39
+ 'openai/gpt-5.6-luna': 128_000,
33
40
  'openai/gpt-5.5': 32_768,
34
41
  'openai/gpt-5.4': 32_768,
42
+ 'openai/gpt-5.4-mini': 128_000,
43
+ 'openai/gpt-5.4-nano': 32_768,
35
44
  'openai/gpt-5-mini': 16_384,
36
45
  'google/gemini-2.5-pro': 65_536,
37
46
  'google/gemini-2.5-flash': 65_536,
47
+ 'google/gemini-3.5-flash': 65_536,
38
48
  // DeepSeek V4 family — upstream max_output is 65K on V4 Flash + V4 Pro;
39
49
  // gateway re-aliased deepseek-chat/-reasoner to V4 Flash modes 2026-05-03.
40
50
  'deepseek/deepseek-chat': 65_536,
@@ -195,10 +195,16 @@ const MODEL_CONTEXT_WINDOWS = {
195
195
  // edge yet — sending more than 200k without it 413s. Keep 200k as the
196
196
  // safe Franklin baseline; bump to 1_000_000 in a separate commit once
197
197
  // a real >200k call has been verified end-to-end.
198
+ // Fable 5 / Sonnet 5 advertise 1M at the gateway; keep the 200k safe baseline
199
+ // (same rationale as Opus above) until a real >200k call is verified.
200
+ 'anthropic/claude-fable-5': 200_000,
198
201
  'anthropic/claude-opus-4.8': 200_000,
199
202
  'anthropic/claude-opus-4.7': 200_000,
200
203
  'anthropic/claude-opus-4.6': 200_000,
204
+ 'anthropic/claude-opus-4.5': 200_000,
205
+ 'anthropic/claude-sonnet-5': 200_000,
201
206
  'anthropic/claude-sonnet-4.6': 200_000,
207
+ 'anthropic/claude-sonnet-4.5': 200_000,
202
208
  'anthropic/claude-sonnet-4': 200_000,
203
209
  'anthropic/claude-haiku-4.5': 200_000,
204
210
  'anthropic/claude-haiku-4.5-20251001': 200_000,
@@ -206,9 +212,14 @@ const MODEL_CONTEXT_WINDOWS = {
206
212
  // gpt-5.5 advertises 1.05M context at the gateway, but Franklin keeps the
207
213
  // conservative 128k baseline matching every other gpt-5.x line — bump in
208
214
  // a separate change once a real >128k call has been verified end-to-end.
215
+ 'openai/gpt-5.6-sol': 128_000,
216
+ 'openai/gpt-5.6-terra': 128_000,
217
+ 'openai/gpt-5.6-luna': 128_000,
209
218
  'openai/gpt-5.5': 128_000,
210
219
  'openai/gpt-5.4': 128_000,
211
220
  'openai/gpt-5.4-pro': 128_000,
221
+ 'openai/gpt-5.4-mini': 128_000,
222
+ 'openai/gpt-5.4-nano': 128_000,
212
223
  'openai/gpt-5.3': 128_000,
213
224
  'openai/gpt-5.3-codex': 128_000,
214
225
  'openai/gpt-5.2': 128_000,
@@ -222,6 +233,8 @@ const MODEL_CONTEXT_WINDOWS = {
222
233
  'google/gemini-2.5-flash': 1_000_000,
223
234
  'google/gemini-2.5-flash-lite': 1_000_000,
224
235
  'google/gemini-3.1-pro': 1_000_000,
236
+ 'google/gemini-3.5-flash': 1_000_000,
237
+ 'google/gemini-3.1-flash-lite': 1_000_000,
225
238
  // DeepSeek (V4 family — gateway aliased deepseek-chat / -reasoner to V4
226
239
  // Flash on 2026-05-03; context bumped 128K → 1M for both, 65K out)
227
240
  'deepseek/deepseek-chat': 1_000_000,
@@ -239,9 +252,17 @@ const MODEL_CONTEXT_WINDOWS = {
239
252
  'moonshot/kimi-k2.5': 128_000,
240
253
  'minimax/minimax-m3': 1_000_000,
241
254
  'minimax/minimax-m2.7': 128_000,
242
- // NVIDIA-hosted free tier (2026-04-29 V4 Flash + Omni launch)
243
- 'nvidia/deepseek-v4-flash': 1_000_000,
255
+ // NVIDIA-hosted free tier (refreshed 2026-07-11 to match live /v1/models).
256
+ 'nvidia/qwen3-next-80b-a3b-instruct': 262_144, // current free default
257
+ 'nvidia/qwen3.5-122b-a10b': 131_072,
244
258
  'nvidia/nemotron-3-nano-omni-30b-a3b-reasoning': 256_000,
259
+ 'nvidia/mistral-nemotron': 131_072,
260
+ 'nvidia/step-3.7-flash': 131_072,
261
+ 'nvidia/seed-oss-36b': 131_072,
262
+ 'nvidia/nemotron-nano-9b-v2': 131_072,
263
+ 'nvidia/nemotron-nano-12b-v2-vl': 131_072,
264
+ 'nvidia/llama-4-maverick': 131_072,
265
+ 'nvidia/mistral-large-3-675b': 131_072,
245
266
  };
246
267
  /**
247
268
  * Get the context window size for a model, with a conservative default.
@@ -55,7 +55,7 @@ const CACHE_MAX_SIZE = 64;
55
55
  // emit a single-line JSON. Maverick (the classifier backbone since v3.8.23)
56
56
  // reliably produces plain-text structured output under tight max_tokens,
57
57
  // unlike thinking-first models that leave text empty.
58
- const ANALYZER_MODEL_DEFAULT = process.env.FRANKLIN_ANALYZER_MODEL || 'nvidia/llama-4-maverick';
58
+ const ANALYZER_MODEL_DEFAULT = process.env.FRANKLIN_ANALYZER_MODEL || 'nvidia/qwen3-next-80b-a3b-instruct';
59
59
  const ANALYZER_SYSTEM = `You analyze ONE user message for Franklin's routing + prefetch harness. Output ONE LINE of compact JSON — no explanation, no markdown, no code fences.
60
60
 
61
61
  ## Fields
@@ -113,7 +113,7 @@ export async function runVerification(history, handlers, client, config) {
113
113
  ];
114
114
  config.onEvent?.({ kind: 'text_delta', text: '\n*Verifying...*\n' });
115
115
  // Use agent-tested free model for verification.
116
- const verificationModel = 'nvidia/llama-4-maverick';
116
+ const verificationModel = 'nvidia/qwen3-next-80b-a3b-instruct';
117
117
  try {
118
118
  // Simple single-turn verification call
119
119
  const response = await client.complete({
@@ -41,7 +41,7 @@ export async function slackCommand(opts) {
41
41
  const config = loadConfig();
42
42
  const model = opts.model ||
43
43
  config['default-model'] ||
44
- 'nvidia/llama-4-maverick';
44
+ 'nvidia/qwen3-next-80b-a3b-instruct';
45
45
  const workingDir = process.cwd();
46
46
  const systemInstructions = assembleInstructions(workingDir, model);
47
47
  // Connect MCP servers (Notion, etc.) so the bot exposes their tools — mirrors
@@ -159,7 +159,7 @@ async function runCommand(options) {
159
159
  const chain = loadChain();
160
160
  const apiUrl = API_URLS[chain];
161
161
  const appConfig = loadAppConfig();
162
- const model = options.model || appConfig['default-model'] || 'nvidia/llama-4-maverick';
162
+ const model = options.model || appConfig['default-model'] || 'nvidia/qwen3-next-80b-a3b-instruct';
163
163
  console.log(chalk.dim(` Model: ${model}`));
164
164
  console.log('');
165
165
  let result;
@@ -44,7 +44,7 @@ export async function telegramCommand(opts) {
44
44
  // Model: --model flag > config default > free default.
45
45
  const model = opts.model ||
46
46
  config['default-model'] ||
47
- 'nvidia/llama-4-maverick';
47
+ 'nvidia/qwen3-next-80b-a3b-instruct';
48
48
  const workingDir = process.cwd();
49
49
  const systemInstructions = assembleInstructions(workingDir, model);
50
50
  // Resume the most recent session tagged for THIS owner so a process
@@ -9,8 +9,8 @@ import { loadLearnings, mergeLearning, saveLearnings, loadSkills, saveSkill } fr
9
9
  // Free models for learning extraction — JSON extraction is simple enough.
10
10
  // Ordered by reliability: try the best free model first, fall back to others.
11
11
  const EXTRACTION_MODELS = [
12
- 'nvidia/llama-4-maverick', // Agent-tested free model; reliable for JSON tasks
13
- 'nvidia/deepseek-v4-flash', // 1M-ctx fallback (qwen3-coder-480b EOL 2026-06-11)
12
+ 'nvidia/qwen3-next-80b-a3b-instruct', // Clean JSON output, no thinking leak (verified live)
13
+ 'nvidia/llama-4-maverick', // Diverse-family free fallback
14
14
  ];
15
15
  const VALID_CATEGORIES = new Set([
16
16
  'language', 'model_preference', 'tool_pattern', 'coding_style',
@@ -5,7 +5,7 @@
5
5
  * Plugins implement Workflow; core orchestrates execution and provides infrastructure.
6
6
  */
7
7
  export const DEFAULT_MODEL_TIERS = {
8
- free: 'nvidia/llama-4-maverick',
9
- cheap: 'nvidia/llama-4-maverick', // Free by default; opt-in to paid flat-rate via 'zai/glm-5.1'.
10
- premium: 'anthropic/claude-sonnet-4.6',
8
+ free: 'nvidia/qwen3-next-80b-a3b-instruct',
9
+ cheap: 'nvidia/qwen3-next-80b-a3b-instruct', // Free by default; opt-in to paid flat-rate via 'zai/glm-5.1'.
10
+ premium: 'anthropic/claude-sonnet-5',
11
11
  };
package/dist/pricing.js CHANGED
@@ -8,36 +8,53 @@ export const MODEL_PRICING = {
8
8
  // their parser mapping promotes them to Auto upstream of cost estimation.
9
9
  'blockrun/auto': { input: 0.8, output: 4.0 },
10
10
  'blockrun/free': { input: 0, output: 0 },
11
- // FREE — BlockRun gateway free tier (refreshed 2026-04-29 with V4 Flash + Omni launch)
12
- 'nvidia/deepseek-v4-flash': { input: 0, output: 0 },
11
+ // FREE — BlockRun gateway free tier (refreshed 2026-07-11 to match live /v1/models).
12
+ // qwen3-next-80b-a3b-instruct is the current free default (cleanest instruction-
13
+ // following — verified live: no thinking leak, no markdown fences, reliable).
14
+ 'nvidia/qwen3-next-80b-a3b-instruct': { input: 0, output: 0 },
15
+ 'nvidia/qwen3.5-122b-a10b': { input: 0, output: 0 },
13
16
  'nvidia/nemotron-3-nano-omni-30b-a3b-reasoning': { input: 0, output: 0 },
17
+ 'nvidia/mistral-nemotron': { input: 0, output: 0 },
18
+ 'nvidia/step-3.7-flash': { input: 0, output: 0 },
19
+ 'nvidia/seed-oss-36b': { input: 0, output: 0 },
20
+ 'nvidia/nemotron-nano-9b-v2': { input: 0, output: 0 },
21
+ 'nvidia/nemotron-nano-12b-v2-vl': { input: 0, output: 0 },
22
+ 'nvidia/llama-4-maverick': { input: 0, output: 0 },
23
+ 'nvidia/mistral-large-3-675b': { input: 0, output: 0 },
24
+ // Retired free models (kept at 0 for legacy session-cost records; gateway no
25
+ // longer serves these — do NOT route to them).
26
+ 'nvidia/deepseek-v4-flash': { input: 0, output: 0 },
14
27
  'nvidia/glm-4.7': { input: 0, output: 0 },
15
28
  'nvidia/qwen3-next-80b-a3b-thinking': { input: 0, output: 0 },
16
29
  'nvidia/qwen3-coder-480b': { input: 0, output: 0 },
17
30
  'nvidia/mistral-small-4-119b': { input: 0, output: 0 },
18
- 'nvidia/llama-4-maverick': { input: 0, output: 0 },
19
31
  'nvidia/deepseek-v3.2': { input: 0, output: 0 },
20
- // Retired (kept at 0 for legacy session-cost records; gateway no longer serves these).
21
32
  'nvidia/gpt-oss-120b': { input: 0, output: 0 },
22
33
  'nvidia/gpt-oss-20b': { input: 0, output: 0 },
23
34
  'nvidia/nemotron-ultra-253b': { input: 0, output: 0 },
24
35
  'nvidia/devstral-2-123b': { input: 0, output: 0 },
25
36
  'nvidia/nemotron-3-super-120b': { input: 0, output: 0 },
26
37
  'nvidia/nemotron-super-49b': { input: 0, output: 0 },
27
- 'nvidia/mistral-large-3-675b': { input: 0, output: 0 },
28
38
  // Anthropic
29
- 'anthropic/claude-sonnet-4.6': { input: 3.0, output: 15.0 },
39
+ 'anthropic/claude-fable-5': { input: 10.0, output: 50.0 }, // Mythos-class tier above Opus, 1M ctx
30
40
  'anthropic/claude-opus-4.8': { input: 5.0, output: 25.0 },
31
41
  'anthropic/claude-opus-4.7': { input: 5.0, output: 25.0 },
32
42
  'anthropic/claude-opus-4.6': { input: 5.0, output: 25.0 },
43
+ 'anthropic/claude-opus-4.5': { input: 5.0, output: 25.0 },
44
+ 'anthropic/claude-sonnet-5': { input: 3.0, output: 15.0 }, // near-Opus at Sonnet cost, 1M ctx
45
+ 'anthropic/claude-sonnet-4.6': { input: 3.0, output: 15.0 },
46
+ 'anthropic/claude-sonnet-4.5': { input: 3.0, output: 15.0 },
33
47
  'anthropic/claude-haiku-4.5': { input: 1.0, output: 5.0 },
34
48
  'anthropic/claude-haiku-4.5-20251001': { input: 1.0, output: 5.0 },
35
49
  // OpenAI
36
50
  'openai/gpt-5-nano': { input: 0.05, output: 0.4 },
37
51
  'openai/gpt-4.1-nano': { input: 0.1, output: 0.4 },
38
52
  'openai/gpt-4o-mini': { input: 0.15, output: 0.6 },
53
+ 'openai/gpt-5.4-nano': { input: 0.2, output: 1.25 },
39
54
  'openai/gpt-5-mini': { input: 0.25, output: 2.0 },
40
55
  'openai/gpt-4.1-mini': { input: 0.4, output: 1.6 },
56
+ 'openai/gpt-5.4-mini': { input: 0.75, output: 4.5 },
57
+ 'openai/gpt-5.6-luna': { input: 1.0, output: 6.0 }, // cost-efficient GPT-5.6 tier, 1M ctx
41
58
  'openai/gpt-5.2': { input: 1.75, output: 14.0 },
42
59
  'openai/gpt-5.3': { input: 1.75, output: 14.0 },
43
60
  'openai/gpt-5.3-codex': { input: 1.75, output: 14.0 },
@@ -45,17 +62,21 @@ export const MODEL_PRICING = {
45
62
  'openai/o3': { input: 2.0, output: 8.0 },
46
63
  'openai/gpt-4o': { input: 2.5, output: 10.0 },
47
64
  'openai/gpt-5.4': { input: 2.5, output: 15.0 },
65
+ 'openai/gpt-5.6-terra': { input: 2.5, output: 15.0 }, // balanced GPT-5.6 tier, 1M ctx
48
66
  'openai/o1-mini': { input: 1.1, output: 4.4 },
49
67
  'openai/o3-mini': { input: 1.1, output: 4.4 },
50
68
  'openai/o4-mini': { input: 1.1, output: 4.4 },
51
69
  'openai/o1': { input: 15.0, output: 60.0 },
52
70
  'openai/gpt-5.5': { input: 5.0, output: 30.0 },
71
+ 'openai/gpt-5.6-sol': { input: 5.0, output: 30.0 }, // GPT-5.6 flagship, deepest reasoning, 1M ctx
53
72
  'openai/gpt-5.2-pro': { input: 21.0, output: 168.0 },
54
73
  'openai/gpt-5.4-pro': { input: 30.0, output: 180.0 },
55
74
  // Google
56
75
  'google/gemini-2.5-flash-lite': { input: 0.1, output: 0.4 },
76
+ 'google/gemini-3.1-flash-lite': { input: 0.25, output: 1.5 },
57
77
  'google/gemini-2.5-flash': { input: 0.3, output: 2.5 },
58
78
  'google/gemini-3-flash-preview': { input: 0.5, output: 3.0 },
79
+ 'google/gemini-3.5-flash': { input: 0.5, output: 3.0 }, // latest Flash w/ thinking, 1M ctx
59
80
  'google/gemini-2.5-pro': { input: 1.25, output: 10.0 },
60
81
  'google/gemini-3-pro-preview': { input: 2.0, output: 12.0 },
61
82
  'google/gemini-3.1-pro': { input: 2.0, output: 12.0 },
@@ -7,7 +7,7 @@ export const DEFAULT_FALLBACK_CONFIG = {
7
7
  chain: [
8
8
  'deepseek/deepseek-chat', // Direct fallback — cheap & reliable
9
9
  'google/gemini-2.5-flash', // Fast & capable
10
- 'nvidia/llama-4-maverick', // Free model as ultimate fallback
10
+ 'nvidia/qwen3-next-80b-a3b-instruct', // Free model as ultimate fallback (reliable instruction-follower)
11
11
  ],
12
12
  retryOn: [429, 500, 502, 503, 504, 529],
13
13
  maxRetries: 5,
@@ -1,6 +1,9 @@
1
1
  import http from 'node:http';
2
2
  import { getOrCreateWallet, getOrCreateSolanaWallet, createPaymentPayload, createSolanaPaymentPayload, parsePaymentRequired, extractPaymentDetails, solanaKeyToBytes, SOLANA_NETWORK, } from '@blockrun/llm';
3
3
  import { recordUsage } from '../stats/tracker.js';
4
+ // Single source of truth for shortcuts — shared with the /model picker so the
5
+ // proxy can never drift from the interactive UI (it did before: grok→grok-3).
6
+ import { MODEL_SHORTCUTS } from '../ui/model-picker.js';
4
7
  import { appendSettlementRow } from '../stats/cost-log.js';
5
8
  import { appendAudit } from '../stats/audit.js';
6
9
  import { buildFallbackChain, DEFAULT_FALLBACK_CONFIG, ROUTING_PROFILES, } from './fallback.js';
@@ -87,92 +90,9 @@ function trackOutputTokens(model, tokens) {
87
90
  }
88
91
  lastOutputByModel.set(model, tokens);
89
92
  }
90
- // Model shortcuts for quick switching
91
- const MODEL_SHORTCUTS = {
92
- // Routing profiles — Auto-only since 2026-05-03 (Eco/Premium retired).
93
- // `eco` / `premium` aliases retained for back-compat with proxy clients;
94
- // they parse to Auto downstream.
95
- auto: 'blockrun/auto',
96
- smart: 'blockrun/auto',
97
- eco: 'blockrun/auto',
98
- premium: 'blockrun/auto',
99
- // Anthropic
100
- sonnet: 'anthropic/claude-sonnet-4.6',
101
- claude: 'anthropic/claude-sonnet-4.6',
102
- 'sonnet-4.6': 'anthropic/claude-sonnet-4.6',
103
- opus: 'anthropic/claude-opus-4.8',
104
- 'opus-4.8': 'anthropic/claude-opus-4.8',
105
- 'opus-4.7': 'anthropic/claude-opus-4.7',
106
- 'opus-4.6': 'anthropic/claude-opus-4.6',
107
- haiku: 'anthropic/claude-haiku-4.5-20251001',
108
- 'haiku-4.5': 'anthropic/claude-haiku-4.5-20251001',
109
- // OpenAI
110
- // `gpt` / `gpt5` / `gpt-5` follow the gateway's flagship — currently 5.5.
111
- gpt: 'openai/gpt-5.5',
112
- gpt5: 'openai/gpt-5.5',
113
- 'gpt-5': 'openai/gpt-5.5',
114
- 'gpt-5.5': 'openai/gpt-5.5',
115
- 'gpt-5.4': 'openai/gpt-5.4',
116
- 'gpt-5.4-pro': 'openai/gpt-5.4-pro',
117
- 'gpt-5.3': 'openai/gpt-5.3',
118
- 'gpt-5.2': 'openai/gpt-5.2',
119
- 'gpt-5.2-pro': 'openai/gpt-5.2-pro',
120
- 'gpt-4.1': 'openai/gpt-4.1',
121
- codex: 'openai/gpt-5.3-codex',
122
- nano: 'openai/gpt-5-nano',
123
- mini: 'openai/gpt-5-mini',
124
- o3: 'openai/o3',
125
- o4: 'openai/o4-mini',
126
- 'o4-mini': 'openai/o4-mini',
127
- o1: 'openai/o1',
128
- // Google
129
- gemini: 'google/gemini-2.5-pro',
130
- 'gemini-2.5': 'google/gemini-2.5-pro',
131
- flash: 'google/gemini-2.5-flash',
132
- 'gemini-3': 'google/gemini-3.1-pro',
133
- 'gemini-3.1': 'google/gemini-3.1-pro',
134
- // xAI
135
- grok: 'xai/grok-3',
136
- 'grok-3': 'xai/grok-3',
137
- 'grok-4': 'xai/grok-4-0709',
138
- 'grok-fast': 'xai/grok-4-1-fast-reasoning',
139
- 'grok-4.1': 'xai/grok-4-1-fast-reasoning',
140
- // DeepSeek
141
- deepseek: 'deepseek/deepseek-chat',
142
- r1: 'deepseek/deepseek-reasoner',
143
- // Free models (agent-tested gateway free tier — refreshed 2026-04)
144
- free: 'nvidia/llama-4-maverick',
145
- glm4: 'nvidia/llama-4-maverick',
146
- 'deepseek-free': 'nvidia/llama-4-maverick',
147
- 'qwen-coder': 'nvidia/llama-4-maverick',
148
- 'qwen-think': 'nvidia/llama-4-maverick',
149
- maverick: 'nvidia/llama-4-maverick',
150
- 'gpt-oss': 'nvidia/llama-4-maverick',
151
- 'gpt-oss-small': 'nvidia/llama-4-maverick',
152
- 'mistral-small': 'nvidia/llama-4-maverick',
153
- // Retired/unreliable gateway-model aliases (map to closest agent-tested current).
154
- nemotron: 'nvidia/llama-4-maverick',
155
- devstral: 'nvidia/llama-4-maverick',
156
- // Minimax
157
- minimax: 'minimax/minimax-m3',
158
- 'm3': 'minimax/minimax-m3',
159
- 'm2.7': 'minimax/minimax-m2.7',
160
- // Others
161
- glm: 'zai/glm-5.2',
162
- 'glm-5.2': 'zai/glm-5.2',
163
- // glm-5.1 demoted to back-compat pin 2026-06 (flagship is 5.2) — still routes.
164
- 'glm-5.1': 'zai/glm-5.1',
165
- 'glm-turbo': 'zai/glm-5-turbo',
166
- 'glm5': 'zai/glm-5.2',
167
- kimi: 'moonshot/kimi-k2.7',
168
- 'k2.7': 'moonshot/kimi-k2.7',
169
- // K2.6 demoted 2026-06 (flagship is K2.7) but still routes — `k2.6` pins it.
170
- 'k2.6': 'moonshot/kimi-k2.6',
171
- // K2.5 retired — aliases resolve to the current flagship for muscle memory.
172
- 'kimi-k2.5': 'moonshot/kimi-k2.7',
173
- 'k2.5': 'moonshot/kimi-k2.7',
174
- };
175
- // Model pricing now uses shared source from src/pricing.ts
93
+ // Model shortcuts for quick switching — imported from ui/model-picker.ts (the
94
+ // single source of truth) so the proxy and the interactive /model picker can
95
+ // never drift apart. Model pricing likewise comes from src/pricing.ts.
176
96
  function detectModelSwitch(parsed) {
177
97
  if (!parsed.messages || parsed.messages.length === 0)
178
98
  return null;
@@ -319,7 +319,7 @@ function classicRouteRequest(prompt, profile, needsVision = false) {
319
319
  // llama-4-maverick: clean one-word classification output. glm-4.7 + qwen-
320
320
  // thinking emit reasoning into thinking blocks and leave text empty under
321
321
  // tight max_tokens — fine for chat, wrong shape for single-word dispatch.
322
- const CLASSIFIER_MODEL = process.env.FRANKLIN_ROUTER_MODEL || 'nvidia/llama-4-maverick';
322
+ const CLASSIFIER_MODEL = process.env.FRANKLIN_ROUTER_MODEL || 'nvidia/qwen3-next-80b-a3b-instruct';
323
323
  const CLASSIFIER_TIMEOUT_MS = 2_500;
324
324
  const CLASSIFIER_SYSTEM = `You classify a user's message into ONE routing tier for a CLI agent. Reply with EXACTLY ONE WORD from the allowed set. No explanation, no punctuation, no quotes.
325
325
 
@@ -447,7 +447,7 @@ export function resolveTierToModel(tier, profile = 'auto', needsVision = false)
447
447
  // line; revisit hard-falling to it if a real user hits this path.)
448
448
  if (profile === 'free') {
449
449
  return {
450
- model: 'nvidia/llama-4-maverick',
450
+ model: 'nvidia/qwen3-next-80b-a3b-instruct',
451
451
  tier: 'SIMPLE',
452
452
  confidence: 1.0,
453
453
  signals: needsVision ? ['free-profile', 'vision-unsupported'] : ['free-profile'],
@@ -479,7 +479,7 @@ export function routeRequest(prompt, profile = 'auto', needsVision = false) {
479
479
  // Free profile — always use free model
480
480
  if (profile === 'free') {
481
481
  return {
482
- model: 'nvidia/llama-4-maverick',
482
+ model: 'nvidia/qwen3-next-80b-a3b-instruct',
483
483
  tier: 'SIMPLE',
484
484
  confidence: 1.0,
485
485
  signals: needsVision ? ['free-profile', 'vision-unsupported'] : ['free-profile'],
@@ -575,20 +575,21 @@ export function getFallbackChain(tier, profile = 'auto') {
575
575
  // behind maverick rather than leading.
576
576
  // 2026-06-07: nvidia/glm-4.7 dropped from every chain — NVIDIA NIM hung, the
577
577
  // gateway redirected it to a now-dead model, so routing to it just wasted a slot.
578
- // 2026-06-11: nvidia/qwen3-coder-480b removed — its upstream
579
- // (qwen/qwen3-coder-480b-a35b-instruct) reached end-of-life and the gateway now
580
- // 410s on it. maverick + deepseek-v4-flash cover all categories.
578
+ // 2026-07-11: nvidia/deepseek-v4-flash removed — the gateway no longer serves
579
+ // it (410). Free tier is now led by nvidia/qwen3-next-80b-a3b-instruct (cleanest
580
+ // free instruction-follower — no thinking leak / markdown fences, verified live),
581
+ // with nvidia/llama-4-maverick kept as a DIFFERENT-family fallback for resilience.
581
582
  const FREE_MODELS_BY_CATEGORY = {
582
- coding: ['nvidia/llama-4-maverick', 'nvidia/deepseek-v4-flash'],
583
- trading: ['nvidia/llama-4-maverick', 'nvidia/deepseek-v4-flash'],
584
- research: ['nvidia/llama-4-maverick', 'nvidia/deepseek-v4-flash'],
585
- reasoning: ['nvidia/llama-4-maverick', 'nvidia/deepseek-v4-flash'],
586
- chat: ['nvidia/llama-4-maverick', 'nvidia/deepseek-v4-flash'],
587
- creative: ['nvidia/llama-4-maverick', 'nvidia/deepseek-v4-flash'],
583
+ coding: ['nvidia/qwen3-next-80b-a3b-instruct', 'nvidia/llama-4-maverick'],
584
+ trading: ['nvidia/qwen3-next-80b-a3b-instruct', 'nvidia/llama-4-maverick'],
585
+ research: ['nvidia/qwen3-next-80b-a3b-instruct', 'nvidia/llama-4-maverick'],
586
+ reasoning: ['nvidia/qwen3-next-80b-a3b-instruct', 'nvidia/llama-4-maverick'],
587
+ chat: ['nvidia/qwen3-next-80b-a3b-instruct', 'nvidia/llama-4-maverick'],
588
+ creative: ['nvidia/qwen3-next-80b-a3b-instruct', 'nvidia/llama-4-maverick'],
588
589
  };
589
590
  const DEFAULT_FREE_CHAIN = [
591
+ 'nvidia/qwen3-next-80b-a3b-instruct',
590
592
  'nvidia/llama-4-maverick',
591
- 'nvidia/deepseek-v4-flash',
592
593
  ];
593
594
  /**
594
595
  * Pick the next free model to try given the question category and which
@@ -20,22 +20,32 @@
20
20
  */
21
21
  const VISION_MODELS = new Set([
22
22
  // Anthropic — native vision across the line
23
+ 'anthropic/claude-fable-5',
23
24
  'anthropic/claude-opus-4.8',
24
25
  'anthropic/claude-opus-4.7',
25
26
  'anthropic/claude-opus-4.6',
27
+ 'anthropic/claude-opus-4.5',
28
+ 'anthropic/claude-sonnet-5',
26
29
  'anthropic/claude-sonnet-4.6',
30
+ 'anthropic/claude-sonnet-4.5',
27
31
  'anthropic/claude-haiku-4.5-20251001',
28
- // OpenAI — multimodal flagships + o3 (Codex 5.3 is text-only, excluded)
32
+ // OpenAI — multimodal flagships + o3 (Codex 5.3 is text-only, excluded).
33
+ // GPT-5.6 family + 5.4-mini are vision; 5.4-nano is text-only.
34
+ 'openai/gpt-5.6-sol',
35
+ 'openai/gpt-5.6-terra',
36
+ 'openai/gpt-5.6-luna',
29
37
  'openai/gpt-5.5',
30
38
  'openai/gpt-5.4',
31
39
  'openai/gpt-5.4-pro',
40
+ 'openai/gpt-5.4-mini',
32
41
  'openai/gpt-5.2',
33
42
  'openai/gpt-5.2-pro',
34
43
  'openai/gpt-5-mini',
35
44
  'openai/gpt-4.1',
36
45
  'openai/o3',
37
- // Google — vision baked into every Gemini SKU we surface
46
+ // Google — vision baked into every Gemini SKU we surface (flash-lite excepted)
38
47
  'google/gemini-3.1-pro',
48
+ 'google/gemini-3.5-flash',
39
49
  'google/gemini-2.5-pro',
40
50
  'google/gemini-2.5-flash',
41
51
  // xAI — only Grok 4 base supports vision; grok-4-1-fast-reasoning is text-only
@@ -44,8 +54,10 @@ const VISION_MODELS = new Set([
44
54
  // Moonshot — K2.7 (flagship) + K2.6 are multimodal (image + video input)
45
55
  'moonshot/kimi-k2.7',
46
56
  'moonshot/kimi-k2.6',
47
- // NVIDIA inference — Llama 4 Maverick is multimodal; deepseek/qwen-coder are not
57
+ // NVIDIA inference — Llama 4 Maverick + Nemotron Nano VL are multimodal;
58
+ // deepseek/qwen-coder are not.
48
59
  'nvidia/llama-4-maverick',
60
+ 'nvidia/nemotron-nano-12b-v2-vl',
49
61
  ]);
50
62
  /** Does this concrete gateway model accept image input? */
51
63
  export function isVisionModel(modelId) {
@@ -32,7 +32,10 @@ import { readSwaps } from '../stats/swap-log.js';
32
32
  import { isCloudSyncEnabled, cloudList, cloudSync } from './cloud-sync.js';
33
33
  import { setupAgentWallet, setupAgentSolanaWallet } from '@blockrun/llm';
34
34
  import { retryFetchBalance } from '../commands/balance-retry.js';
35
- const FREE_DEFAULT_MODEL = 'nvidia/deepseek-v4-flash';
35
+ // qwen3-next-80b-a3b-instruct: cleanest free instruction-follower (no thinking
36
+ // leak / markdown fences — verified live 2026-07-11). Replaces the EOL'd
37
+ // nvidia/deepseek-v4-flash the gateway no longer serves.
38
+ const FREE_DEFAULT_MODEL = 'nvidia/qwen3-next-80b-a3b-instruct';
36
39
  // Curated Base (chainId 8453) tokens for the wallet "holdings" view. Plain RPC
37
40
  // can't enumerate every token an address holds (no on-chain "list all"), so we
38
41
  // balanceOf a known set and show the non-zero ones. `stable` → USD ≈ amount.
package/dist/tools/moa.js CHANGED
@@ -14,13 +14,13 @@ import { ModelClient } from '../agent/llm.js';
14
14
  // ─── Configuration ────────────────────────────────────────────────────────
15
15
  /** Reference models — diverse, cheap/free models for parallel queries. */
16
16
  const REFERENCE_MODELS = [
17
- 'nvidia/llama-4-maverick', // Free, agent-tested general chat
18
- 'nvidia/deepseek-v4-flash', // Free, 1M ctx (qwen3-coder-480b EOL 2026-06-11)
17
+ 'nvidia/qwen3-next-80b-a3b-instruct', // Free, clean instruction-follower
18
+ 'nvidia/llama-4-maverick', // Free, agent-tested general chat (diverse family)
19
19
  'google/gemini-2.5-flash', // Fast, cheap
20
20
  'deepseek/deepseek-chat', // Cheap, good reasoning
21
21
  ];
22
22
  /** Aggregator model — free by default. Users explicitly pass `aggregator` to upgrade. */
23
- const AGGREGATOR_MODEL = 'nvidia/llama-4-maverick';
23
+ const AGGREGATOR_MODEL = 'nvidia/qwen3-next-80b-a3b-instruct';
24
24
  /** Max tokens per reference response. */
25
25
  const REFERENCE_MAX_TOKENS = 4096;
26
26
  /** Max tokens for aggregator. */
@@ -8,7 +8,7 @@
8
8
  // - per-order notional capped by POLYMARKET_MAX_BET_USD (default $25).
9
9
  // - optional POLYMARKET_MAX_SESSION_USD cumulative cap, tracked in-memory
10
10
  // with per-agent attribution (agent_id).
11
- import { OrderType, Side } from "@polymarket/clob-client-v2";
11
+ import { AssetType, OrderType, Side } from "@polymarket/clob-client-v2";
12
12
  import { checkGeoblock, getClobClient, getPolymarketAccount, resetClobClient } from "./client.js";
13
13
  import { getMaxBetUsd, getMaxSessionUsd } from "./constants.js";
14
14
  import { invalidateL2Creds } from "./creds.js";
@@ -112,6 +112,22 @@ function isCredsMismatchError(err) {
112
112
  return true;
113
113
  return msg.includes("unauthorized") || msg.includes("api key not found") || msg.includes("invalid api key");
114
114
  }
115
+ /**
116
+ * True when a CLOB submit failed because the EXCHANGE thinks the funds wallet
117
+ * lacks balance/allowance. On-chain the deposit wallet may be fully funded and
118
+ * approved (setup verifies both) yet the CLOB's SERVER-SIDE balance cache lags —
119
+ * refreshing that cache (updateBalanceAllowance) and retrying clears it. Matched
120
+ * in the human message OR the response data body. Deliberately narrow: only
121
+ * these phrases, so a genuine unrelated error is never silently retried.
122
+ */
123
+ function isBalanceAllowanceError(err) {
124
+ const e = err;
125
+ const msg = (e?.message ?? "").toLowerCase();
126
+ const dataText = typeof e?.data === "string" ? e.data.toLowerCase()
127
+ : e?.data ? JSON.stringify(e.data).toLowerCase() : "";
128
+ const text = `${msg} ${dataText}`;
129
+ return text.includes("not enough balance") || text.includes("insufficient") || text.includes("allowance");
130
+ }
115
131
  /** Map CLOB errors to actionable guidance. Exported for unit tests. */
116
132
  export async function mapClobError(err) {
117
133
  const e = err;
@@ -298,25 +314,44 @@ export async function executeTrade(input) {
298
314
  };
299
315
  }
300
316
  const options = { tickSize: tickSize, negRisk };
317
+ // The signed submit, factored out so it can be retried after a CLOB
318
+ // balance-cache refresh (below) without rebuilding/re-signing anything else.
319
+ const submitOrder = () => isLimit
320
+ ? clob.createAndPostOrder({
321
+ tokenID: token.tokenId,
322
+ price: price,
323
+ size: size,
324
+ side,
325
+ ...(orderKind === "GTD" && input.expires_at ? { expiration: input.expires_at } : {}),
326
+ }, options, orderKind === "GTD" ? OrderType.GTD : OrderType.GTC, input.post_only ?? false)
327
+ : clob.createAndPostMarketOrder({
328
+ tokenID: token.tokenId,
329
+ amount: input.action === "buy" ? input.amount_usd : size,
330
+ side,
331
+ orderType: orderKind === "FAK" ? OrderType.FAK : OrderType.FOK,
332
+ }, options, orderKind === "FAK" ? OrderType.FAK : OrderType.FOK);
301
333
  // Reserve now (before the await) so a concurrent order sees this spend;
302
334
  // roll back if the submit throws so a failed order doesn't consume budget.
303
335
  reserveBet(notional, input.agent_id);
304
336
  let response;
305
337
  try {
306
- response = isLimit
307
- ? await clob.createAndPostOrder({
308
- tokenID: token.tokenId,
309
- price: price,
310
- size: size,
311
- side,
312
- ...(orderKind === "GTD" && input.expires_at ? { expiration: input.expires_at } : {}),
313
- }, options, orderKind === "GTD" ? OrderType.GTD : OrderType.GTC, input.post_only ?? false)
314
- : await clob.createAndPostMarketOrder({
315
- tokenID: token.tokenId,
316
- amount: input.action === "buy" ? input.amount_usd : size,
317
- side,
318
- orderType: orderKind === "FAK" ? OrderType.FAK : OrderType.FOK,
319
- }, options, orderKind === "FAK" ? OrderType.FAK : OrderType.FOK);
338
+ try {
339
+ response = await submitOrder();
340
+ }
341
+ catch (submitErr) {
342
+ // Funded + approved on-chain, but the CLOB's server-side balance cache
343
+ // can lag reality — setup's warm-up refresh is best-effort and freshly
344
+ // bridged pUSD takes a moment to register — so the exchange rejects a
345
+ // fully-funded wallet with "not enough balance/allowance". Refresh the
346
+ // cache for the traded asset and retry the submit ONCE before giving up
347
+ // (COLLATERAL for buys, the specific outcome token for sells).
348
+ if (!isBalanceAllowanceError(submitErr))
349
+ throw submitErr;
350
+ await clob.updateBalanceAllowance(input.action === "buy"
351
+ ? { asset_type: AssetType.COLLATERAL }
352
+ : { asset_type: AssetType.CONDITIONAL, token_id: token.tokenId });
353
+ response = await submitOrder();
354
+ }
320
355
  }
321
356
  catch (submitErr) {
322
357
  releaseBet(notional, input.agent_id);
@@ -58,15 +58,26 @@ function pusdApprovalTarget() {
58
58
  return bounded === null ? maxUint256 : parseUnits(String(bounded), PUSD_DECIMALS);
59
59
  }
60
60
  /**
61
- * The approval set Polymarket V2 trading needs from the funds-holding wallet:
62
- * pUSD spend for buys (both exchanges), CTF operator for sells (both exchanges)
63
- * plus the NegRisk adapter (negRisk redeem/convert path).
61
+ * The approval set Polymarket V2 trading needs from the funds-holding wallet,
62
+ * mirroring Polymarket's own canonical approveTokensForTrading.ts (proxy/safe
63
+ * wallet): pUSD spend for ALL FOUR collateral spenders — both exchanges, the
64
+ * Conditional Tokens contract (direct split/merge), AND the NegRisk Adapter
65
+ * (negRisk order settlement / convert / redeem pulls collateral through it) —
66
+ * plus the CTF operator for both exchanges and the adapter.
67
+ *
68
+ * The NegRisk Adapter pUSD approval is REQUIRED to trade neg-risk markets (e.g.
69
+ * multi-outcome "winner" markets): without it the CLOB accepts the order but
70
+ * settlement through the adapter reverts. It was previously missing while the
71
+ * adapter's CTF (ERC1155) operator approval was granted — an asymmetry that let
72
+ * setup report "ready" yet neg-risk buys fail.
64
73
  */
65
74
  async function readApprovals(owner) {
66
75
  const pc = getPublicClient();
67
76
  const erc20Spenders = [
68
77
  ["pUSD → CTF Exchange V2", CTF_EXCHANGE_V2],
69
78
  ["pUSD → NegRisk Exchange V2", NEG_RISK_CTF_EXCHANGE_V2],
79
+ ["pUSD → NegRisk Adapter", NEG_RISK_ADAPTER],
80
+ ["pUSD → Conditional Tokens", CONDITIONAL_TOKENS],
70
81
  ];
71
82
  const erc1155Operators = [
72
83
  ["CTF → CTF Exchange V2", CTF_EXCHANGE_V2],
@@ -208,10 +219,21 @@ async function runSetupDepositWallet(opts) {
208
219
  // which is guaranteed above). Non-fatal: report instead of failing setup.
209
220
  let credsReady = false;
210
221
  let credsNote = "";
222
+ let balanceCacheWarned = "";
211
223
  try {
212
224
  const clob = await getClobClient();
213
225
  credsReady = true;
214
- await clob.updateBalanceAllowance({ asset_type: AssetType.COLLATERAL }).catch(() => undefined);
226
+ // Warm the CLOB's server-side balance cache so the first buy sees the funds.
227
+ // Best-effort — but do NOT swallow silently: if it fails, setup used to still
228
+ // print "ready" while the exchange thought the wallet was empty, so the first
229
+ // buy failed with "not enough balance". Surface it instead; the buy path also
230
+ // refreshes on demand now (see orders.ts), so this is a note, not a blocker.
231
+ try {
232
+ await clob.updateBalanceAllowance({ asset_type: AssetType.COLLATERAL });
233
+ }
234
+ catch (refreshErr) {
235
+ balanceCacheWarned = refreshErr instanceof Error ? refreshErr.message.split("\n")[0] : String(refreshErr);
236
+ }
215
237
  }
216
238
  catch (err) {
217
239
  credsNote = ` (${err instanceof Error ? err.message.split("\n")[0] : String(err)})`;
@@ -245,6 +267,9 @@ async function runSetupDepositWallet(opts) {
245
267
  ]
246
268
  : []),
247
269
  `${credsReady ? "✅" : "❌"} CLOB API credentials${credsNote}`,
270
+ ...(balanceCacheWarned
271
+ ? [` ⚠️ Balance cache not pre-warmed (${balanceCacheWarned}) — your first buy refreshes it automatically.`]
272
+ : []),
248
273
  geo,
249
274
  ``,
250
275
  ready ? `🎯 Ready to trade. Discover markets with blockrun_markets, then action:"buy".` : `Re-run action:"setup" after completing the ❌ items.`,
@@ -18,7 +18,7 @@ async function execute(input, ctx) {
18
18
  return { output: 'Error: prompt is required', isError: true };
19
19
  }
20
20
  // Resolve which model the sub-agent will actually run on
21
- const subModel = model || registeredParentModel || 'nvidia/llama-4-maverick';
21
+ const subModel = model || registeredParentModel || 'nvidia/qwen3-next-80b-a3b-instruct';
22
22
  // Cost gate: if parent is free but sub-agent wants paid, ask user first.
23
23
  // Prevents silent charges when the agent decides to spawn a more capable sub-agent.
24
24
  if (isFreeModel(registeredParentModel) && !isFreeModel(subModel)) {
@@ -15,24 +15,36 @@ export const MODEL_SHORTCUTS = {
15
15
  smart: 'blockrun/auto',
16
16
  eco: 'blockrun/auto',
17
17
  premium: 'blockrun/auto',
18
- // Anthropic
19
- sonnet: 'anthropic/claude-sonnet-4.6',
20
- claude: 'anthropic/claude-sonnet-4.6',
18
+ // Anthropic — `sonnet`/`claude` follow the newest Sonnet (5); `fable` is the
19
+ // Mythos-class tier above Opus.
20
+ fable: 'anthropic/claude-fable-5',
21
+ 'fable-5': 'anthropic/claude-fable-5',
22
+ sonnet: 'anthropic/claude-sonnet-5',
23
+ claude: 'anthropic/claude-sonnet-5',
24
+ 'sonnet-5': 'anthropic/claude-sonnet-5',
21
25
  'sonnet-4.6': 'anthropic/claude-sonnet-4.6',
26
+ 'sonnet-4.5': 'anthropic/claude-sonnet-4.5',
22
27
  opus: 'anthropic/claude-opus-4.8',
23
28
  'opus-4.8': 'anthropic/claude-opus-4.8',
24
29
  'opus-4.7': 'anthropic/claude-opus-4.7',
25
30
  'opus-4.6': 'anthropic/claude-opus-4.6',
31
+ 'opus-4.5': 'anthropic/claude-opus-4.5',
26
32
  haiku: 'anthropic/claude-haiku-4.5-20251001',
27
33
  'haiku-4.5': 'anthropic/claude-haiku-4.5-20251001',
28
34
  // OpenAI
29
- // `gpt` / `gpt5` / `gpt-5` follow the gateway's flagship — currently 5.5.
30
- gpt: 'openai/gpt-5.5',
31
- gpt5: 'openai/gpt-5.5',
32
- 'gpt-5': 'openai/gpt-5.5',
35
+ // `gpt` / `gpt5` / `gpt-5` follow the gateway's flagship — currently 5.6 Sol.
36
+ gpt: 'openai/gpt-5.6-sol',
37
+ gpt5: 'openai/gpt-5.6-sol',
38
+ 'gpt-5': 'openai/gpt-5.6-sol',
39
+ 'gpt-5.6': 'openai/gpt-5.6-sol',
40
+ 'gpt-5.6-sol': 'openai/gpt-5.6-sol',
41
+ 'gpt-5.6-terra': 'openai/gpt-5.6-terra',
42
+ 'gpt-5.6-luna': 'openai/gpt-5.6-luna',
33
43
  'gpt-5.5': 'openai/gpt-5.5',
34
44
  'gpt-5.4': 'openai/gpt-5.4',
35
45
  'gpt-5.4-pro': 'openai/gpt-5.4-pro',
46
+ 'gpt-5.4-mini': 'openai/gpt-5.4-mini',
47
+ 'gpt-5.4-nano': 'openai/gpt-5.4-nano',
36
48
  'gpt-5.3': 'openai/gpt-5.3',
37
49
  'gpt-5.2': 'openai/gpt-5.2',
38
50
  'gpt-5.2-pro': 'openai/gpt-5.2-pro',
@@ -47,7 +59,9 @@ export const MODEL_SHORTCUTS = {
47
59
  // Google
48
60
  gemini: 'google/gemini-2.5-pro',
49
61
  'gemini-2.5': 'google/gemini-2.5-pro',
50
- flash: 'google/gemini-2.5-flash',
62
+ flash: 'google/gemini-3.5-flash',
63
+ 'gemini-flash': 'google/gemini-3.5-flash',
64
+ 'gemini-3.5-flash': 'google/gemini-3.5-flash',
51
65
  'gemini-3': 'google/gemini-3.1-pro',
52
66
  'gemini-3.1': 'google/gemini-3.1-pro',
53
67
  // xAI — grok-4.3 is the public flagship since 2026-06-04 (grok-3 and the
@@ -67,25 +81,32 @@ export const MODEL_SHORTCUTS = {
67
81
  'deepseek-v4-pro': 'deepseek/deepseek-v4-pro',
68
82
  'dsv4-pro': 'deepseek/deepseek-v4-pro',
69
83
  'v4-pro': 'deepseek/deepseek-v4-pro',
70
- // V4 Flash: free on NVIDIA inference. Bare `deepseek-v4` resolves here
71
- // since the paid V4 Flash SKU was dropped (overlapped with this free one).
72
- 'deepseek-v4': 'nvidia/deepseek-v4-flash',
73
- 'deepseek-v4-flash': 'nvidia/deepseek-v4-flash',
74
- dsv4: 'nvidia/deepseek-v4-flash',
75
- // V3.2 NVIDIA NIM hung (server redirects to V4 Flash) — point the aliases
76
- // straight at the live V4 Flash so the picker doesn't hand back a dead id.
77
- 'deepseek-v3.2': 'nvidia/deepseek-v4-flash',
78
- 'deepseek-v3': 'nvidia/deepseek-v4-flash',
79
- // Free (agent-tested BlockRun gateway free tier — refreshed 2026-04)
80
- free: 'nvidia/llama-4-maverick',
81
- glm4: 'nvidia/llama-4-maverick',
82
- 'deepseek-free': 'nvidia/llama-4-maverick',
83
- 'qwen-coder': 'nvidia/llama-4-maverick',
84
- 'qwen-think': 'nvidia/llama-4-maverick',
84
+ // The free nvidia/deepseek-v4-flash SKU was EOL'd by the gateway (410).
85
+ // Point the deepseek-free aliases at the current free default so muscle
86
+ // memory keeps working without handing back a dead id.
87
+ 'deepseek-v4': 'nvidia/qwen3-next-80b-a3b-instruct',
88
+ 'deepseek-v4-flash': 'nvidia/qwen3-next-80b-a3b-instruct',
89
+ dsv4: 'nvidia/qwen3-next-80b-a3b-instruct',
90
+ 'deepseek-v3.2': 'nvidia/qwen3-next-80b-a3b-instruct',
91
+ 'deepseek-v3': 'nvidia/qwen3-next-80b-a3b-instruct',
92
+ // Free (agent-tested BlockRun gateway free tier — refreshed 2026-07-11).
93
+ // `free` follows the current free default (qwen3-next-instruct: cleanest
94
+ // free instruction-follower). NOTE: every free alias resolves to a $0 nvidia
95
+ // model — the free tier NEVER falls back to a paid model.
96
+ free: 'nvidia/qwen3-next-80b-a3b-instruct',
97
+ qwen: 'nvidia/qwen3-next-80b-a3b-instruct',
98
+ qwen3: 'nvidia/qwen3-next-80b-a3b-instruct',
99
+ 'qwen3-next': 'nvidia/qwen3-next-80b-a3b-instruct',
100
+ 'qwen3.5': 'nvidia/qwen3.5-122b-a10b',
85
101
  maverick: 'nvidia/llama-4-maverick',
86
- 'gpt-oss': 'nvidia/llama-4-maverick',
87
- 'gpt-oss-small': 'nvidia/llama-4-maverick',
88
- 'mistral-small': 'nvidia/llama-4-maverick',
102
+ glm4: 'nvidia/qwen3-next-80b-a3b-instruct',
103
+ 'deepseek-free': 'nvidia/qwen3-next-80b-a3b-instruct',
104
+ 'qwen-coder': 'nvidia/qwen3-next-80b-a3b-instruct',
105
+ 'qwen-think': 'nvidia/qwen3-next-80b-a3b-instruct',
106
+ 'gpt-oss': 'nvidia/qwen3-next-80b-a3b-instruct',
107
+ 'gpt-oss-small': 'nvidia/qwen3-next-80b-a3b-instruct',
108
+ 'mistral-small': 'nvidia/qwen3-next-80b-a3b-instruct',
109
+ 'mistral-nemotron': 'nvidia/mistral-nemotron',
89
110
  // Backward-compatibility aliases for models the gateway retired or exposes
90
111
  // unreliably on /v1/messages. Map to agent-tested free models so shortcuts
91
112
  // keep working without silent paid fallback or empty tool-use turns.
@@ -154,9 +175,10 @@ export const PICKER_CATEGORIES = [
154
175
  // free-tier entries and v3.9.2 used to retire Kimi K2.5.
155
176
  category: '✨ Premium frontier',
156
177
  models: [
178
+ { id: 'anthropic/claude-fable-5', shortcut: 'fable', label: 'Claude Fable 5', price: '$10/$50' },
157
179
  { id: 'anthropic/claude-opus-4.8', shortcut: 'opus', label: 'Claude Opus 4.8', price: '$5/$25', highlight: true },
158
- { id: 'anthropic/claude-sonnet-4.6', shortcut: 'sonnet', label: 'Claude Sonnet 4.6', price: '$3/$15' },
159
- { id: 'openai/gpt-5.5', shortcut: 'gpt', label: 'GPT-5.5', price: '$5/$30', highlight: true },
180
+ { id: 'anthropic/claude-sonnet-5', shortcut: 'sonnet', label: 'Claude Sonnet 5', price: '$3/$15' },
181
+ { id: 'openai/gpt-5.6-sol', shortcut: 'gpt', label: 'GPT-5.6 Sol', price: '$5/$30', highlight: true },
160
182
  { id: 'google/gemini-3.1-pro', shortcut: 'gemini-3', label: 'Gemini 3.1 Pro', price: '$2/$12' },
161
183
  { id: 'google/gemini-2.5-pro', shortcut: 'gemini', label: 'Gemini 2.5 Pro', price: '$1.25/$10' },
162
184
  { id: 'xai/grok-4.3', shortcut: 'grok', label: 'Grok 4.3', price: '$1.5/$4' },
@@ -199,13 +221,14 @@ export const PICKER_CATEGORIES = [
199
221
  {
200
222
  category: '🆓 Free (no USDC needed)',
201
223
  models: [
202
- // Maverick leads the section: the only reliably-healthy free model, and
203
- // the default the `free` shortcut + free routing profile resolve to.
204
- // V4 Flash (1M ctx) is the secondary — strong but occasionally times out
205
- // on the NVIDIA NIM upstream. (Qwen3 Coder 480B removed 2026-06-11: its
206
- // upstream reached EOL and the gateway 410s on it.)
207
- { id: 'nvidia/llama-4-maverick', shortcut: 'maverick', label: 'Llama 4 Maverick', price: 'FREE', highlight: true },
208
- { id: 'nvidia/deepseek-v4-flash', shortcut: 'deepseek-v4', label: 'DeepSeek V4 Flash', price: 'FREE' },
224
+ // Qwen3-Next 80B leads: cleanest free instruction-follower (no thinking
225
+ // leak / markdown fences — verified live 2026-07-11) and the default the
226
+ // `free` shortcut + free routing profile resolve to. Llama 4 Maverick is
227
+ // the diverse-family secondary. (nvidia/deepseek-v4-flash removed
228
+ // 2026-07-11: the gateway 410s on it.) Both are $0 — the free tier never
229
+ // falls back to a paid model.
230
+ { id: 'nvidia/qwen3-next-80b-a3b-instruct', shortcut: 'free', label: 'Qwen3-Next 80B', price: 'FREE', highlight: true },
231
+ { id: 'nvidia/llama-4-maverick', shortcut: 'maverick', label: 'Llama 4 Maverick', price: 'FREE' },
209
232
  ],
210
233
  },
211
234
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/franklin",
3
- "version": "3.30.0",
3
+ "version": "3.31.0",
4
4
  "description": "Franklin Agent — The AI agent with a wallet. Spends USDC autonomously to get real work done. Pay per action, no subscriptions.",
5
5
  "type": "module",
6
6
  "exports": {