@juspay/neurolink 13.12.3 → 13.12.5
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/CHANGELOG.md +4 -2
- package/dist/browser/neurolink.min.js +407 -407
- package/dist/context/budgetChecker.js +1 -2
- package/dist/evaluation/scorers/rule/formatScorer.d.ts +8 -0
- package/dist/evaluation/scorers/rule/formatScorer.js +75 -6
- package/dist/neurolink.js +39 -7
- package/dist/providers/anthropic/client.js +96 -8
- package/dist/routing/classifierRouter.d.ts +2 -3
- package/dist/routing/classifierRouter.js +5 -6
- package/dist/routing/classifierStrategies.js +3 -6
- package/dist/routing/modelCatalog.js +3 -4
- package/dist/routing/modelPool.d.ts +2 -6
- package/dist/routing/modelPool.js +9 -35
- package/dist/types/classifierRouter.d.ts +2 -5
- package/dist/types/generate.d.ts +1 -2
- package/dist/types/modelPool.d.ts +2 -3
- package/dist/types/modelPool.js +1 -2
- package/dist/types/providers.d.ts +10 -0
- package/dist/types/stream.d.ts +1 -2
- package/dist/types/stt.d.ts +6 -0
- package/dist/types/transcribe.d.ts +2 -0
- package/dist/utils/sttProcessor.d.ts +6 -0
- package/dist/utils/sttProcessor.js +39 -5
- package/docs-site/static/search-index.json +8 -7
- package/package.json +3 -2
|
@@ -84,6 +84,12 @@ export declare class STTProcessor {
|
|
|
84
84
|
* module, so a static import back would be a cycle.
|
|
85
85
|
*/
|
|
86
86
|
static resolveHandler(provider: string, credentials?: STTCredentials): Promise<STTHandler | undefined>;
|
|
87
|
+
/**
|
|
88
|
+
* {@link resolveHandler} that also says whether the handler was built for
|
|
89
|
+
* this call (`owned`) rather than taken from the registry. The caller of an
|
|
90
|
+
* owned handler is the only one holding it, so it must dispose it.
|
|
91
|
+
*/
|
|
92
|
+
private static resolveOwnedHandler;
|
|
87
93
|
/**
|
|
88
94
|
* List the names of all registered providers.
|
|
89
95
|
*/
|
|
@@ -99,11 +99,19 @@ export class STTProcessor {
|
|
|
99
99
|
* module, so a static import back would be a cycle.
|
|
100
100
|
*/
|
|
101
101
|
static async resolveHandler(provider, credentials) {
|
|
102
|
+
return (await this.resolveOwnedHandler(provider, credentials)).handler;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* {@link resolveHandler} that also says whether the handler was built for
|
|
106
|
+
* this call (`owned`) rather than taken from the registry. The caller of an
|
|
107
|
+
* owned handler is the only one holding it, so it must dispose it.
|
|
108
|
+
*/
|
|
109
|
+
static async resolveOwnedHandler(provider, credentials) {
|
|
102
110
|
const endpoint = resolveCallSTTEndpoints(credentials)[provider.trim().toLowerCase()];
|
|
103
111
|
if (endpoint) {
|
|
104
112
|
// A per-call named endpoint: a fresh handler, never the registry's.
|
|
105
113
|
const { createSTTHandler } = await import("../voice/index.js");
|
|
106
|
-
return createSTTHandler(provider, credentials);
|
|
114
|
+
return { handler: createSTTHandler(provider, credentials), owned: true };
|
|
107
115
|
}
|
|
108
116
|
const descriptor = getSTTProviderDescriptor(provider);
|
|
109
117
|
const slice = descriptor
|
|
@@ -111,14 +119,20 @@ export class STTProcessor {
|
|
|
111
119
|
: undefined;
|
|
112
120
|
if (descriptor && slice !== undefined) {
|
|
113
121
|
const { createSTTHandler } = await import("../voice/index.js");
|
|
114
|
-
return
|
|
122
|
+
return {
|
|
123
|
+
handler: createSTTHandler(descriptor.name, credentials),
|
|
124
|
+
owned: true,
|
|
125
|
+
};
|
|
115
126
|
}
|
|
116
127
|
const registered = this.getHandler(provider);
|
|
117
128
|
if (registered || !descriptor) {
|
|
118
|
-
return registered;
|
|
129
|
+
return { handler: registered, owned: false };
|
|
119
130
|
}
|
|
120
131
|
const { createSTTHandler } = await import("../voice/index.js");
|
|
121
|
-
return
|
|
132
|
+
return {
|
|
133
|
+
handler: createSTTHandler(descriptor.name, credentials),
|
|
134
|
+
owned: true,
|
|
135
|
+
};
|
|
122
136
|
}
|
|
123
137
|
/**
|
|
124
138
|
* List the names of all registered providers.
|
|
@@ -197,6 +211,7 @@ export class STTProcessor {
|
|
|
197
211
|
"stt.language": options.language,
|
|
198
212
|
"stt.format": options.format,
|
|
199
213
|
});
|
|
214
|
+
let ownedHandler;
|
|
200
215
|
try {
|
|
201
216
|
// 1. Audio validation: reject empty + oversized audio
|
|
202
217
|
const byteLength = audio instanceof ArrayBuffer ? audio.byteLength : audio.length;
|
|
@@ -227,7 +242,14 @@ export class STTProcessor {
|
|
|
227
242
|
});
|
|
228
243
|
}
|
|
229
244
|
// 2. Handler lookup and error if provider not supported
|
|
230
|
-
const
|
|
245
|
+
const resolved = await this.resolveOwnedHandler(provider, credentials);
|
|
246
|
+
const handler = resolved.handler;
|
|
247
|
+
// A handler built for this call has no other holder: dispose it when
|
|
248
|
+
// the call ends, or each credentials slice leaks an engine (WhistleSTT
|
|
249
|
+
// starts a worker thread per instance).
|
|
250
|
+
if (handler && resolved.owned) {
|
|
251
|
+
ownedHandler = handler;
|
|
252
|
+
}
|
|
231
253
|
if (!handler) {
|
|
232
254
|
logger.error(`[STTProcessor] Provider "${provider}" is not registered`);
|
|
233
255
|
throw new STTError({
|
|
@@ -364,5 +386,17 @@ export class STTProcessor {
|
|
|
364
386
|
originalError: err instanceof Error ? err : undefined,
|
|
365
387
|
});
|
|
366
388
|
}
|
|
389
|
+
finally {
|
|
390
|
+
if (ownedHandler?.dispose) {
|
|
391
|
+
try {
|
|
392
|
+
await ownedHandler.dispose();
|
|
393
|
+
}
|
|
394
|
+
catch (disposeErr) {
|
|
395
|
+
logger.warn(`[STTProcessor] Failed to dispose the "${provider}" handler: ${disposeErr instanceof Error
|
|
396
|
+
? disposeErr.message
|
|
397
|
+
: String(disposeErr)}`);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
367
401
|
}
|
|
368
402
|
}
|
|
@@ -2255,7 +2255,7 @@
|
|
|
2255
2255
|
{"objectID":"2cad48473fb9c200377fe1a4b2f1e1feea861afe5ae7ee9a53caf6cbe313cc4a","title":"One line per model","url":"/docs/features/classifier-router-catalog#one-line-per-model","content":"Each surviving model becomes a ClassifierCandidate and renderCandidate()\nturns it into one terse line for jev's criteria map. The order and the\nprecedence are both deliberate:\ndescription always renders first, when present.\ntiers, when declared, renders next as intended for\ntrivial/simple tasks — the host's most direct statement of where a\n model belongs.\nContext window and capability flags always render. These are facts\n about the model (\"accepts images\", \"128K context\"), not opinions about\n how good it is, so nothing suppresses them.\nDeclared cost/quality replace the registry's own opinion, rather\n than sitting beside it. When either is set, the line adds capability N\n(higher is more capable) / relative cost N (lower is cheaper) and\n suppresses the registry's price, speed bucket, quality bucket, and\n \"strong at …\" use-case scores entirely. When neither is set, the registry\n fills all of that in exactly as it always did.\n\nTwo real renders, from the same model, show the difference:\n\nThis precedence exists because the registry's opinion used to win, and a\nlive measurement showed it silently overriding the host's own routing\nintent. A pool member declared exactly the second line above — an explicit\nstatement that this model is for rote work — but the registry rates the\nsame underlying model highly on general benchmarks, so the old rendering\nappended its own \"high quality\" and \"strong at coding, analysis, reasoning\"\non top. Five registry clauses against one line of host prose, and the host\nlost: a hard concurrency-bug task routed to the cheap model in 5 of 8 runs,\nbecause the model-pick question asks for \"the cheapest one that can still\ncomplete this request correctly\" and had just been told the cheap one was\nhigh quality and strong at reasoning. The declared quality: 2 never\nreached the model at all — only description did.","hierarchy":{"lvl0":"Features","lvl1":"The model catalogue","lvl2":"One line per model","lvl3":""}},
|
|
2256
2256
|
{"objectID":"cac106bc67990b1f4b93d0096370fca3aa0e30de9da3db2bb3636813f4dd6b7d","title":"A choice over N models is a ranking of N","url":"/docs/features/classifier-router-catalog#a-choice-over-n-models-is-a-ranking-of-n","content":"Because readDecisionChoice returns every option's probability, one choice\nquestion over the whole catalogue doesn't just name a winner — it ranks all N\ncandidates by how likely each is to be the right pick. This is what makes\npicking from up to maxModels (120 by default; the whole registry today is 64) a single request rather than N binary questions.","hierarchy":{"lvl0":"Features","lvl1":"The model catalogue","lvl2":"A choice over N models is a ranking of N","lvl3":""}},
|
|
2257
2257
|
{"objectID":"a0961baceadf689ad6859272fa26f697f86c61f66d83070a78eae6af11db354e","title":"Deterministic fallback ranking","url":"/docs/features/classifier-router-catalog#deterministic-fallback-ranking","content":"Every other decide consumer in this codebase falls back to _what the code\nalready did_. There was no prior \"pick from the whole registry\" behaviour to\nfall back to, so the catalogue needed its own: rankCatalogue() runs whenever\nno decision provider is configured, the call fails, or the difficulty tier's own\ntop-of-pool choice is what's needed (selectModels() always computes it, even\nwhen jev's pick clears its bar, as the fallback list that ships alongside the\nwinner).\n\nThe ranking is tierScore() — a deterministic formula per difficulty:\n\nsuitability reads the registry's own 1–10 score for the dimension that tier\ncares about (conversation for trivial/simple, coding for moderate,\nreasoning for hard/expert). tierCostWeight is what makes this a real\nranker rather than a sort by price: at trivial it is 1 (the cheapest\nadequate model wins outright), at expert it is 0.05 (price is nearly\nirrelevant). This never consults the network and is the ordering the decision\nmodel's own pick is compared against when deciding whether it clears its bar.","hierarchy":{"lvl0":"Features","lvl1":"The model catalogue","lvl2":"Deterministic fallback ranking","lvl3":""}},
|
|
2258
|
-
{"objectID":"b0a5b78dc4cfcabcd52b58ea94936ee81e97b59b5907f058ccba74881a7aeacd","title":"Context-window filtering","url":"/docs/features/classifier-router-catalog#context-window-filtering","content":"Nothing in routing read maxContextTokens before this. Two independent checks\nnow do:\nrankCatalogue() filters candidates whose contextWindow is below the\n request's estimated input tokens, applied only when it would leave something\n behind (an empty result falls back to the unfiltered pool rather than\n routing nowhere).\nThe classifier's own pick is separately vetoed. Even when jev picks a\n model directly, fitsRequest() checks whether that specific model's window\n can hold the request. If it can't, the pick is dropped regardless of\n confidence —
|
|
2258
|
+
{"objectID":"b0a5b78dc4cfcabcd52b58ea94936ee81e97b59b5907f058ccba74881a7aeacd","title":"Context-window filtering","url":"/docs/features/classifier-router-catalog#context-window-filtering","content":"Nothing in routing read maxContextTokens before this. Two independent checks\nnow do:\nrankCatalogue() filters candidates whose contextWindow is below the\n request's estimated input tokens, applied only when it would leave something\n behind (an empty result falls back to the unfiltered pool rather than\n routing nowhere).\nThe classifier's own pick is separately vetoed. Even when jev picks a\n model directly, fitsRequest() checks whether that specific model's window\n can hold the request. If it can't, the pick is dropped regardless of\n confidence — an oversized request would fail on that model. The model\n remains available for later requests that fit its window.","hierarchy":{"lvl0":"Features","lvl1":"The model catalogue","lvl2":"Context-window filtering","lvl3":""}},
|
|
2259
2259
|
{"objectID":"e34966644db91aef39b46ef5c2f2fa259e9c828895197c9b2260a07c6e640bce","title":"What this is bad at","url":"/docs/features/classifier-router-catalog#what-this-is-bad-at","content":"Registry quality is coarse, and the catalogue path never shows its own\n work. Auto-enriched quality is a 3-bucket scale (high/medium/low)\n before buildModelCatalog() turns it into 1/2/3; two \"high\" models\n cannot be separated on capability alone. Worse for this page's topic: because\n the catalogue always populates cost/quality, its rendered line never\n shows the registry's own price, speed bucket, or \"strong at …\" scores — only\n the terse capability N / relative cost N form. Declare tiers/quality\n on a hand-declared pool member for finer control over the number itself; there\n is no way to get the richer rendering for a catalogue-sourced model.\nA catalogue candidate's \"relative cost\" is real pricing wearing a relative\n label. buildModelCatalog() seeds it from inputCostPer1K + outputCostPer1K\n — a small decimal like 0.00074 — not a small integer a host would typically\n pick for a hand-declared cost. The number is still correct and still never\n rendered as currency, but it does not compare cleanly against a hand-declared\n member's cost: 1 in the same pool, since one is a real price and the other\n is an arbitrary scale.\nUnknown-to-the-registry models rank on relative numbers, not real prices.\n A model the registry doesn't know (self-hosted, brand-new) keeps whatever\n cost/quality the host declared, compared only against other declared\n values on the same relative scale — never rendered as a dollar figure it\n isn't.\nA wide catalogue is still one choice question, and the cap is hard, not\n smart, when it does bind. Every model adds tokens to that single question;\n maxModels is the safeguard, and a model past it would simply never be\n offered rather than offered with lower priority. Today this is theoretical —\n the registry is 64 models against a default cap of 120, so nothing is\n dropped — but the mechanism has no ranking behavior for the day a registry\n does exceed it.\nPermissive reachability means occasional dead candidates.","hierarchy":{"lvl0":"Features","lvl1":"The model catalogue","lvl2":"What this is bad at","lvl3":""}},
|
|
2260
2260
|
{"objectID":"2d7354001109ce1051977450cf365d1f2a8e13b345ad206ee23b1f5466228454","title":"See also","url":"/docs/features/classifier-router-catalog#see-also","content":"Classifier Router\nModel routing with a decision model\nThe decide inference type","hierarchy":{"lvl0":"Features","lvl1":"The model catalogue","lvl2":"See also","lvl3":""}},
|
|
2261
2261
|
{"objectID":"57703ab4e28ce3ad7f4c83d5d3e43f1b1d5541cbb2ac1d6f10f7a057046f0e1b","title":"Model routing with a decision model","url":"/docs/features/classifier-router-jev-strategy","content":"Model routing with a decision model\n\nThe classifier router has a jev strategy: one\ndecision-model round trip answers difficulty,\nrequired capabilities, risk and the model pick simultaneously, with a\ncalibrated confidence on each. This page is the strategy's own mechanics —\nclassifier-router.md covers the router as a whole.\n\nThe degradation contract. With no decision provider configured,\nresolveStrategy() resolves auto to heuristic, exactly as it always did.\nclassifyJev() itself never throws: any failure, timeout, or malformed answer\nfalls back to classifyHeuristic(). Configuring a decision provider (for example TYPESAFE_API_KEY or\nAI_GATEWAY_API_KEY) upgrades routing; it cannot make routing worse than before\nthe key existed. The same holds for PERPLEXITY_API_KEY, which is also the\nPerplexity text provider's key, and for CLOUDFLARE_API_KEY with\nCLOUDFLARE_ACCOUNT_ID, which are also the Cloudflare Workers AI text provider's\ntoken and account id, and for SUBQ_API_KEY, and for OPENAI_API_KEY, which is also the OpenAI chat\nprovider's key (for a host with only that key auto now resolves to jev,\nanswered by OpenAI Decisions, the default decision provider when none ahead of it is configured, unless OPENAI_BASE_URL,\nOPENAI_API_BASE or credentials.openai.baseURL names a host other than https://api.openai.com, which makes it a gateway's key), and for SCALEDOWN_API_KEY, which is ScaleDown's own and counts by itself (with only that key auto resolves to jev, answered by ScaleDown). \"Configured\" counts the environment, the instance\ncredentials, and the request's own per-call credentials — a host that holds\nno decision key but passes a tenant's credentials: { laya } on a generate()\ncall routes that call with jev, and the decision goes to the tenant's account.\n\nWhat goes into the state\n\nclassifyJev() sends the request truncated to 8000 characters, plus four\nsignals the caller already has on hand:\n\nAlongside it, one batch asks: difficulty (a choice over the five tiers),\nneeds_vision / needs_tools / needs_reasoning (boolean), risky\n(boolean), context (a score — see\nper-request context budget), and, only when the\npool has more than one member, model (a choice over the pool, rendered by\nthe catalogue). All of this rides in\none request. On TypeSafe that takes ~400ms, because latency is flat in question\ncount; on Perplexity each further question adds about 65 ms, up to 128 (see\nits guide); on\nCloudflare Clef a small request took 0.3 to 1.0 s on 2026-10-03 (see\nits guide). See\nthe batching rule.\n\nNeuroLink refuses a state it estimates at more than 16,000 tokens (about 60,000\ncharacters of prose) with max_tokens_exceeded, to keep Clef inside what it was\nseen to read in full and inside a timeout a fail-open consumer can afford. A\nlonger request is refused there, and the heuristic classifier's tier stands, as it\ndoes on any failure.\n\nThe difficulty rubric\n\nFive tiers, ordered easiest to hardest, worded about the shape of the work —\nthe model is never told a provider or model name:\n\n| Tier | Criterion |\n| ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |\n| trivial | Mechanical and local: rename a symbol, fix a typo, add an import, run one named command, or answer something already stated. |\n| simple | A small localised change or a direct factual answer. One file, one obvious approach. |\n| moderate | Ordinary engineering: implement a well-specified change across a few files, write tests, fix a clearly described bug, review a small diff. |\n| hard | Deep reasoning: architecture and design, debugging a failure whose cause is unknown, security analysis, concurrency, cross-system refactors. |\n| expert | Frontier-level work: ambiguous requirements, novel design with no established pattern, or analysis where a wrong answer is costly and hard to detect. |\n\nAsymmetric confidence bars, and why they differ\n\nA verdict harder than the neutral tier (moderate) spends more if wrong; a\nverdict easier than neutral spends less if wrong. Those are not the same\nmistake:\nRouting a simple task to an expensive model wastes money. Cheap to be wrong\n about, so the bar to route up is low: minUpgradeConfidence defaults to\n 0.3.\nRouting a hard task to a weak model produces a wrong answer. Expensive to be\n wrong about, so the bar to route down is high: minDowngradeConfidence\n defaults to 0.6.\n\nBelow the applicable bar, the difficulty verdict is discarded and the heuristic\nclassifier's tier stands instead — not a downgraded jev answer, the ordinary\nzero-cost fallback.\n\nOne case skips both bars: a risky reading above 0.7 forces the tier to at\nleast hard, unconditionally. Risk can only ever ","hierarchy":{"lvl0":"Features","lvl1":"Model routing with a decision model","lvl2":"","lvl3":""}},
|
|
@@ -2699,11 +2699,11 @@
|
|
|
2699
2699
|
{"objectID":"efd21276881aaff463922d63ebd364e1b177ac659b6927d25c7858f7bb0a6190","title":"9.6 Metrics","url":"/docs/features/codex-proxy-support#96-metrics","content":"Two Codex-outbound-specific OTel counters, both emitted from\nsrc/lib/proxy/proxyTracer.ts:\n\n| Metric | Labels | Meaning |\n| ---------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| proxy_codex_outbound_schema_degraded_total | {reason, toolName} | A tool declaration's JSON Schema needed flattening or lost a feature on the way to a Claude tool. reason is one of circular_ref_flattened (a genuine cycle degraded to {type:\"object\"}) or strict_mode_flag_dropped (the Codex tool's strict flag has no Claude equivalent and was dropped). |\n| proxy_codex_outbound_unsupported_field_total | {field} | A Codex-outbound request field this repo cannot faithfully represent in the Claude request was dropped rather than failing the translation. |\n\nEvery other proxy metric in the existing dashboard (proxy_request_duration_ms,\nproxy_tokens_*, proxy_errors_total, proxy_fallback_attempts_total,\nproxy_fallback_success_total, proxy_fallback_failure_total, …) also fires\nfor a Codex-outbound-fallback request, on the serving engine, same as any other\nproxied call.\n\nproxy_cost_usd_total is a cumulative counter, not a gauge.","hierarchy":{"lvl0":"Features","lvl1":"Codex (ChatGPT) Support for NeuroLink Proxy","lvl2":"9.6 Metrics","lvl3":""}},
|
|
2700
2700
|
{"objectID":"43b245bbe599ce8328e90e4528f7d83e953cf3ddea0448aac3ac7834587419f7","title":"9.7 Sign-off status","url":"/docs/features/codex-proxy-support#97-sign-off-status","content":"The following were flagged in the original design as behavior-changing choices\nneeding product sign-off. All three were signed off 2026-09-28 and ship as\ndesigned, not as placeholders awaiting approval:\nThe lossy grammar/custom-tool → single {input: string} parameter mapping\n (§9.4 above), with custom_tool_call on the way back.\nThe {input: raw} non-JSON-argument history fallback and its downstream\n effect on tool execution.\nThe reasoning-effort → thinking-budget table in §9.4 above.\n\nSee docs/superpowers/specs/2026-09-27-codex-outbound-fallback-design.md for\nthe full design record and rulings.","hierarchy":{"lvl0":"Features","lvl1":"Codex (ChatGPT) Support for NeuroLink Proxy","lvl2":"9.7 Sign-off status","lvl3":""}},
|
|
2701
2701
|
{"objectID":"7d4e6e1166cdf67bb24a8c10d864e2a5e88df37bb004a60467cdf247ebd829ca","title":"9.8 Live validation (after the Codex quota resets 2026-10-03)","url":"/docs/features/codex-proxy-support#98-live-validation-after-the-codex-quota-resets-2026-10-03","content":"Everything above has been verified at the request/response shape level —\ntranslation correctness, config validation, metrics, loop-prevention logic —\nusing synthetic and characterization fixtures (including a redacted real Codex\nCLI wire capture). None of it has been exercised against live Codex, Vertex\nor Anthropic traffic end to end, because the Codex account available to this\nwork is quota-rejected until 2026-10-03. The validation plan's Part B live\nmatrix (stage-d-validation.md §4) is the run to do once quota is back; its\nscenarios, unchanged from the plan:\n[ ] B1 — Cold start, single turn (gpt-5.6-sol → Anthropic): if the\n Section-0 tool policy permits dispatch, proxy_tokens_input rises by\n roughly the translated prefix token count and proxy_tokens_cache_creation\n rises above 0; if the policy is fail-closed, a Codex-shaped diagnostic\n with no dispatch attempted is the correct, expected outcome — not a bug.\n[ ] B2 — Warm second turn, same session/account (gpt-5.6-sol →\n Anthropic): confirm both turns were served by the same account (query\n proxy_cost_usd_total's account label) before drawing any cache\n conclusion, then confirm proxy_tokens_cache_read rises by ≥80% of the\n prior turn's cache_creation delta with the second turn's own\n cache_creation delta near zero — the live proof that A.6's byte-\n stability requirement (already fixture-verified offline) holds against\n a real cache hop.\n[ ] B3 — Functions-namespace tool call (gpt-6-astra → Anthropic):\n read_file alongside the ever-present exec/request_review\n collaboration tools; the client-visible stream carries a well-formed\n function_call the Codex CLI can execute, proxy_fallback_success_total{provider='anthropic'}\n increments by exactly 1, and there is no Anthropic 400 on the\n accompanying custom-tool schema.","hierarchy":{"lvl0":"Features","lvl1":"Codex (ChatGPT) Support for NeuroLink Proxy","lvl2":"9.8 Live validation (after the Codex quota resets 2026-10-03)","lvl3":""}},
|
|
2702
|
-
{"objectID":"89c0f088b6b4f91a1fc99b1db7acb741e912010bac6416ffe5d94730ff7e11a2","title":"Per-request context budget","url":"/docs/features/context-budget","content":"Per-request context budget\n\nContext compaction has always triggered at a fixed 80% of the model's window.\nThat number is now a default, not a constant: a per-request compactionThreshold\noption lowers it for requests that need less room, and the\nclassifier router's jev strategy can fill\nit in automatically by asking how much of the conversation the request actually\nneeds.\n\nThe degradation contract. Every input here is optional. With no\ncompactionThreshold passed and no classifier router configured, the effective\nthreshold is exactly 0.8, exactly as before — resolveHistoryBudget()'s\nscale factor is compactionThreshold / 0.8, so the default value reproduces\nthe previous budget calculation to the token.\n\nSetting it directly\n\nCLI: neurolink generate \"...\" --compaction-threshold 0.45 (existing flag,\ndescription: \"Fraction of the context window (0-1) at which history is\ncompacted. Default 0.8.\").\n\nLetting the classifier fill it in\n\nWhen classifierRouter.contextBudget is enabled (default: true whenever\nthe strategy resolves to a decision model; ignored by heuristic/llm), the\nsame jev request that classifies difficulty also asks a score question:\n\nHow much of the earlier conversation does answering this request actually\nrequire?\n\nagainst a four-level rubric:\n\n| Scope | Criterion | Threshold |\n| ------------------- | -------------------------------------------------------------------------------------------------- | --------- |\n| current-message | Self-contained. Earlier conversation would not change the answer. | 0.45 |\n| recent-turns | Needs the last few exchanges — a follow-up, a correction, a reference to something just discussed. | 0.60 |\n| full-conversation | Needs the whole conversation, including decisions and constraints established much earlier. | 0.75 |\n| everything | Needs the conversation and every document, file and tool result that has been gathered. | 0.80 |\n\nThis is a rubric, not a token count, and deliberately so: a decision model\nplaces a request on an ordered scale reliably and reads digit strings as text,\nnot quantities — asking \"how many tokens does this need\" would get an answer\nshaped like a guess at a number, not a calibrated judgement.\n\nThe reading is used only above MIN_CONTEXT_SCOPE_CONFIDENCE (0.5); below\nthat, contextScope is left undefined and the request falls back to the\n0.8 default exactly as if the question had not been asked. The scope judgement\nis independent of the difficulty tier — a trivial request can still need the\nwhole conversation, and an expert one can be entirely self-contained — so\nit is read and applied on its own, and survives every path on which the\ndifficulty verdict itself is discarded by its confidence bar.\n\napplyClassifierRouting() then applies the derived threshold only when the\ncaller left compactionThreshold unset:\n\nAn explicit per-call value always wins. The classifier is filling in a default\nyou didn't set, never overriding one you did.\n\nThe one-directional invariant\n\nThe mapping from scope to threshold can only ever lower the 0.8 default,\nnever raise it, and this is enforced independently at two layers:\ncontextScopeToThreshold() clamps its result with Math.min(0.8, ...)\n before returning.\nClassifierRouter.selectContextBudget() re-checks the result and discards\n it unless threshold < 0.8.\n\
|
|
2702
|
+
{"objectID":"89c0f088b6b4f91a1fc99b1db7acb741e912010bac6416ffe5d94730ff7e11a2","title":"Per-request context budget","url":"/docs/features/context-budget","content":"Per-request context budget\n\nContext compaction has always triggered at a fixed 80% of the model's window.\nThat number is now a default, not a constant: a per-request compactionThreshold\noption lowers it for requests that need less room, and the\nclassifier router's jev strategy can fill\nit in automatically by asking how much of the conversation the request actually\nneeds.\n\nThe degradation contract. Every input here is optional. With no\ncompactionThreshold passed and no classifier router configured, the effective\nthreshold is exactly 0.8, exactly as before — resolveHistoryBudget()'s\nscale factor is compactionThreshold / 0.8, so the default value reproduces\nthe previous budget calculation to the token.\n\nSetting it directly\n\nCLI: neurolink generate \"...\" --compaction-threshold 0.45 (existing flag,\ndescription: \"Fraction of the context window (0-1) at which history is\ncompacted. Default 0.8.\").\n\nLetting the classifier fill it in\n\nWhen classifierRouter.contextBudget is enabled (default: true whenever\nthe strategy resolves to a decision model; ignored by heuristic/llm), the\nsame jev request that classifies difficulty also asks a score question:\n\nHow much of the earlier conversation does answering this request actually\nrequire?\n\nagainst a four-level rubric:\n\n| Scope | Criterion | Threshold |\n| ------------------- | -------------------------------------------------------------------------------------------------- | --------- |\n| current-message | Self-contained. Earlier conversation would not change the answer. | 0.45 |\n| recent-turns | Needs the last few exchanges — a follow-up, a correction, a reference to something just discussed. | 0.60 |\n| full-conversation | Needs the whole conversation, including decisions and constraints established much earlier. | 0.75 |\n| everything | Needs the conversation and every document, file and tool result that has been gathered. | 0.80 |\n\nThis is a rubric, not a token count, and deliberately so: a decision model\nplaces a request on an ordered scale reliably and reads digit strings as text,\nnot quantities — asking \"how many tokens does this need\" would get an answer\nshaped like a guess at a number, not a calibrated judgement.\n\nThe reading is used only above MIN_CONTEXT_SCOPE_CONFIDENCE (0.5); below\nthat, contextScope is left undefined and the request falls back to the\n0.8 default exactly as if the question had not been asked. The scope judgement\nis independent of the difficulty tier — a trivial request can still need the\nwhole conversation, and an expert one can be entirely self-contained — so\nit is read and applied on its own, and survives every path on which the\ndifficulty verdict itself is discarded by its confidence bar.\n\napplyClassifierRouting() then applies the derived threshold only when the\ncaller left compactionThreshold unset:\n\nAn explicit per-call value always wins. The classifier is filling in a default\nyou didn't set, never overriding one you did.\n\nThe one-directional invariant\n\nThe mapping from scope to threshold can only ever lower the 0.8 default,\nnever raise it, and this is enforced independently at two layers:\ncontextScopeToThreshold() clamps its result with Math.min(0.8, ...)\n before returning.\nClassifierRouter.selectContextBudget() re-checks the result and discards\n it unless threshold < 0.8.\n\nShrinking a budget compacts a little earlier than strictly necessary. Growing\none could let a request through that the provider rejects with a\ncontext-window error. That failure affects the current request, so the code\nkeeps the threshold at or below the default while leaving the model available\nfor later requests that fit.\n\nHow the threshold changes the actual budget\n\nresolveHistoryBudget() is what the compactor targets — the model's available\ninput space minus system prompt, current prompt, tool definitions and file\nattachments, all of which ride alongside history rather than being part of\nit. The per-request threshold scales that budget directly:\n\nWith the default 0.8, scale is exactly 1 and the budget is unchanged\nfrom before this option existed. A 0.4 threshold halves the history budget.\nThe 0.95 safety factor is unrelated to this feature — it exists because\ntoken estimation is character-based and approximate, so the compactor always\naims slightly under the true ceiling.\n\nWhat this is bad at\nIt is a suggestion, not a measurement. The rubric asks \"how much would\n a human say this needs,\" not \"how many tokens will this actually consume.\"\n A request correctly judged recent-turns can still occasionally need one\n detail from much earlier — the invariant above is what keeps that failure\n mode cheap (a slightly early compaction) rather than catastrophic.\nOne judgement per request, not per turn of the conversation that follows.\n If the classifier runs once per turn (which it does), ","hierarchy":{"lvl0":"Features","lvl1":"Per-request context budget","lvl2":"","lvl3":""}},
|
|
2703
2703
|
{"objectID":"6e42051940f716e8463919220990087875ede2015f3d6d14951b113f55d268ad","title":"Per-request context budget","url":"/docs/features/context-budget#per-request-context-budget","content":"Context compaction has always triggered at a fixed 80% of the model's window.\nThat number is now a default, not a constant: a per-request compactionThreshold\noption lowers it for requests that need less room, and the\nclassifier router's jev strategy can fill\nit in automatically by asking how much of the conversation the request actually\nneeds.\n\nThe degradation contract. Every input here is optional. With no\ncompactionThreshold passed and no classifier router configured, the effective\nthreshold is exactly 0.8, exactly as before — resolveHistoryBudget()'s\nscale factor is compactionThreshold / 0.8, so the default value reproduces\nthe previous budget calculation to the token.","hierarchy":{"lvl0":"Features","lvl1":"Per-request context budget","lvl2":"Per-request context budget","lvl3":""}},
|
|
2704
2704
|
{"objectID":"f0d23f694f874e0f664f348ae61fb3dcfa09869d8fa23d3708bef58bb1d8a3a5","title":"Setting it directly","url":"/docs/features/context-budget#setting-it-directly","content":"CLI: neurolink generate \"...\" --compaction-threshold 0.45 (existing flag,\ndescription: \"Fraction of the context window (0-1) at which history is\ncompacted. Default 0.8.\").","hierarchy":{"lvl0":"Features","lvl1":"Per-request context budget","lvl2":"Setting it directly","lvl3":""}},
|
|
2705
2705
|
{"objectID":"568e5df23dcc19c14f20bcd8cb4bf66718bff8e85951c9091179443a86b9ed15","title":"Letting the classifier fill it in","url":"/docs/features/context-budget#letting-the-classifier-fill-it-in","content":"When classifierRouter.contextBudget is enabled (default: true whenever\nthe strategy resolves to a decision model; ignored by heuristic/llm), the\nsame jev request that classifies difficulty also asks a score question:\n\nHow much of the earlier conversation does answering this request actually\nrequire?\n\nagainst a four-level rubric:\n\n| Scope | Criterion | Threshold |\n| ------------------- | -------------------------------------------------------------------------------------------------- | --------- |\n| current-message | Self-contained. Earlier conversation would not change the answer. | 0.45 |\n| recent-turns | Needs the last few exchanges — a follow-up, a correction, a reference to something just discussed. | 0.60 |\n| full-conversation | Needs the whole conversation, including decisions and constraints established much earlier. | 0.75 |\n| everything | Needs the conversation and every document, file and tool result that has been gathered. | 0.80 |\n\nThis is a rubric, not a token count, and deliberately so: a decision model\nplaces a request on an ordered scale reliably and reads digit strings as text,\nnot quantities — asking \"how many tokens does this need\" would get an answer\nshaped like a guess at a number, not a calibrated judgement.\n\nThe reading is used only above MIN_CONTEXT_SCOPE_CONFIDENCE (0.5); below\nthat, contextScope is left undefined and the request falls back to the\n0.8 default exactly as if the question had not been asked. The scope judgement\nis independent of the difficulty tier — a trivial request can still need the\nwhole conversation, and an expert one can be entirely self-contained — so\nit is read and applied on its own, and survives every path on which the\ndifficulty verdict itself is discarded by its confidence bar.","hierarchy":{"lvl0":"Features","lvl1":"Per-request context budget","lvl2":"Letting the classifier fill it in","lvl3":""}},
|
|
2706
|
-
{"objectID":"f7d479c7b3b2b6db55717893f01303b5b45844b00a20671f44bab1f911b45719","title":"The one-directional invariant","url":"/docs/features/context-budget#the-one-directional-invariant","content":"The mapping from scope to threshold can only ever lower the 0.8 default,\nnever raise it, and this is enforced independently at two layers:\ncontextScopeToThreshold() clamps its result with Math.min(0.8, ...)\n before returning.\nClassifierRouter.selectContextBudget() re-checks the result and discards\n it unless threshold < 0.8.\n\
|
|
2706
|
+
{"objectID":"f7d479c7b3b2b6db55717893f01303b5b45844b00a20671f44bab1f911b45719","title":"The one-directional invariant","url":"/docs/features/context-budget#the-one-directional-invariant","content":"The mapping from scope to threshold can only ever lower the 0.8 default,\nnever raise it, and this is enforced independently at two layers:\ncontextScopeToThreshold() clamps its result with Math.min(0.8, ...)\n before returning.\nClassifierRouter.selectContextBudget() re-checks the result and discards\n it unless threshold < 0.8.\n\nShrinking a budget compacts a little earlier than strictly necessary. Growing\none could let a request through that the provider rejects with a\ncontext-window error. That failure affects the current request, so the code\nkeeps the threshold at or below the default while leaving the model available\nfor later requests that fit.","hierarchy":{"lvl0":"Features","lvl1":"Per-request context budget","lvl2":"The one-directional invariant","lvl3":""}},
|
|
2707
2707
|
{"objectID":"e0867ad2f11fe401499dda82ede924767539b8377443f7e7ef3463829da48f72","title":"How the threshold changes the actual budget","url":"/docs/features/context-budget#how-the-threshold-changes-the-actual-budget","content":"resolveHistoryBudget() is what the compactor targets — the model's available\ninput space minus system prompt, current prompt, tool definitions and file\nattachments, all of which ride alongside history rather than being part of\nit. The per-request threshold scales that budget directly:\n\nWith the default 0.8, scale is exactly 1 and the budget is unchanged\nfrom before this option existed. A 0.4 threshold halves the history budget.\nThe 0.95 safety factor is unrelated to this feature — it exists because\ntoken estimation is character-based and approximate, so the compactor always\naims slightly under the true ceiling.","hierarchy":{"lvl0":"Features","lvl1":"Per-request context budget","lvl2":"How the threshold changes the actual budget","lvl3":""}},
|
|
2708
2708
|
{"objectID":"196b4b8863a944ba130eda4eb2f4fd645841348f85a0647738e81dd3a92df3f0","title":"What this is bad at","url":"/docs/features/context-budget#what-this-is-bad-at","content":"It is a suggestion, not a measurement. The rubric asks \"how much would\n a human say this needs,\" not \"how many tokens will this actually consume.\"\n A request correctly judged recent-turns can still occasionally need one\n detail from much earlier — the invariant above is what keeps that failure\n mode cheap (a slightly early compaction) rather than catastrophic.\nOne judgement per request, not per turn of the conversation that follows.\n If the classifier runs once per turn (which it does), the scope can change\n turn to turn, but there's no persistence of \"this whole session is a\n current-message session\" — a caller who wants that stability should pass\n compactionThreshold explicitly rather than rely on auto.\nIt shares the base model's limits. Everything in\n what decide is bad at\n applies — including that irrelevant state costs accuracy, so a very long\n prompt slice can degrade the scope reading itself.\nNo feedback loop. If the classifier's current-message guess turns out\n wrong and the model asks a follow-up that needed history you already\n dropped, nothing here recovers that turn; the invariant only bounds the\n cost of the guess, it doesn't undo it.","hierarchy":{"lvl0":"Features","lvl1":"Per-request context budget","lvl2":"What this is bad at","lvl3":""}},
|
|
2709
2709
|
{"objectID":"7764ebf2c6fa54846f789e257b1adea74fb778597e9e2e3767d4410462d2818f","title":"See also","url":"/docs/features/context-budget#see-also","content":"Model routing with a decision model\nRelevance-driven compaction\nThe decide inference type","hierarchy":{"lvl0":"Features","lvl1":"Per-request context budget","lvl2":"See also","lvl3":""}},
|
|
@@ -3735,7 +3735,7 @@
|
|
|
3735
3735
|
{"objectID":"d256fe39eb21be95c6b75bdd3179d95e245c3a116465afec9bee7fe38b55e989","title":"Tier-up on denial","url":"/docs/features/provider-fallback#tier-up-on-denial","content":"Tier-up on denial","hierarchy":{"lvl0":"Features","lvl1":"Provider Fallback & Model Chains","lvl2":"Tier-up on denial","lvl3":""}},
|
|
3736
3736
|
{"objectID":"8bf09b3f1207ac25c29b5833f5f6de11dff159a64e441fcabfa717d8dae88a4e","title":"Cross-provider failover","url":"/docs/features/provider-fallback#cross-provider-failover","content":"Cross-provider failover","hierarchy":{"lvl0":"Features","lvl1":"Provider Fallback & Model Chains","lvl2":"Cross-provider failover","lvl3":""}},
|
|
3737
3737
|
{"objectID":"9c51b871367ba3a45cb97dd7259ba5717cc5cc072f50c091b63c661c7a470b7d","title":"Related","url":"/docs/features/provider-fallback#related","content":"Credential Validation — sdk.checkCredentials() and the typed ModelAccessDeniedError\nReal-time Voice Services — fallback also applies to realtime sessions on access denial\nProvider Setup — configuring supported providers\nObservability — wiring model.fallback events into your monitoring stack","hierarchy":{"lvl0":"Features","lvl1":"Provider Fallback & Model Chains","lvl2":"Related","lvl3":""}},
|
|
3738
|
-
{"objectID":"3b5d0122d0762f5202d83a9db0e7430a5ae248ba21c1277692dc84d45ff346bf","title":"Provider Orchestration Brain","url":"/docs/features/provider-orchestration","content":"Provider Orchestration Brain\n\nThe orchestration engine introduced in 7.42.0 pairs a task classifier with a provider/model router. When enabled, NeuroLink inspects each prompt, chooses the most suitable provider/model based on capabilities and availability, and carries that preference through the fallback chain.\n\nHighlights\nBinary task classifier – categorises prompts (analysis vs. creative, etc.) before routing.\nModel router – selects provider/model pairs, honouring local providers like Ollama when available.\nProvider validation – confirms credentials/availability before committing to the route.\nNon-invasive – orchestration augments requests via context so standard fallback logic still applies.\n\nEnabling Orchestration (SDK)\nEnable orchestration for automatic provider/model selection\nTask classifier analyzes prompt to determine best provider\nLog routing decisions to analytics\nValidate routed provider meets quality expectations\nSee which provider/model was selected by the router\n\nThe router adds __orchestratedPreferredProvider to the request context so analytics and downstream logging capture routing decisions.\n\nTuning the Router\nEnvironment awareness – orchestration only routes to providers that pass hasProviderEnvVars, so missing API keys fall back gracefully.\nOllama detection – checks http://localhost:11434/api/tags to verify local models before selection.\nConfidence scores – ModelRouter.route returns confidence and reasoning. Enable debug logs (export NEUROLINK_DEBUG=true) to inspect decisions.\nManual overrides – specifying provider or model bypasses orchestration for that call.\n\nWorking with the CLI\n\nCLI sessions instantiate NeuroLink without orchestration by default. To experiment with the router from the CLI:\nRun Node.js one-liner from CLI\nEnable orchestration in SDK mode\nLet router select best provider for comparison task\nOutput selected provider and model\n\nFuture CLI releases will surface a --enable-orchestration flag; until then keep orchestration for SDK/server workloads.\n\nBest Practices\n\nEnable orchestration in development to understand routing patterns, then pin provider or model in production for predictable behavior. Orchestration is ideal for exploratory workflows; explicit selection ensures consistency in critical paths.\n\nThe default fallback order prioritizes self-hosted providers — LiteLLM and Ollama — before cloud providers. This avoids external API costs and rate limits during development. Ensure your local providers are running to take advantage of this local-first routing.\n\nPair orchestration with evaluation to verify the routed provider meets quality expectations.\nMaintain provider credentials for all potential routes; orchestration skips providers missing keys.\nMonitor debug logs in staging to understand how tasks map to providers before rolling out widely.\nCombine with regional controls (region option) when routing to cloud-specific providers such as Vertex or Bedrock.\n\nTroubleshooting\n\n| Symptom | Action |\n| ----------------------------------- | -------------------------------------------------------------------------------------------------- |\n| Router always returns empty context | Ensure enableOrchestration: true and prompts contain text. |\n| Routed provider never used | Check credentials via neurolink status; orchestration only hints the preferred provider. |\n| Ollama route ignored | Confirm Ollama server running at http://localhost:11434 and model tag matches router suggestion. |\n| Fallback cycles between providers | Pin provider/model explicitly or reduce orchestrated confidence thresholds (see ModelRouter). |\n\nModelPool — failover with per-member cooldown\n\nOrchestration above hints a provider. ModelPool is the separate, explicit\nmechanism that owns selection: you hand it an ordered list of\nprovider/model/region members and it tries them in turn, taking a failed member\nout of rotation for a while rather than retrying it on every call.\n\nFile: src/lib/routing/modelPool.ts · Types: src/lib/types/modelPool.ts\n\nstrategy picks among the members that are currently available: priority\nalways takes the first, round-robin rotates, weighted prefers higher\nweight.\n\nCooldown is classified, not uniform\n\nA failure is classified into a ProviderErrorClass — rate_limit, auth,\ncontext_window, server, network, unknown — and the class decides how\nlong the member sits out:\n\n| Class
|
|
3738
|
+
{"objectID":"3b5d0122d0762f5202d83a9db0e7430a5ae248ba21c1277692dc84d45ff346bf","title":"Provider Orchestration Brain","url":"/docs/features/provider-orchestration","content":"Provider Orchestration Brain\n\nThe orchestration engine introduced in 7.42.0 pairs a task classifier with a provider/model router. When enabled, NeuroLink inspects each prompt, chooses the most suitable provider/model based on capabilities and availability, and carries that preference through the fallback chain.\n\nHighlights\nBinary task classifier – categorises prompts (analysis vs. creative, etc.) before routing.\nModel router – selects provider/model pairs, honouring local providers like Ollama when available.\nProvider validation – confirms credentials/availability before committing to the route.\nNon-invasive – orchestration augments requests via context so standard fallback logic still applies.\n\nEnabling Orchestration (SDK)\nEnable orchestration for automatic provider/model selection\nTask classifier analyzes prompt to determine best provider\nLog routing decisions to analytics\nValidate routed provider meets quality expectations\nSee which provider/model was selected by the router\n\nThe router adds __orchestratedPreferredProvider to the request context so analytics and downstream logging capture routing decisions.\n\nTuning the Router\nEnvironment awareness – orchestration only routes to providers that pass hasProviderEnvVars, so missing API keys fall back gracefully.\nOllama detection – checks http://localhost:11434/api/tags to verify local models before selection.\nConfidence scores – ModelRouter.route returns confidence and reasoning. Enable debug logs (export NEUROLINK_DEBUG=true) to inspect decisions.\nManual overrides – specifying provider or model bypasses orchestration for that call.\n\nWorking with the CLI\n\nCLI sessions instantiate NeuroLink without orchestration by default. To experiment with the router from the CLI:\nRun Node.js one-liner from CLI\nEnable orchestration in SDK mode\nLet router select best provider for comparison task\nOutput selected provider and model\n\nFuture CLI releases will surface a --enable-orchestration flag; until then keep orchestration for SDK/server workloads.\n\nBest Practices\n\nEnable orchestration in development to understand routing patterns, then pin provider or model in production for predictable behavior. Orchestration is ideal for exploratory workflows; explicit selection ensures consistency in critical paths.\n\nThe default fallback order prioritizes self-hosted providers — LiteLLM and Ollama — before cloud providers. This avoids external API costs and rate limits during development. Ensure your local providers are running to take advantage of this local-first routing.\n\nPair orchestration with evaluation to verify the routed provider meets quality expectations.\nMaintain provider credentials for all potential routes; orchestration skips providers missing keys.\nMonitor debug logs in staging to understand how tasks map to providers before rolling out widely.\nCombine with regional controls (region option) when routing to cloud-specific providers such as Vertex or Bedrock.\n\nTroubleshooting\n\n| Symptom | Action |\n| ----------------------------------- | -------------------------------------------------------------------------------------------------- |\n| Router always returns empty context | Ensure enableOrchestration: true and prompts contain text. |\n| Routed provider never used | Check credentials via neurolink status; orchestration only hints the preferred provider. |\n| Ollama route ignored | Confirm Ollama server running at http://localhost:11434 and model tag matches router suggestion. |\n| Fallback cycles between providers | Pin provider/model explicitly or reduce orchestrated confidence thresholds (see ModelRouter). |\n\nModelPool — failover with per-member cooldown\n\nOrchestration above hints a provider. ModelPool is the separate, explicit\nmechanism that owns selection: you hand it an ordered list of\nprovider/model/region members and it tries them in turn, taking a failed member\nout of rotation for a while rather than retrying it on every call.\n\nFile: src/lib/routing/modelPool.ts · Types: src/lib/types/modelPool.ts\n\nstrategy picks among the members that are currently available: priority\nalways takes the first, round-robin rotates, weighted prefers higher\nweight.\n\nCooldown is classified, not uniform\n\nA failure is classified into a ProviderErrorClass — rate_limit, auth,\ncontext_window, server, network, unknown — and the class decides how\nlong the member sits out:\n\n| Class | Cooldown |\n| ---------------------------------------------------- | ------------------------------ |\n| rate_limit, auth, server, network, unknown | cooldownMs (default 60s) |\n| context_window | None; request-scoped error |\n\nAn auth failure may come from credentials supplied for one call, so the member\nbecomes eligible ag","hierarchy":{"lvl0":"Features","lvl1":"Provider Orchestration Brain","lvl2":"","lvl3":""}},
|
|
3739
3739
|
{"objectID":"4f317fa66a6678bfaf848dc5b575809a95b82ded04ae00dab6cb107a05d97723","title":"Provider Orchestration Brain","url":"/docs/features/provider-orchestration#provider-orchestration-brain","content":"The orchestration engine introduced in 7.42.0 pairs a task classifier with a provider/model router. When enabled, NeuroLink inspects each prompt, chooses the most suitable provider/model based on capabilities and availability, and carries that preference through the fallback chain.","hierarchy":{"lvl0":"Features","lvl1":"Provider Orchestration Brain","lvl2":"Provider Orchestration Brain","lvl3":""}},
|
|
3740
3740
|
{"objectID":"bad00a4fdf2c1282d34f035fbae43b10d1cb83f5a5ebc20a6496dfeadf76f6c3","title":"Highlights","url":"/docs/features/provider-orchestration#highlights","content":"Binary task classifier – categorises prompts (analysis vs. creative, etc.) before routing.\nModel router – selects provider/model pairs, honouring local providers like Ollama when available.\nProvider validation – confirms credentials/availability before committing to the route.\nNon-invasive – orchestration augments requests via context so standard fallback logic still applies.","hierarchy":{"lvl0":"Features","lvl1":"Provider Orchestration Brain","lvl2":"Highlights","lvl3":""}},
|
|
3741
3741
|
{"objectID":"7cc7c82f69d5facc285eec0da2371475dd19e2b49cadd29bf39ddec3b00e07a1","title":"Enabling Orchestration (SDK)","url":"/docs/features/provider-orchestration#enabling-orchestration-sdk","content":"Enable orchestration for automatic provider/model selection\nTask classifier analyzes prompt to determine best provider\nLog routing decisions to analytics\nValidate routed provider meets quality expectations\nSee which provider/model was selected by the router\n\nThe router adds __orchestratedPreferredProvider to the request context so analytics and downstream logging capture routing decisions.","hierarchy":{"lvl0":"Features","lvl1":"Provider Orchestration Brain","lvl2":"Enabling Orchestration (SDK)","lvl3":""}},
|
|
@@ -3744,7 +3744,7 @@
|
|
|
3744
3744
|
{"objectID":"1545454fa4a70dc964cc0627bc182227bf8b8db112855909bab614de3bb1885f","title":"Best Practices","url":"/docs/features/provider-orchestration#best-practices","content":"Enable orchestration in development to understand routing patterns, then pin provider or model in production for predictable behavior. Orchestration is ideal for exploratory workflows; explicit selection ensures consistency in critical paths.\n\nThe default fallback order prioritizes self-hosted providers — LiteLLM and Ollama — before cloud providers. This avoids external API costs and rate limits during development. Ensure your local providers are running to take advantage of this local-first routing.\n\nPair orchestration with evaluation to verify the routed provider meets quality expectations.\nMaintain provider credentials for all potential routes; orchestration skips providers missing keys.\nMonitor debug logs in staging to understand how tasks map to providers before rolling out widely.\nCombine with regional controls (region option) when routing to cloud-specific providers such as Vertex or Bedrock.","hierarchy":{"lvl0":"Features","lvl1":"Provider Orchestration Brain","lvl2":"Best Practices","lvl3":""}},
|
|
3745
3745
|
{"objectID":"2b5d0e24f33d5a81843688f39e754fdc8bb877de4e1a182d2c5626e3f76abe8a","title":"Troubleshooting","url":"/docs/features/provider-orchestration#troubleshooting","content":"| Symptom | Action |\n| ----------------------------------- | -------------------------------------------------------------------------------------------------- |\n| Router always returns empty context | Ensure enableOrchestration: true and prompts contain text. |\n| Routed provider never used | Check credentials via neurolink status; orchestration only hints the preferred provider. |\n| Ollama route ignored | Confirm Ollama server running at http://localhost:11434 and model tag matches router suggestion. |\n| Fallback cycles between providers | Pin provider/model explicitly or reduce orchestrated confidence thresholds (see ModelRouter). |","hierarchy":{"lvl0":"Features","lvl1":"Provider Orchestration Brain","lvl2":"Troubleshooting","lvl3":""}},
|
|
3746
3746
|
{"objectID":"b513b3c39e1600f86ecfca6b0b756edeaa173c0050da6e3d2c3dc54fca5e724a","title":"ModelPool — failover with per-member cooldown","url":"/docs/features/provider-orchestration#modelpool-failover-with-per-member-cooldown","content":"Orchestration above hints a provider. ModelPool is the separate, explicit\nmechanism that owns selection: you hand it an ordered list of\nprovider/model/region members and it tries them in turn, taking a failed member\nout of rotation for a while rather than retrying it on every call.\n\nFile: src/lib/routing/modelPool.ts · Types: src/lib/types/modelPool.ts\n\nstrategy picks among the members that are currently available: priority\nalways takes the first, round-robin rotates, weighted prefers higher\nweight.","hierarchy":{"lvl0":"Features","lvl1":"Provider Orchestration Brain","lvl2":"ModelPool — failover with per-member cooldown","lvl3":""}},
|
|
3747
|
-
{"objectID":"3b11b24a4c9a09b6b95686ff5369869b947d9bfdbf532e7034b3e3f863f24e11","title":"Cooldown is classified, not uniform","url":"/docs/features/provider-orchestration#cooldown-is-classified-not-uniform","content":"A failure is classified into a ProviderErrorClass — rate_limit, auth,\ncontext_window, server, network, unknown — and the class decides how\nlong the member sits out:\n\n| Class
|
|
3747
|
+
{"objectID":"3b11b24a4c9a09b6b95686ff5369869b947d9bfdbf532e7034b3e3f863f24e11","title":"Cooldown is classified, not uniform","url":"/docs/features/provider-orchestration#cooldown-is-classified-not-uniform","content":"A failure is classified into a ProviderErrorClass — rate_limit, auth,\ncontext_window, server, network, unknown — and the class decides how\nlong the member sits out:\n\n| Class | Cooldown |\n| ---------------------------------------------------- | ------------------------------ |\n| rate_limit, auth, server, network, unknown | cooldownMs (default 60s) |\n| context_window | None; request-scoped error |\n\nAn auth failure may come from credentials supplied for one call, so the member\nbecomes eligible again after the configured cooldown. A context-window error\ndepends on the request size: the current call can fail or try another member,\nbut later calls can still use the model. The pool's per-call exclusion set\nprevents an immediate retry of the same member for that request.\n\nThe context budget and\nmodel catalogue still avoid sending\nrequests that exceed a model's window. A larger threshold could fail the\ncurrent request; it does not retire the member for later requests.","hierarchy":{"lvl0":"Features","lvl1":"Provider Orchestration Brain","lvl2":"Cooldown is classified, not uniform","lvl3":""}},
|
|
3748
3748
|
{"objectID":"d5c7e3ad322e8452031c096403fe688555d2106f1a84816b09e5276850a28d91","title":"A configured pool disables the classifier router","url":"/docs/features/provider-orchestration#a-configured-pool-disables-the-classifier-router","content":"The classifier router is skipped entirely\nwhen a modelPool is configured, because the two would otherwise both claim\nthe right to choose a model. The pool wins: it is the explicit, host-declared\nstatement, and it is the one carrying failover state. A host that wants\nper-request routing should use the classifier router's own pool rather than a\nModelPool.","hierarchy":{"lvl0":"Features","lvl1":"Provider Orchestration Brain","lvl2":"A configured pool disables the classifier router","lvl3":""}},
|
|
3749
3749
|
{"objectID":"de5c406fe2aa8ec1da41c7f179857880b2e74ef1fe05691fbb63efebdacac3cd","title":"Dive Deeper","url":"/docs/features/provider-orchestration#dive-deeper","content":"Code reference: src/lib/utils/modelRouter.ts\nCode reference: src/lib/utils/taskClassifier.ts\nCode reference: src/lib/routing/modelPool.ts\nClassifier Router — per-request model selection\nProvider Fallback\ndocs/advanced/analytics.md for logging orchestration metadata.","hierarchy":{"lvl0":"Features","lvl1":"Provider Orchestration Brain","lvl2":"Dive Deeper","lvl3":""}},
|
|
3750
3750
|
{"objectID":"280f65232d644ee2663a8864b5d8e95eba74208c53a429db5fcac1f0c48e6d4a","title":"`GET /accounts` — one row per account","url":"/docs/features/proxy-accounts-endpoint","content":"GET /accounts — one row per account\n\nWhat it is for\n\nAnswering \"which of my accounts can still take work?\" used to need two calls\nwhose schemas do not line up:\n/status returns six rows here — three real logins plus proxy/internal\n and two translation pseudo-accounts — with request and error counters, and\n no quota.\n/limits returns three rows, only the real logins, with quota and no\n counters.\n\nEvery consumer therefore reimplemented the same merge, discarded the plumbing\nrows by hand, and drifted whenever the proxy's internals moved. /accounts\ndoes the join once, server-side, and adds the thing neither endpoint had:\nper-account token totals and cost.\n\nResponse\n\ncostBasis: \"api-equivalent\" is not a bill\n\nPooled OAuth accounts bill by subscription. costUsd is what the recorded\ntokens would have cost at published per-token rates — useful for judging\nwhether a subscription is earning its keep, and for spotting a runaway account.\nIt is not an invoice, and a consumer that renders it as one is wrong. On this\nmachine it reads roughly $900/day, which is alarming without that framing.\n\nunpricedModels names any model with no pricing row, so a $0 contribution is\nvisible rather than silent.\n\nQuery parameters\n\n| Param | Default | Meaning |\n| --------- | ------- | ------------------------------------------------------------ |\n| refresh | false | true forces a live quota fetch from Anthropic's usage API. |\n\nThe default is deliberate. A live refresh spends the user's own OAuth\ncredentials upstream. This endpoint is built to be polled, so it reads the\nstored snapshot unless asked otherwise; a dashboard on a short interval must\nnot hammer Anthropic.\n\nNotes on individual fields\nallowed and expired are always null. Deriving them needs the token\n store, which /status reaches behind its own timeouts. cooling is the field\n an operator acts on and one small file read answers it, so that one is real.\n Use /status when you need the other two.\nstatus is derived, not passed through. /limits returns\n status: \"snapshot\", which describes how the quota was obtained rather than\n the account's health, and must not leak into a field consumers read as health.\nTimestamps. Upstream mixes units in one object: sessionResetAt,\n weeklyResetAt and windows[].resetsAt are unix seconds; lastUpdated,\n windows[].updatedAt and coolingUntil are milliseconds. Only the\n seconds fields get a *Ms companion; the rest pass through untouched.\n Blanket-multiplying the object would throw the millisecond fields tens of\n thousands of years forward.\nisPrimary marks the account the pool prefers, from the proxy's\n hot-reloaded routing config where one is set and the value it was constructed\n with otherwise. Keys compare normalised, so a bare label (me@example.com)\n and a full pool key (anthropic:me@example.com) match. It is false on\n internal and translation rows, which are not credentials and cannot be\n primary.\nseverity and isActive are absent on header-sourced overage windows —\n a structural property of how those rows are parsed, not a transient gap. This\n endpoint fills them (severity: \"critical\" when the window is rejected,\n isActive: false) so no consumer needs the branch.\n\nHow usage totals are computed\n\nsrc/lib/proxy/accountLedger.ts reads ~/.neurolink/logs/proxy-<date>.jsonl\nincrementally: one cursor per file, advanced only to the last complete newline.\nThe directory runs to hundreds of megabytes, so a re-read per request is not an\noption. Measured on a 930 MB directory: 40 ms cold, 1 ms warm.\n\nFour correctness rules the module exists to enforce:\nOnly proxy-<date>.jsonl. proxy-attempts-* carries one row per retry;\n folding it in multiplies a retried request's tokens by its retry count.\nFold by requestId, conditionally. A request is logged twice when a\n streamed body finishes and its token counts arrive late — the Codex engine\n does exactly this. Totals derive from a requestId-keyed map, never a sum of\n lines. The fold is NOT unconditional deduplication: two lines merge only\n when the earlier one carries no usage. requestId can come from a\n client-supplied X-Request-ID and nothing enforces uniqueness, so two\n genuinely distinct usage-bearing requests that share an id are counted\n separately. A consumer that dedupes on id alone will undercount — see the\n fuller explanation below.\nFilter by engine. The log is shared with the Codex pool, and an operator\n can use the same email for both. Without the filter, ChatGPT tokens land on\n the Anthropic row and get priced at the wrong vendor's rates.\nNever build the row set from the log. An account that served no traffic\n today would vanish — precisely when you most want to see it, because it is\n probably cooling or exhausted.\n\nA deleted file (retention) freezes its totals rather than dropping them; a file\nthat shrank was deleted and recreated, so the cursor resets.\n\nRow kinds and what they mean\n\nkind says what a row actually","hierarchy":{"lvl0":"Features","lvl1":"`GET /accounts` — one row per account","lvl2":"","lvl3":""}},
|
|
@@ -4041,7 +4041,7 @@
|
|
|
4041
4041
|
{"objectID":"b09d53aab5231e5f44f2c4df7a1d0cbf1c3f6e07ac586dfe8294eca0948441b1","title":"CLI Equivalent","url":"/docs/features/task-manager#cli-equivalent","content":"CLI Equivalent","hierarchy":{"lvl0":"Features","lvl1":"TaskManager - Scheduled & Self-Running Tasks","lvl2":"CLI Equivalent","lvl3":""}},
|
|
4042
4042
|
{"objectID":"1ed0cf5cb87ec5d23bf366e3b3d3c81407802f490fb50d3fef44230ef5c3fc6f","title":"Existing Code Impact","url":"/docs/features/task-manager#existing-code-impact","content":"TaskManager is implemented as a new module (src/lib/tasks/). Minimal changes to existing code:\n\n| Existing File | Change | Lines |\n| ------------------------------ | ----------------------------------- | ----- |\n| src/lib/neurolink.ts | Add tasks getter property | ~10 |\n| src/lib/types/index.ts | Re-export task types | ~2 |\n| src/lib/agent/directTools.ts | Import and spread task tools | ~3 |\n| src/cli/index.ts | Register task CLI command | ~1 |\n| package.json | Add bullmq, croner dependencies | ~2 |\n\nEverything else is new files in src/lib/tasks/. No refactoring, no restructuring of existing code.","hierarchy":{"lvl0":"Features","lvl1":"TaskManager - Scheduled & Self-Running Tasks","lvl2":"Existing Code Impact","lvl3":""}},
|
|
4043
4043
|
{"objectID":"e937a3f76bbe1a5494c610c87139c64ed299320dc8364078c0849a6231a023b8","title":"FAQ","url":"/docs/features/task-manager#faq","content":"Q: Do I need Redis to use TaskManager?\nA: No. Set backend: \"node-timeout\" for a zero-dependency setup. Redis is only required for the BullMQ backend (the default). When using BullMQ, Redis stores both job scheduling state and task definitions/run logs — no file I/O at all.\n\nQ: Will tasks stay in Redis forever?\nA: No. Active/paused tasks persist as long as they're running. Once a task reaches a terminal state (completed, failed, cancelled), it auto-expires based on taskRetention config — defaults: 30 days for completed, 7 days for failed/cancelled. Run logs are capped at maxRunLogs (default 2000) per task via LTRIM, and individual entries can have a TTL. You can also manually delete tasks via tasks.delete() or neurolink task delete.\n\nQ: Can the AI schedule tasks without user intervention?\nA: Yes. The built-in createTask tool allows the AI to self-schedule tasks during any conversation. If HITL is enabled, the user will be prompted for approval.\n\nQ: How does continuation mode handle growing context?\nA: It uses NeuroLink's existing context compaction system. When conversation history exceeds the model's context budget, BudgetChecker triggers automatic summarization.\n\nQ: Can I use TaskManager in a serverless environment?\nA: The BullMQ backend works in serverless with a persistent Redis instance — no local filesystem needed. The NodeTimeout backend requires a long-running process with filesystem access.\n\nQ: What happens when I switch backends?\nA: Tasks stored in Redis (BullMQ) and tasks stored on disk (NodeTimeout) are independent. Switching backends does not migrate data. If you need to migrate, use tasks.list() on the old backend and tasks.create() on the new one.\n\nQ: How do I monitor task health?\nA: Use neurolink.tasks.list() / neurolink task list for status overview, neurolink.tasks.runs(taskId) / neurolink task logs <id> for run history, and subscribe to task:* events for real-time monitoring.","hierarchy":{"lvl0":"Features","lvl1":"TaskManager - Scheduled & Self-Running Tasks","lvl2":"FAQ","lvl3":""}},
|
|
4044
|
-
{"objectID":"5597f3996aaaa278b6fc9cb9310ea7f35b65373b35043abf05f0b33ebe8d5d82","title":"Extended Thinking Configuration","url":"/docs/features/thinking-configuration","content":"Extended Thinking Configuration\n\nEnable extended thinking/reasoning modes for AI models that support deeper reasoning capabilities. This feature allows models to \"think through\" complex problems before providing a response.\n\nOverview\n\nNeuroLink supports extended thinking/reasoning configuration for models that provide this capability. Extended thinking enables models to perform more thorough reasoning, particularly useful for complex tasks like mathematical proofs, coding problems, and multi-step analysis.\n\nSupported Models\n\nGemini 3 Models (Google Vertex AI / AI Studio)\ngemini-3.1-pro - Full thinking support with high token budgets (up to 100,000)\ngemini-3-flash-preview - Fast thinking with support for \"minimal\" level (up to 50,000)\n\nGemini 2.5 Models (Google Vertex AI / AI Studio)\ngemini-2.5-pro - Supports thinking configuration (up to 32,000 tokens)\ngemini-2.5-flash - Supports thinking configuration (up to 32,000 tokens)\n\nClaude Models (Anthropic)\n\nAll Claude 4.0+ models support extended thinking via budget tokens:\nclaude-sonnet-4-20250514 (Claude Sonnet 4)\nclaude-opus-4-20250514 (Claude Opus 4)\nclaude-opus-4-1-20250805 (Claude Opus 4.1)\nclaude-sonnet-4-5-20250929 (Claude Sonnet 4.5)\nclaude-opus-4-5-20251101 (Claude Opus 4.5)\nclaude-haiku-4-5-20251001 (Claude Haiku 4.5)\nclaude-sonnet-4-6 (Claude Sonnet 4.6)\nclaude-opus-4-6 (Claude Opus 4.6)\n\nQuick Start\n\nGemini 3 Thinking Configuration\n\nFor Gemini 3 models, use thinkingLevel to control reasoning depth:\n\nThinking Levels\n\n| Level | Description | Best For |\n| --------- | -------------------------------------- | ------------------------------- |\n| minimal | Near-zero thinking (Flash models only) | Simple queries requiring speed |\n| low | Fast reasoning for simple tasks | Quick analysis, summaries |\n| medium | Balanced reasoning/latency trade-off | General-purpose tasks |\n| high | Maximum reasoning depth | Complex reasoning, math, coding |\n\nMaximum Token Budgets by Model\n\n| Model | Max Thinking Budget |\n| --------------------- | ------------------- |\n| gemini-3-pro-* | 100,000 tokens |\n| gemini-3-flash-* | 50,000 tokens |\n| gemini-2.5-* | 32,000 tokens |\n| claude-opus-4-6 | 100,000 tokens |\n| claude-sonnet-4-6 | 100,000 tokens |\n| claude-opus-4-5-* | 100,000 tokens |\n| claude-sonnet-4-5-* | 100,000 tokens |\n| claude-haiku-4-5-* | 100,000 tokens |\n| claude-opus-4-1-* | 100,000 tokens |\n| claude-opus-4-* | 100,000 tokens |\n| claude-sonnet-4-* | 100,000 tokens |\n\nAnthropic Claude Thinking Configuration\n\nFor Claude models, use budgetTokens to set the thinking token budget:\n\nBudget Token Guidelines\nMinimum: 5,000 tokens\nMaximum: 100,000 tokens\nRecommended for simple tasks: 5,000-10,000 tokens\nRecommended for complex reasoning: 20,000-50,000 tokens\nMaximum depth: 50,000-100,000 tokens\n\nTurning thinking off\n\nSome Claude models, claude-sonnet-5 among them, think before answering even when\nno thinkingConfig is given, and that thinking counts against the request's\nmax_tokens. To turn it off for a call, pass type: \"disabled\":\n\nNeuroLink sends thinking: { type: \"disabled\" } on both generate() and\nstream(). Turning thinking off does not change which sampling parameters a\nmodel accepts. On a model that takes a temperature, NeuroLink still sends it\nwith thinking disabled; it is dropped only while thinking is on. Some models,\nclaude-sonnet-5 among them, do not accept a temperature at all, and NeuroLink\nleaves it off for them whatever the thinking setting.\n\nenabled: false, or no thinkingConfig at all, sends nothing, so the model's own\ndefault applies. If enabled: true and budgetTokens are also set, thinking is\nenabled, as before.\n\
|
|
4044
|
+
{"objectID":"5597f3996aaaa278b6fc9cb9310ea7f35b65373b35043abf05f0b33ebe8d5d82","title":"Extended Thinking Configuration","url":"/docs/features/thinking-configuration","content":"Extended Thinking Configuration\n\nEnable extended thinking/reasoning modes for AI models that support deeper reasoning capabilities. This feature allows models to \"think through\" complex problems before providing a response.\n\nOverview\n\nNeuroLink supports extended thinking/reasoning configuration for models that provide this capability. Extended thinking enables models to perform more thorough reasoning, particularly useful for complex tasks like mathematical proofs, coding problems, and multi-step analysis.\n\nSupported Models\n\nGemini 3 Models (Google Vertex AI / AI Studio)\ngemini-3.1-pro - Full thinking support with high token budgets (up to 100,000)\ngemini-3-flash-preview - Fast thinking with support for \"minimal\" level (up to 50,000)\n\nGemini 2.5 Models (Google Vertex AI / AI Studio)\ngemini-2.5-pro - Supports thinking configuration (up to 32,000 tokens)\ngemini-2.5-flash - Supports thinking configuration (up to 32,000 tokens)\n\nClaude Models (Anthropic)\n\nAll Claude 4.0+ models support extended thinking via budget tokens:\nclaude-sonnet-4-20250514 (Claude Sonnet 4)\nclaude-opus-4-20250514 (Claude Opus 4)\nclaude-opus-4-1-20250805 (Claude Opus 4.1)\nclaude-sonnet-4-5-20250929 (Claude Sonnet 4.5)\nclaude-opus-4-5-20251101 (Claude Opus 4.5)\nclaude-haiku-4-5-20251001 (Claude Haiku 4.5)\nclaude-sonnet-4-6 (Claude Sonnet 4.6)\nclaude-opus-4-6 (Claude Opus 4.6)\n\nQuick Start\n\nGemini 3 Thinking Configuration\n\nFor Gemini 3 models, use thinkingLevel to control reasoning depth:\n\nThinking Levels\n\n| Level | Description | Best For |\n| --------- | -------------------------------------- | ------------------------------- |\n| minimal | Near-zero thinking (Flash models only) | Simple queries requiring speed |\n| low | Fast reasoning for simple tasks | Quick analysis, summaries |\n| medium | Balanced reasoning/latency trade-off | General-purpose tasks |\n| high | Maximum reasoning depth | Complex reasoning, math, coding |\n\nMaximum Token Budgets by Model\n\n| Model | Max Thinking Budget |\n| --------------------- | ------------------- |\n| gemini-3-pro-* | 100,000 tokens |\n| gemini-3-flash-* | 50,000 tokens |\n| gemini-2.5-* | 32,000 tokens |\n| claude-opus-4-6 | 100,000 tokens |\n| claude-sonnet-4-6 | 100,000 tokens |\n| claude-opus-4-5-* | 100,000 tokens |\n| claude-sonnet-4-5-* | 100,000 tokens |\n| claude-haiku-4-5-* | 100,000 tokens |\n| claude-opus-4-1-* | 100,000 tokens |\n| claude-opus-4-* | 100,000 tokens |\n| claude-sonnet-4-* | 100,000 tokens |\n\nAnthropic Claude Thinking Configuration\n\nFor Claude models, use budgetTokens to set the thinking token budget:\n\nBudget Token Guidelines\nMinimum: 5,000 tokens\nMaximum: 100,000 tokens\nRecommended for simple tasks: 5,000-10,000 tokens\nRecommended for complex reasoning: 20,000-50,000 tokens\nMaximum depth: 50,000-100,000 tokens\n\nTurning thinking off\n\nSome Claude models, claude-sonnet-5 among them, think before answering even when\nno thinkingConfig is given, and that thinking counts against the request's\nmax_tokens. To turn it off for a call, pass type: \"disabled\":\n\nNeuroLink sends thinking: { type: \"disabled\" } on both generate() and\nstream(). Turning thinking off does not change which sampling parameters a\nmodel accepts. On a model that takes a temperature, NeuroLink still sends it\nwith thinking disabled; it is dropped only while thinking is on. Some models,\nclaude-sonnet-5 among them, do not accept a temperature at all, and NeuroLink\nleaves it off for them whatever the thinking setting.\n\nenabled: false, or no thinkingConfig at all, sends nothing, so the model's own\ndefault applies. If enabled: true and budgetTokens are also set, thinking is\nenabled, as before.\n\nWhen thinking is left off a request\n\nAnthropic rejects some requests that carry thinking, so on the anthropic\nprovider NeuroLink drops the thinking block from those requests and logs a\nwarning, instead of sending a request that would fail with a 400. (Claude on\nvertex does the same for generate({ schema }) and caps the budget the same\nway.)\n\nDropping the block is not the same as type: \"disabled\". The request then\ncarries no thinking field, so the model's own default applies, as described\nin Turning thinking off: a model that thinks by\ndefault may still think. NeuroLink never sends type: \"disabled\" in place of a\nbudget you asked for.\nA forced tool choice. toolChoice: \"required\", a named tool, a choice\n forced on a step by prepareStep or toolChoiceSteps, and generate({ schema })\n without tools (which forces a JSON tool) all force tool use, and Anthropic does\n not allow thinking with that. \"auto\" and \"none\" keep thinking.\nThe rest of a tool turn that started without thinking. Thinking cannot\n start partway through a tool call. While the last assistant message calls a\n tool and does not open with a thinking block, the block stays off, including","hierarchy":{"lvl0":"Features","lvl1":"Extended Thinking Configuration","lvl2":"","lvl3":""}},
|
|
4045
4045
|
{"objectID":"b1a3fc87278e92aa39a0271b6f2eb465b62008b51d064acce63cf3af3f5c9673","title":"Extended Thinking Configuration","url":"/docs/features/thinking-configuration#extended-thinking-configuration","content":"Enable extended thinking/reasoning modes for AI models that support deeper reasoning capabilities. This feature allows models to \"think through\" complex problems before providing a response.","hierarchy":{"lvl0":"Features","lvl1":"Extended Thinking Configuration","lvl2":"Extended Thinking Configuration","lvl3":""}},
|
|
4046
4046
|
{"objectID":"5e898a7f44534e174e959788be122e3ba4d1ee14def3b6214209393edf08cbae","title":"Overview","url":"/docs/features/thinking-configuration#overview","content":"NeuroLink supports extended thinking/reasoning configuration for models that provide this capability. Extended thinking enables models to perform more thorough reasoning, particularly useful for complex tasks like mathematical proofs, coding problems, and multi-step analysis.","hierarchy":{"lvl0":"Features","lvl1":"Extended Thinking Configuration","lvl2":"Overview","lvl3":""}},
|
|
4047
4047
|
{"objectID":"3c3340ac962c9488fd2f05b80b29b47a3a272754a135742aa678ed7dc1845462","title":"Gemini 3 Models (Google Vertex AI / AI Studio)","url":"/docs/features/thinking-configuration#gemini-3-models-google-vertex-ai-ai-studio","content":"gemini-3.1-pro - Full thinking support with high token budgets (up to 100,000)\ngemini-3-flash-preview - Fast thinking with support for \"minimal\" level (up to 50,000)","hierarchy":{"lvl0":"Features","lvl1":"Extended Thinking Configuration","lvl2":"Gemini 3 Models (Google Vertex AI / AI Studio)","lvl3":""}},
|
|
@@ -4054,6 +4054,7 @@
|
|
|
4054
4054
|
{"objectID":"a1b9be5a0a0a16cff259e6051df668ddc07f75a6ae77ebba4121f649746eb25e","title":"Anthropic Claude Thinking Configuration","url":"/docs/features/thinking-configuration#anthropic-claude-thinking-configuration","content":"For Claude models, use budgetTokens to set the thinking token budget:","hierarchy":{"lvl0":"Features","lvl1":"Extended Thinking Configuration","lvl2":"Anthropic Claude Thinking Configuration","lvl3":""}},
|
|
4055
4055
|
{"objectID":"942ce04a601afc6269d1765ad4da7295a802070a5b036c93dd360e92478e3be3","title":"Budget Token Guidelines","url":"/docs/features/thinking-configuration#budget-token-guidelines","content":"Minimum: 5,000 tokens\nMaximum: 100,000 tokens\nRecommended for simple tasks: 5,000-10,000 tokens\nRecommended for complex reasoning: 20,000-50,000 tokens\nMaximum depth: 50,000-100,000 tokens","hierarchy":{"lvl0":"Features","lvl1":"Extended Thinking Configuration","lvl2":"Budget Token Guidelines","lvl3":""}},
|
|
4056
4056
|
{"objectID":"43d4815c3e1af5de7858131d9b25bcf7e59ef2dee4327c46cf613cbdd0f704d9","title":"Turning thinking off","url":"/docs/features/thinking-configuration#turning-thinking-off","content":"Some Claude models, claude-sonnet-5 among them, think before answering even when\nno thinkingConfig is given, and that thinking counts against the request's\nmax_tokens. To turn it off for a call, pass type: \"disabled\":\n\nNeuroLink sends thinking: { type: \"disabled\" } on both generate() and\nstream(). Turning thinking off does not change which sampling parameters a\nmodel accepts. On a model that takes a temperature, NeuroLink still sends it\nwith thinking disabled; it is dropped only while thinking is on. Some models,\nclaude-sonnet-5 among them, do not accept a temperature at all, and NeuroLink\nleaves it off for them whatever the thinking setting.\n\nenabled: false, or no thinkingConfig at all, sends nothing, so the model's own\ndefault applies. If enabled: true and budgetTokens are also set, thinking is\nenabled, as before.","hierarchy":{"lvl0":"Features","lvl1":"Extended Thinking Configuration","lvl2":"Turning thinking off","lvl3":""}},
|
|
4057
|
+
{"objectID":"589e6cd4ac1d5c1827711b20f0b060ee0abc8a71533970a146c97fde65dc2672","title":"When thinking is left off a request","url":"/docs/features/thinking-configuration#when-thinking-is-left-off-a-request","content":"Anthropic rejects some requests that carry thinking, so on the anthropic\nprovider NeuroLink drops the thinking block from those requests and logs a\nwarning, instead of sending a request that would fail with a 400. (Claude on\nvertex does the same for generate({ schema }) and caps the budget the same\nway.)\n\nDropping the block is not the same as type: \"disabled\". The request then\ncarries no thinking field, so the model's own default applies, as described\nin Turning thinking off: a model that thinks by\ndefault may still think. NeuroLink never sends type: \"disabled\" in place of a\nbudget you asked for.\nA forced tool choice. toolChoice: \"required\", a named tool, a choice\n forced on a step by prepareStep or toolChoiceSteps, and generate({ schema })\n without tools (which forces a JSON tool) all force tool use, and Anthropic does\n not allow thinking with that. \"auto\" and \"none\" keep thinking.\nThe rest of a tool turn that started without thinking. Thinking cannot\n start partway through a tool call. While the last assistant message calls a\n tool and does not open with a thinking block, the block stays off, including\n when a new prompt follows tool results replayed from history. It comes back\n on the first request after the model answers without calling a tool.\nA budget that cannot fit. budgetTokens is capped at the request's\n maxTokens minus 1,024, which leaves room for the answer. When that cap is\n under Anthropic's 1,024-token minimum, the block is dropped.\nA budget that is not a finite number. A budgetTokens of Infinity, a\n negative number or a non-number is dropped rather than sent. A fractional\n budget is rounded down.","hierarchy":{"lvl0":"Features","lvl1":"Extended Thinking Configuration","lvl2":"When thinking is left off a request","lvl3":""}},
|
|
4057
4058
|
{"objectID":"2b5576316a6208f5cfec1c81bc1e6fef5b0183103738313b707f4f56e5cfa57a","title":"Configuration Options","url":"/docs/features/thinking-configuration#configuration-options","content":"The thinkingConfig object supports the following options:","hierarchy":{"lvl0":"Features","lvl1":"Extended Thinking Configuration","lvl2":"Configuration Options","lvl3":""}},
|
|
4058
4059
|
{"objectID":"a8d5868d4d30b359f7c8882f700ef9b1930d1be223f54728849a4634314aa07f","title":"CLI Usage","url":"/docs/features/thinking-configuration#cli-usage","content":"Extended thinking is also available via the CLI:","hierarchy":{"lvl0":"Features","lvl1":"Extended Thinking Configuration","lvl2":"CLI Usage","lvl3":""}},
|
|
4059
4060
|
{"objectID":"dff15a38f63c9eaa7de8aea3b61211b551702585d6a3eacf6631abd0bf985805","title":"CLI Options","url":"/docs/features/thinking-configuration#cli-options","content":"| Option | Description | Default |\n| ------------------ | ----------------------------------------------------- | ------- |\n| --thinking | Enable extended thinking | false |\n| --thinkingBudget | Token budget (Anthropic: 5000-100000) | 10000 |\n| --thinkingLevel | Thinking level (Gemini 3: minimal, low, medium, high) | medium |","hierarchy":{"lvl0":"Features","lvl1":"Extended Thinking Configuration","lvl2":"CLI Options","lvl3":""}},
|
|
@@ -6860,7 +6861,7 @@
|
|
|
6860
6861
|
{"objectID":"227e33113855fae825493b60851693beeb2467f4f71008248886477e27fbbd27","title":"Streaming","url":"/docs/getting-started/providers/whistle#streaming","content":"Whistle streams natively. transcribeStream() takes PCM16LE mono frames (at\nsampleRate, default 16 kHz, any frame size), feeds the engine about a second\nat a time, and yields:\na final segment whenever the engine commits words (two consecutive\n passes agreed on them), with word timings measured from the start of the\n stream — join the finals with a space for the transcript;\nan interim segment carrying the unconfirmed tail whenever it changes.\n\nEach stream runs on a worker of its own, so it never interleaves with batch\ncalls on the same handler.","hierarchy":{"lvl0":"Getting Started","lvl1":"Whistle (Built-in Local STT)","lvl2":"Streaming","lvl3":""}},
|
|
6861
6862
|
{"objectID":"c292466ae8a0e9b28914ed9e6010c07ebb8425559e229ecdd1dfe36c352b0d89","title":"Audio formats","url":"/docs/getting-started/providers/whistle#audio-formats","content":"| Format | Decoded by |\n| --------------------------------------------------------------------- | -------------- |\n| WAV — 8/16/24/32-bit PCM, 32/64-bit float, any rate and channel count | Whistle itself |\n| raw pcm16 | Whistle itself |\n| mp3, m4a, mp4, ogg, opus, webm, flac, mpeg | ffmpeg |\n\nCompressed formats need ffmpeg: FFMPEG_PATH, the optional ffmpeg-static\npackage (pnpm add ffmpeg-static), or ffmpeg on PATH. Without one, the\ncall fails with an error that names the formats Whistle can read by itself.","hierarchy":{"lvl0":"Getting Started","lvl1":"Whistle (Built-in Local STT)","lvl2":"Audio formats","lvl3":""}},
|
|
6862
6863
|
{"objectID":"9429c5e0a71ffbdc447014b203905467c61b374d5583cb17a0e5cb90d96dcd93","title":"Environment variables","url":"/docs/getting-started/providers/whistle#environment-variables","content":"| Variable | Default | Meaning |\n| --------------------------------- | ------- | --------------------------------------------------------------- |\n| NEUROLINK_WHISTLE_DIR | — | Directory holding the three files |\n| NEUROLINK_MODEL_DIR | — | Parent directory for local models; Whistle uses <dir>/whistle |\n| NEUROLINK_WHISTLE_AUTO_DOWNLOAD | 1 | 0 forbids the first-use download |\n| NEUROLINK_WHISTLE_KEYWORDS | 0 | 1 enables keyword biasing from vocabulary |\n| FFMPEG_PATH | — | ffmpeg binary for compressed formats |","hierarchy":{"lvl0":"Getting Started","lvl1":"Whistle (Built-in Local STT)","lvl2":"Environment variables","lvl3":""}},
|
|
6863
|
-
{"objectID":"4b33ae49583501e03d79b64042c6a88b3e5272910a29161dcd353593af1a1424","title":"Runtime behaviour","url":"/docs/getting-started/providers/whistle#runtime-behaviour","content":"One warm worker thread per WhistleSTT instance holds the engine and the\n model (~0.2 s to start); requests are answered in order. The worker is\n unreferenced while idle, so it never keeps your process alive; call\n dispose() to stop it early.\nIf the worker crashes, the requests it held fail with an STTError, and the\n next call starts a fresh worker.","hierarchy":{"lvl0":"Getting Started","lvl1":"Whistle (Built-in Local STT)","lvl2":"Runtime behaviour","lvl3":""}},
|
|
6864
|
+
{"objectID":"4b33ae49583501e03d79b64042c6a88b3e5272910a29161dcd353593af1a1424","title":"Runtime behaviour","url":"/docs/getting-started/providers/whistle#runtime-behaviour","content":"One warm worker thread per WhistleSTT instance holds the engine and the\n model (~0.2 s to start); requests are answered in order. The worker is\n unreferenced while idle, so it never keeps your process alive; call\n dispose() to stop it early.\nA call that passes credentials.stt.whistle builds its own WhistleSTT; the\n SDK disposes it when the call ends. Only a handler you create or register\n yourself needs your dispose().\nIf the worker crashes, the requests it held fail with an STTError, and the\n next call starts a fresh worker.","hierarchy":{"lvl0":"Getting Started","lvl1":"Whistle (Built-in Local STT)","lvl2":"Runtime behaviour","lvl3":""}},
|
|
6864
6865
|
{"objectID":"4a9a4c2f798b0fcb3745e1c3d957b8e72b8ec103e51747d673f447ed1433e265","title":"Accuracy","url":"/docs/getting-started/providers/whistle#accuracy","content":"Whistle is a 17 MB model. It is accurate on clear speech in its seven\nlanguages, but it is noticeably behind cloud engines (Deepgram, ElevenLabs\nScribe, Google, Azure) and large Whisper-class models on accents,\nbackground noise, overlapping speakers, rare names and domain jargon, and it\ndoes not diarize. It is a sensible default for development, offline use and\nprivacy-sensitive audio; configure a cloud or self-hosted provider where\naccuracy matters, or add a dictionary and the correction layer of\ntranscribe().","hierarchy":{"lvl0":"Getting Started","lvl1":"Whistle (Built-in Local STT)","lvl2":"Accuracy","lvl3":""}},
|
|
6865
6866
|
{"objectID":"884ee0aaccf14df2941d0048aa7934768312271d2cfbd663d43599769dea63cc","title":"xAI Grok Provider Guide","url":"/docs/getting-started/providers/xai","content":"xAI Grok Provider Guide\n\nText + vision generation with the Grok family through a single API\n\nOverview\n\nxAI hosts Elon Musk's Grok family of models behind an OpenAI-compatible\nchat-completions endpoint. NeuroLink wraps api.x.ai/v1 so the same\ngenerate / stream contract used by every other provider works for Grok\nwithout translation.\ngrok-3 — flagship; best for complex reasoning, math, coding\ngrok-3-mini — faster + cheaper variant of Grok 3\ngrok-2-latest — previous flagship; still supported\ngrok-2-vision-latest — multimodal (text + images)\ngrok-beta — pre-release / experimental access\n\nKey Facts\nProtocol: OpenAI-compatible (/v1/chat/completions)\nDefault base URL: https://api.x.ai/v1\nDefault model: grok-3\nContext window: 131K tokens (32K on grok-2-vision-latest)\nVision: Yes — grok-2-vision-latest accepts image inputs\nStreaming: Supported\nTool calling: Supported\nReasoning trace: Not exposed (use Grok-3 for natively-strong reasoning)\n\nQuick Start\nGet an API Key\n\nSign up at https://console.x.ai/ and create an\nAPI key under API Keys.\nConfigure Environment\n\nAdd to your .env file:\nInstall NeuroLink\nGenerate Your First Response\n\nSupported Models\n\n| Model ID | Family | Context | Vision | Notes |\n| ---------------------- | ------------- | ------- | ------ | -------------------------- |\n| grok-3 | Grok 3 | 131K | No | Default; best reasoning |\n| grok-3-mini | Grok 3 Mini | 131K | No | Faster + cheaper Grok 3 |\n| grok-2-latest | Grok 2 | 131K | No | Previous flagship |\n| grok-2-vision-latest | Grok 2 Vision | 32K | Yes | Multimodal text + image |\n| grok-beta | Beta | 131K | No | Pre-release / experimental |\n\nPass any model ID via --model (CLI) or model: (SDK).\n\nSDK Usage\n\nBasic Generation\n\nVision Input (Grok 2 Vision)\n\nStreaming\n\nTool Calling\n\nPer-Call Credential Override\n\nCLI Usage\n\nBasic Commands\n\nProvider Aliases\n\n| Alias | Example |\n| ------ | ----------------- |\n| xai | --provider xai |\n| grok | --provider grok |\n\nConfiguration Reference\n\n| Environment Variable | Required | Default | Description |\n| -------------------- | -------- | --------------------- | ------------------------------- |\n| XAI_API_KEY | Yes | — | xAI API key |\n| XAI_MODEL | No | grok-3 | Default model to use |\n| XAI_BASE_URL | No | https://api.x.ai/v1 | Base URL (override for proxies) |\n\nFeature Support Matrix\n\n| Feature | grok-3 | grok-3-mini | grok-2-latest | grok-2-vision | grok-beta |\n| ----------------- | ------ | ----------- | ------------- | ------------- | --------- |\n| Text generation | Yes | Yes | Yes | Yes | Yes |\n| Streaming | Yes | Yes | Yes | Yes | Yes |\n| Tool calling | Yes | Yes | Yes | Yes | Yes |\n| Structured output | Yes | Yes | Yes | Yes | Yes |\n| Vision / images | No | No | No | Yes | No |\n| Embeddings | No | No | No | No | No |\n\nTroubleshooting\n\n\"Invalid xAI API key\"\n\nThe XAI_API_KEY is missing or incorrect.\n\nGet or rotate keys at https://console.x.ai/.\n\n\"xAI rate limit exceeded\"\n\nToo many requests in a short window. Implement exponential backoff or\nreduce concurrency. Free-tier limits are tight; consider upgrading at\nhttps://console.x.ai/.\n\n\"xAI account has insufficient quota\"\n\nTop up at https://console.x.ai/.\n\n\"Model not found\"\n\nUse one of the documented model IDs above. Custom fine-tunes are not\nexposed through the public API at this time.\n\nSee Also\nAdding a new LLM provider — internal reference for the integration pattern this provider follows\nDeepSeek Provider — sibling OpenAI-compat provider with reasoning models\nGroq Provider — sibling OpenAI-compat provider with sub-100ms inference\n\nNeed Help? Open a GitHub Discussion or issue.","hierarchy":{"lvl0":"Getting Started","lvl1":"xAI Grok Provider Guide","lvl2":"","lvl3":""}},
|
|
6866
6867
|
{"objectID":"f15e86375a87a665a10229f6826884c69484bcf7465db56c3c727ea4c881b1f0","title":"xAI Grok Provider Guide","url":"/docs/getting-started/providers/xai#xai-grok-provider-guide","content":"Text + vision generation with the Grok family through a single API","hierarchy":{"lvl0":"Getting Started","lvl1":"xAI Grok Provider Guide","lvl2":"xAI Grok Provider Guide","lvl3":""}},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "13.12.
|
|
3
|
+
"version": "13.12.5",
|
|
4
4
|
"packageManager": "pnpm@10.34.9+sha512.f49b5a8ea0fdedb44bb3c0c1d6575092a53c2950d95b7ad15df11f17974877a2de3a01c07e934e9b28ce716e51c09a94962c7306d09be2e1e4b18a8c8762fd32",
|
|
5
5
|
"description": "The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002/call) for routing, tool selection and context budgeting. MCP-native (4 transports), voice TTS/STT/realtime, RAG, agents, memory, compaction, 9 observability exporters. OpenAI · Anthropic · Gemini · Bedrock · Azure · Ollama · TypeSafe Jev and more.",
|
|
6
6
|
"author": {
|
|
@@ -111,6 +111,7 @@
|
|
|
111
111
|
"test:anthropic-streaming-retry": "pnpm exec tsx test/continuous-test-suite-anthropic-streaming-retry.ts",
|
|
112
112
|
"test:anthropic-silent-truncation": "pnpm exec tsx test/continuous-test-suite-anthropic-silent-truncation.ts",
|
|
113
113
|
"test:anthropic-thinking-disabled": "pnpm exec tsx test/continuous-test-suite-anthropic-thinking-disabled.ts",
|
|
114
|
+
"test:anthropic-thinking-forced-tool": "pnpm exec tsx test/continuous-test-suite-anthropic-thinking-forced-tool.ts",
|
|
114
115
|
"test:cache-cost-accounting": "pnpm exec tsx test/continuous-test-suite-cache-cost-accounting.ts",
|
|
115
116
|
"test:agent:cost": "pnpm exec tsx test/continuous-test-suite-agent-cost.ts",
|
|
116
117
|
"test:adjust-body-after-400": "pnpm exec tsx test/continuous-test-suite-adjust-body-after-400.ts",
|
|
@@ -665,7 +666,7 @@
|
|
|
665
666
|
"@semantic-release/release-notes-generator": "14.1.0",
|
|
666
667
|
"@smithy/types": "4.13.1",
|
|
667
668
|
"@sveltejs/adapter-auto": "8.0.0",
|
|
668
|
-
"@sveltejs/kit": "3.
|
|
669
|
+
"@sveltejs/kit": "3.1.1",
|
|
669
670
|
"@sveltejs/package": "3.0.2",
|
|
670
671
|
"@sveltejs/vite-plugin-svelte": "7.0.0",
|
|
671
672
|
"@types/cors": "2.8.19",
|