nothumanallowed 16.0.61 → 16.0.63

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nothumanallowed",
3
- "version": "16.0.61",
3
+ "version": "16.0.63",
4
4
  "description": "Local AI assistant: 80 tools (Gmail, Calendar, Drive, GitHub, Slack, browser, code, files), 38 agents, visual workflows (Studio, AWF, WebCraft). Install with `npm i -g nothumanallowed`, run with `nha ui`. Free tier built-in (Liara), no API key required. Your data stays on your PC — OAuth tokens local, no cloud. Open-source MIT.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/constants.mjs CHANGED
@@ -5,7 +5,7 @@ import { fileURLToPath } from 'url';
5
5
  const __filename = fileURLToPath(import.meta.url);
6
6
  const __dirname = path.dirname(__filename);
7
7
 
8
- export const VERSION = '16.0.61';
8
+ export const VERSION = '16.0.63';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -1457,16 +1457,23 @@ function buildRequestBody(provider, model, systemPrompt, userMessage, stream) {
1457
1457
  stream,
1458
1458
  };
1459
1459
  }
1460
- // OpenAI-compatible format (OpenAI, DeepSeek, Grok, Mistral)
1460
+ // OpenAI-compatible format (OpenAI, OpenRouter, DeepSeek, Grok, Mistral)
1461
1461
  const modelDefaults = {
1462
1462
  nha: '/opt/models/qwen3-32b',
1463
1463
  openai: 'gpt-4o',
1464
+ openrouter: 'anthropic/claude-sonnet-4.5',
1464
1465
  deepseek: 'deepseek-chat',
1465
1466
  grok: 'grok-3-latest',
1466
1467
  mistral: 'mistral-large-latest',
1467
1468
  };
1469
+ let resolvedModel = model || modelDefaults[provider] || 'gpt-4o';
1470
+ // OpenRouter requires vendor/model format. Auto-prefix bare names so users
1471
+ // who set "gpt-4o" or "claude-sonnet-4.5" don't hit a misleading 404/401.
1472
+ if (provider === 'openrouter' && resolvedModel && !resolvedModel.includes('/')) {
1473
+ resolvedModel = _autoPrefixOpenRouterModel(resolvedModel);
1474
+ }
1468
1475
  const req = {
1469
- model: model || modelDefaults[provider] || 'gpt-4o',
1476
+ model: resolvedModel,
1470
1477
  max_tokens: 8192,
1471
1478
  messages: [
1472
1479
  { role: 'system', content: systemPrompt },
@@ -1474,7 +1481,6 @@ function buildRequestBody(provider, model, systemPrompt, userMessage, stream) {
1474
1481
  ],
1475
1482
  stream,
1476
1483
  };
1477
- // NHA: add thinking control
1478
1484
  if (provider === 'nha') {
1479
1485
  req.chat_template_kwargs = { enable_thinking: false };
1480
1486
  }
@@ -1487,11 +1493,16 @@ function getProviderUrl(provider, model, apiKey) {
1487
1493
  nha: 'https://nothumanallowed.com/api/v1/liara/chat',
1488
1494
  anthropic: 'https://api.anthropic.com/v1/messages',
1489
1495
  openai: 'https://api.openai.com/v1/chat/completions',
1496
+ openrouter: 'https://openrouter.ai/api/v1/chat/completions',
1490
1497
  deepseek: 'https://api.deepseek.com/v1/chat/completions',
1491
1498
  grok: 'https://api.x.ai/v1/chat/completions',
1492
1499
  mistral: 'https://api.mistral.ai/v1/chat/completions',
1500
+ cohere: 'https://api.cohere.ai/v2/chat',
1493
1501
  };
1494
- return urls[provider] || urls.openai;
1502
+ if (!urls[provider]) {
1503
+ throw new Error(`Unknown provider "${provider}". Refusing to silently fall back to OpenAI — set a known provider via "nha config set provider <name>".`);
1504
+ }
1505
+ return urls[provider];
1495
1506
  }
1496
1507
 
1497
1508
  /** Get provider request headers */
@@ -1504,7 +1515,15 @@ function getProviderHeaders(provider, apiKey) {
1504
1515
  };
1505
1516
  }
1506
1517
  if (provider === 'nha') {
1507
- return { 'Content-Type': 'application/json' }; // No auth needed for free tier
1518
+ return { 'Content-Type': 'application/json' };
1519
+ }
1520
+ if (provider === 'openrouter') {
1521
+ return {
1522
+ 'Content-Type': 'application/json',
1523
+ 'Authorization': `Bearer ${apiKey}`,
1524
+ 'HTTP-Referer': 'https://nothumanallowed.com',
1525
+ 'X-Title': 'NotHumanAllowed CLI',
1526
+ };
1508
1527
  }
1509
1528
  return {
1510
1529
  'Content-Type': 'application/json',