@juspay/neurolink 12.24.1 → 12.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,7 @@
6
6
  */
7
7
  import type { StoredOAuthTokens } from "./auth.js";
8
8
  import type { CodexReasoningEffort } from "./codex.js";
9
+ import type { ProxyAccountRankingPolicy } from "./proxy.js";
9
10
  export type { StoredOAuthTokens, TokenRefresher, TokenStorageData, StoredProviderTokens, } from "./auth.js";
10
11
  /**
11
12
  * Claude subscription tier levels
@@ -1018,16 +1019,27 @@ export type ProxyRoutingConfig = {
1018
1019
  sessionSoftLimit?: number;
1019
1020
  /** Reset-time bucket width used when ordering quota windows. */
1020
1021
  sessionResetToleranceMs?: number;
1021
- /** Email/label of the Anthropic account that should be tried first
1022
- * ("home"). When absent, falls back to insertion-order index 0.
1023
- * Resolved per-request to a stable key (anthropic:<email>); does not
1024
- * encode an index. */
1022
+ /** Email/label of the Anthropic account used as "home". Under quota
1023
+ * routing it is the ranking's final tiebreaker unless prefer-primary is
1024
+ * set; it is tried first only when quota routing is disabled. When
1025
+ * absent, falls back to insertion-order index 0. Resolved per-request to
1026
+ * a stable key (anthropic:<email>); does not encode an index. */
1025
1027
  primaryAccount?: string;
1026
1028
  /** Anthropic account emails/labels that may be loaded by the proxy. When
1027
1029
  * present, every token-store, legacy, and environment credential outside
1028
1030
  * this set is excluded before refresh or routing. An empty list denies all
1029
1031
  * stored credentials. */
1030
1032
  accountAllowlist?: string[];
1033
+ /** Ordering rule for usable accounts. Defaults to "expiry-first" (today's behaviour). */
1034
+ accountRanking?: ProxyAccountRankingPolicy;
1035
+ /** If the configured primary is usable and not session-saturated, try it first. */
1036
+ preferPrimary?: boolean;
1037
+ /** Keep a Claude Code session on its bound account while it stays usable and not session-saturated. */
1038
+ sessionAffinity?: boolean;
1039
+ /** Idle TTL, in ms, before a session-affinity binding is dropped. 60000-86400000. */
1040
+ sessionAffinityIdleTtlMs?: number;
1041
+ /** For a request without a binding: spill off an account already at N in-flight. 0-100, 0 = off. */
1042
+ spillInflight?: number;
1031
1043
  };
1032
1044
  /** Cloaking plugin config */
1033
1045
  export type CloakingConfig = {
@@ -2692,7 +2692,7 @@
2692
2692
  {"objectID":"15d36cacc0026e37e8d93611474d18bde24c77c81ec41083c757fdc962e50b54","title":"Force cleanup without confirmation","url":"/docs/features/claude-proxy-config-reference#force-cleanup-without-confirmation","content":"neurolink auth cleanup --force\n--force`).","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Force cleanup without confirmation","lvl3":""}},
2693
2693
  {"objectID":"ea946092508d02f41e596c51ea168d042419fdf95bc0dd5b4241788eedcee4aa","title":"neurolink auth enable","url":"/docs/features/claude-proxy-config-reference#neurolink-auth-enable","content":"Re-enable a previously disabled account so it can be used by the proxy pool again.\n\n| Argument | Type | Required | Description |\n| ----------- | -------- | -------- | ----------------------------------------------------- |\n| | | Yes | Account key to re-enable (e.g., ). |\n\nExamples:\n\n`bash","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"neurolink auth enable","lvl3":""}},
2694
2694
  {"objectID":"b8f28c0bb12e938b62170122316c271e210cc2d99d4c3a4390cd0016081a369c","title":"Re-enable a disabled account","url":"/docs/features/claude-proxy-config-reference#re-enable-a-disabled-account","content":"neurolink auth enable anthropic:1-VjRIq\nneurolink auth list` to see all accounts and their current status.","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Re-enable a disabled account","lvl3":""}},
2695
- {"objectID":"08657049d3a419bf68a12583396f7347eab685dc22e0d86603d27fbd0a94b96a","title":"neurolink auth set-primary","url":"/docs/features/claude-proxy-config-reference#neurolink-auth-set-primary","content":"Designate the proxy's primary (home) Anthropic account by email/label. Writes to the proxy config YAML; a running proxy watching that exact file applies it automatically and tries this account first under fill-first (or uses it as the home reference under round-robin). Does not touch the encrypted token store and does not require re-OAuthing any account.\n\n| Argument | Type | Required | Description |\n| ---------- | -------- | -------- | ------------------------------------------------------------------------- |\n| | | Yes | Email/label of the Anthropic account to make primary. |\n| | | No | Path to the proxy config file. Default: . |\n\nIf the email is not currently authenticated in the token store, the command still writes the field and prints a warning — the setting activates automatically once the account is added via . For a running proxy, the command reports whether it watches the edited path, watches a different path, or predates hot-reload support.\n\nExamples:\n\n`bash","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"neurolink auth set-primary","lvl3":""}},
2695
+ {"objectID":"08657049d3a419bf68a12583396f7347eab685dc22e0d86603d27fbd0a94b96a","title":"neurolink auth set-primary","url":"/docs/features/claude-proxy-config-reference#neurolink-auth-set-primary","content":"Designate the proxy's primary (home) Anthropic account by email/label. Writes to the proxy config YAML; a running proxy watching that exact file applies it automatically. With quota routing enabled (the default), primary is the ranking's final tiebreaker, not tried first, unless is also set; it is tried first unconditionally only when quota routing is disabled, and under it is used as the home reference. Does not touch the encrypted token store and does not require re-OAuthing any account.\n\n| Argument | Type | Required | Description |\n| ---------- | -------- | -------- | ------------------------------------------------------------------------- |\n| | | Yes | Email/label of the Anthropic account to make primary. |\n| | | No | Path to the proxy config file. Default: . |\n\nIf the email is not currently authenticated in the token store, the command still writes the field and prints a warning — the setting activates automatically once the account is added via . For a running proxy, the command reports whether it watches the edited path, watches a different path, or predates hot-reload support.\n\nExamples:\n\n`bash","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"neurolink auth set-primary","lvl3":""}},
2696
2696
  {"objectID":"2a8cd0695b6caae7a4e2295fa7ca61cc50999739ac136f987e98e2e49ebf94e1","title":"Make alice@example.com primary in the default config","url":"/docs/features/claude-proxy-config-reference#make-aliceexamplecom-primary-in-the-default-config","content":"neurolink auth set-primary alice@example.com","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Make alice@example.com primary in the default config","lvl3":""}},
2697
2697
  {"objectID":"9dc3e2b74e29302f832446dc91313db985e16862bb08674ac787c13b0ebe3e9d","title":"Use a non-default config path","url":"/docs/features/claude-proxy-config-reference#use-a-non-default-config-path","content":"neurolink auth set-primary alice@example.com --config ./proxy.yaml\njs-yaml.dump`, which does not preserve comments. The command prints a warning before writing if the existing file contains comments. JSON config paths preserve everything except whitespace.","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Use a non-default config path","lvl3":""}},
2698
2698
  {"objectID":"ede954ac1558ac03b0cd45df1b8a7652faab4725e387db2d0b9c24953e547a2b","title":"neurolink auth get-primary","url":"/docs/features/claude-proxy-config-reference#neurolink-auth-get-primary","content":"Show the proxy's currently configured primary account (and whether it is authenticated).\n\n| Argument | Type | Required | Description |\n| ---------- | -------- | -------- | ------------------------------------------------------------------------- |\n| | | No | Path to the proxy config file. Default: . |\n\nExamples:\n\nOutput (when configured and authenticated):","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"neurolink auth get-primary","lvl3":""}},
@@ -2708,15 +2708,16 @@
2708
2708
  {"objectID":"8a8b19a42b0e7d4ab2fc2359f9ebfd681d4b9aa700fe1e50e2d81d2831a34642","title":"Default provider applied when not specified per-account (optional)","url":"/docs/features/claude-proxy-config-reference#default-provider-applied-when-not-specified-per-account-optional","content":"defaultProvider: \"anthropic\"","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Default provider applied when not specified per-account (optional)","lvl3":""}},
2709
2709
  {"objectID":"916e893bc3d4d970307bbf474edf282a91324b31a65f8a5f399cfd1e1ffb7df9","title":"Default base URL applied to accounts that omit baseUrl (optional)","url":"/docs/features/claude-proxy-config-reference#default-base-url-applied-to-accounts-that-omit-baseurl-optional","content":"defaultBaseUrl: \"https://api.anthropic.com\"","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Default base URL applied to accounts that omit baseUrl (optional)","lvl3":""}},
2710
2710
  {"objectID":"6f3cf0b4adaef9ee8b3202d5cf8028081a6f47fa25a810fabbd216d1d27dc712","title":"At least one provider with at least one account is required.","url":"/docs/features/claude-proxy-config-reference#at-least-one-provider-with-at-least-one-account-is-required","content":"accounts:\n anthropic:\nname: \"personal-pro\" # Human-readable label (default: \"unnamed\")\n apiKey: \"${ANTHROPICKEY1}\" # API key or OAuth token (REQUIRED, non-empty)\n baseUrl: \"https://api.anthropic.com\" # Base URL override (optional)\n orgId: \"org-abc123\" # Organization ID (optional)\n weight: 2 # Weight for weighted round-robin (default: 1)\n enabled: true # Whether this account is active (default: true)\n rateLimit: 60 # Max requests per minute (optional)\n metadata: # Arbitrary metadata (optional)\n tier: \"pro\"\n notes: \"Main account\"\nname: \"team-max\"\n apiKey: \"${ANTHROPICKEY2}\"\n weight: 3\n enabled: true","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"At least one provider with at least one account is required.","lvl3":""}},
2711
- {"objectID":"508aa710559cfdf1c9c6dee60df5391cde5504c97878afda16f5292e665ff23c","title":"Accepts both camelCase and kebab-case keys for YAML-friendliness.","url":"/docs/features/claude-proxy-config-reference#accepts-both-camelcase-and-kebab-case-keys-for-yaml-friendliness","content":"routing:\n # Account selection strategy: \"round-robin\" | \"fill-first\"\n strategy: \"fill-first\"\n\n # Quota-aware ordering controls for fill-first. Accounts with session\n # headroom are ordered by soonest weekly expiry; a session at the soft limit\n # is temporarily demoted until its 5h window resets. Environment variables\n # with matching names take precedence when present in the proxy env file.\n quota-routing: true\n session-soft-limit: 0.97\n session-reset-tolerance-ms: 900000\n\n # Optional bound for concurrent upstream requests per OAuth account. Omit\n # this key for unlimited admission. When set, requests try another eligible\n # account first, then queue only if all are full. Valid range is 1 through 20.\n # A value outside that range — a non-integer, 0, or 21+ — is rejected with a\n # warning and leaves admission unlimited; it is NOT clamped to the nearest\n # bound, so a typo here silently removes the cap rather than tightening it.\n # max-inflight-per-account: 2\n\n # Primary (home) account: under fill-first without quota routing this account\n # is tried first. With quota routing enabled it is only the final tie-break;\n # session headroom and weekly expiry determine order first. Under round-robin\n # it sets the starting offset when account membership changes. Resolved\n # per-request to a stable token-store key (anthropic:); a numeric index\n # is never persisted, so reordering accounts in the token store is irrelevant.\n # When omitted the proxy falls back to insertion-order index 0.\n # Accepts: primary-account (kebab) or primaryAccount (camel).\n # Manage via:\n # neurolink auth set-primary \n # neurolink auth get-primary\n # neurolink auth clear-primary\n primary-account: \"alice@example.com\"\n\n # Optional hard boundary for Anthropic credential discovery. Entries may be\n # labels/emails or full anthropic: keys. An empty list denies all.\n # Hidden legacy/env credentials require explicit legacy-default/env entries.\n # Accepts: account-allowlis","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Accepts both camelCase and kebab-case keys for YAML-friendliness.","lvl3":""}},
2711
+ {"objectID":"508aa710559cfdf1c9c6dee60df5391cde5504c97878afda16f5292e665ff23c","title":"Accepts both camelCase and kebab-case keys for YAML-friendliness.","url":"/docs/features/claude-proxy-config-reference#accepts-both-camelcase-and-kebab-case-keys-for-yaml-friendliness","content":"routing:\n # Account selection strategy: \"round-robin\" | \"fill-first\"\n strategy: \"fill-first\"\n\n # Quota-aware ordering controls for fill-first. Accounts with session\n # headroom are ordered by soonest weekly expiry; a session at the soft limit\n # is temporarily demoted until its 5h window resets. Environment variables\n # with matching names take precedence when present in the proxy env file.\n quota-routing: true\n session-soft-limit: 0.97\n session-reset-tolerance-ms: 900000\n\n # Optional bound for concurrent upstream requests per OAuth account. Omit\n # this key for unlimited admission. When set, requests try another eligible\n # account first, then queue only if all are full. Valid range is 1 through 20.\n # A value outside that range — a non-integer, 0, or 21+ — is rejected with a\n # warning and leaves admission unlimited; it is NOT clamped to the nearest\n # bound, so a typo here silently removes the cap rather than tightening it.\n # max-inflight-per-account: 2\n\n # Primary (home) account: under fill-first without quota routing this account\n # is tried first. With quota routing enabled it is only the final tie-break\n # in the ranking order below, unless prefer-primary (below) is set, in which\n # case it is tried first whenever usable and not session-saturated. Under\n # round-robin it sets the starting offset when account membership changes.\n # Resolved per-request to a stable token-store key (anthropic:); a\n # numeric index is never persisted, so reordering accounts in the token\n # store is irrelevant. When omitted the proxy falls back to insertion-order\n # index 0. Accepts: primary-account (kebab) or primaryAccount (camel).\n # Manage via:\n # neurolink auth set-primary \n # neurolink auth get-primary\n # neurolink auth clear-primary\n primary-account: \"alice@example.com\"\n\n # Account routing policies (all optional; every default reproduces today's\n # exact behavior). See \"Account Routing Policies\" below for precedence,\n # interaction no","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Accepts both camelCase and kebab-case keys for YAML-friendliness.","lvl3":""}},
2712
2712
  {"objectID":"fe0c3c2e38e2589525229488992b2e19a4be97672bb19a6c14c8d8860f060363","title":"genuine Claude Code sessions.","url":"/docs/features/claude-proxy-config-reference#genuine-claude-code-sessions","content":"cloaking:\n # Mode: \"auto\" | \"always\" | \"never\"\n # auto - apply cloaking only to OAuth accounts (default behavior)\n # always - apply to all accounts (OAuth and API key)\n # never - disable all cloaking plugins\n mode: \"auto\"\n\n plugins:\n # Strip proxy-revealing headers (x-forwarded-for, via, etc.)\n headerScrubber: true\n\n # Generate consistent session identities per account (1-hour TTL)\n sessionIdentity: true\n\n # Inject Claude Code session context into system prompt (OAuth only)\n systemPromptInjector: true\n\n # Zero-width character insertion into sensitive words\n wordObfuscator:\n enabled: true\n words: # Custom words to obfuscate\n\"proxy\"\n\"neurolink\"\n\"load balancer\"\n\"round-robin\"\n\"failover\"\n\"multi-account\"\n\n # TLS fingerprint mimicry (stub/placeholder -- not yet implemented)\n tlsFingerprint:\n enabled: false\n`","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"genuine Claude Code sessions.","lvl3":""}},
2713
2713
  {"objectID":"a914072b6478cd54f35c8b48652ebedea6acdb5863732492ebeea48e5167665e","title":"Top-Level Fields","url":"/docs/features/claude-proxy-config-reference#top-level-fields-1","content":"| Field | Type | Default | Required | Description |\n| ----------------- | --------------------------- | -------- | -------- | --------------------------------------------------------- |\n| | | | No | Config schema version. |\n| | | (none) | No | Default provider name applied to accounts that omit it. |\n| | | (none) | No | Default base URL applied to accounts that omit . |\n| | | (none) | Yes | Map of provider names to account arrays. |\n| | | (none) | No | Routing strategy, model mappings, and fallback chain. |\n| | | (none) | No | Cloaking pipeline configuration. |","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Top-Level Fields","lvl3":""}},
2714
2714
  {"objectID":"1ddc0b9d057810f709034f8dfd39154c2973a2c261c0e493fa982fe9009ce919","title":"Account Fields","url":"/docs/features/claude-proxy-config-reference#account-fields","content":"| Field | Type | Default | Required | Description |\n| ----------- | ------------------------- | ----------- | -------- | ------------------------------------------------------------------------ |\n| | | | No | Human-readable account label. |\n| | | (none) | Yes | API key or OAuth token. Supports interpolation. |\n| | | (none) | No | Override the provider's API base URL. |\n| | | (none) | No | Organization ID (e.g., OpenAI organizations). |\n| | | | No | Weight for weighted round-robin selection. Higher weight = more traffic. |\n| | | | No | Whether this account is active. Disabled accounts are skipped. |\n| | | (none) | No | Maximum requests per minute for this account. |\n| | | (none) | No | Arbitrary metadata (tier info, notes, tags). |","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Account Fields","lvl3":""}},
2715
- {"objectID":"2a0bba905241315a6d948d614e823b3bae586f85ae7088f699d585f0fa818cc1","title":"Routing Fields","url":"/docs/features/claude-proxy-config-reference#routing-fields","content":"| Field | Type | Default | Required | Description |\n| -------------------------------------------------------- | ------------------------------- | ------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| | | (none) | No | Account selection strategy. rotates across accounts. uses one account until exhausted. |\n| / | | (none) | No | Email/label of the Anthropic account to treat as primary (home). With quota routing enabled, primary is only the final tie-break after session headroom and weekly expiry. Resolved per-request to ; falls back to insertion-order index 0 when absent or when the configured account isn't currently authenticated. Manage via . ","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Routing Fields","lvl3":""}},
2715
+ {"objectID":"2a0bba905241315a6d948d614e823b3bae586f85ae7088f699d585f0fa818cc1","title":"Routing Fields","url":"/docs/features/claude-proxy-config-reference#routing-fields","content":"| Field | Type | Default | Required | Description |\n| ----------------------------------------------------------- | ------------------------------------ | -------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| | | (none) | No | Account selection strategy. rotates across accounts. uses one account until exhausted. |\n| / | ","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Routing Fields","lvl3":""}},
2716
2716
  {"objectID":"67869c44bf604306f5e7d4f118c84d1357aba914cd78f1c63e338a61afd446cd","title":"ModelMapping Fields","url":"/docs/features/claude-proxy-config-reference#modelmapping-fields","content":"| Field | Type | Default | Required | Description |\n| ---------- | -------- | ------------- | -------- | ------------------------------------------------ |\n| | | | Yes | Incoming model name (what Claude Code requests). |\n| | | | Yes | Target model name at the destination provider. |\n| | | | No | Target provider to route to. |","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"ModelMapping Fields","lvl3":""}},
2717
2717
  {"objectID":"52dc93bd2fb61c11e711465bcce7ab2445d21dd11f8601a791c1800577cd68bc","title":"FallbackEntry Fields","url":"/docs/features/claude-proxy-config-reference#fallbackentry-fields","content":"| Field | Type | Default | Required | Description |\n| ---------- | -------- | ------- | -------- | -------------------------------------------- |\n| | | | Yes | Provider name (e.g., , ). |\n| | | | Yes | Model to use at that provider. |","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"FallbackEntry Fields","lvl3":""}},
2718
2718
  {"objectID":"d9b034b736d0076ac98c315f8227b06382eafb161166a630a350add28c818ee6","title":"Cloaking Fields","url":"/docs/features/claude-proxy-config-reference#cloaking-fields","content":"| Field | Type | Default | Description |\n| -------------------------------- | ------------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------ |\n| | | | applies cloaking only to OAuth accounts. applies to all. disables all plugins. |\n| | | | Strip proxy-revealing headers (x-forwarded-for, via, sec-ch-\\*, etc.). |\n| | | | Generate consistent userid/sessionid per account with 1-hour TTL. |\n| | | | Inject Claude Code session context (IDE metadata, timestamps) into system prompt. OAuth accounts only. |\n| | | | Insert zero-width characters into sensitive words to defeat string matching. |\n| | | | Words to obfuscate. Defaults include: proxy, neurolink, load balancer, round-robin, failover, multi-account. |\n| | | | TLS fingerprint mimicry. Currently a stub/placeholder (no-op). |","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Cloaking Fields","lvl3":""}},
2719
- {"objectID":"f1d10e310dd6cdd2e1ec76e8fb228e48f343eec841772b564c22357e7ea8f64f","title":"Validation Rules","url":"/docs/features/claude-proxy-config-reference#validation-rules","content":"The config loader validates the following:\nmust be present and be a non-array object.\nEach provider key in must map to an array.\nEach account must have a non-empty string .\nIf is present, it must be a number.\nmust be an array of non-empty strings when present.\nmust be a boolean when present.\nmust be a boolean when present.\nmust be an integer from 1 through 20 when present.\nmust be a number in when present.\nmust be a positive integer when present.\nmust be , , or when present; any\n other value is ignored with a warning and the default applies.\nPlaintext API keys (not using references) trigger a warning.\n\nAn absent default config is optional. An existing config that cannot be read or\nvalidated fails proxy startup; it is never ignored in favor of unrestricted\nrouting.","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Validation Rules","lvl3":""}},
2719
+ {"objectID":"f1d10e310dd6cdd2e1ec76e8fb228e48f343eec841772b564c22357e7ea8f64f","title":"Validation Rules","url":"/docs/features/claude-proxy-config-reference#validation-rules","content":"The config loader validates the following:\nmust be present and be a non-array object.\nEach provider key in must map to an array.\nEach account must have a non-empty string .\nIf is present, it must be a number.\nmust be an array of non-empty strings when present.\nmust be a boolean when present.\nmust be a boolean when present.\nmust be an integer from 1 through 20 when present.\nmust be a number in when present.\nmust be a positive integer when present.\nmust be , , or (case-insensitive)\n when present.\nmust be or when\n present.\nmust be a boolean when present.\nmust be a boolean when present.\nmust be an integer from 60000 through\n 86400000 when present.\nmust be an integer from 0 through 100 when present.\nFor those five routing policy keys, an explicit counts as present\n and is rejected, whichever spelling (kebab-case or camelCase) carries it.\nPlaintext API keys (not using references) trigger a warning.\n\nAn absent default config is optional. An existing config that cannot be read or\nvalidated fails proxy startup; it is never ignored in favor of unrestricted\nrouting. A value that fails any check above rejects the whole config, never\njust that key: at startup the proxy does not start, and on a hot reload the\nlast-known-good generation stays active.","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Validation Rules","lvl3":""}},
2720
+ {"objectID":"c8450374b1fc8e0a0f5fb47d3bef0cab242c75e17bfebe6e943ef17b22c10227","title":"Account Routing Policies","url":"/docs/features/claude-proxy-config-reference#account-routing-policies","content":"The five keys above (, , ,\n, ) all default to today's exact\nbehavior — ranking, no affinity, no primary preference, no\nspill — and are validated and hot-reloaded through the same runtime config\nsnapshot as every other routing key.\n\n ignores all five keys. They apply only under\n with more than one enabled account.\n\n disables quota-based ranking, but\n, and still apply.\nTurning off quota routing removes the expiry/headroom ordering step, so\n has no effect; it does not disable sticky sessions, the\nprimary preference or spill, which then work on the configured account\norder.\n\nPrecedence. After unusable accounts are removed, the order a request\ntries is:\nthe session's bound account, when is on and that\n account is usable and not session-saturated;\nthe configured , when is on and it is\n usable and not session-saturated;\nthe remaining accounts in order.\n\nSpill only changes which account is tried first, and only for requests\nwithout an active session-affinity binding — it never re-orders or moves a\nrequest that is already bound to an account. Its target must be usable and\nnot session-saturated, like every step above; when no account under the\nthreshold qualifies, nothing spills.\n\nBinding. A served request binds its session to the Anthropic account\nthat served it. The existing binding is kept only when that request never\ntried the bound account and the bound account is still usable and not\nsession-saturated — a request that overflowed the bound account's\n cap onto another account keeps the session on its\nwarm prompt cache. A bound account that was tried and failed in the same\nrequest loses the session to the account that served it, even if its\ncooldown has already lapsed by the time the response starts. A Codex or\nVertex fallback, a peer borrow, or an error response never binds.\n\nFailure mode. If ranking, affinity or spill throws, the request uses the\npre-policy order (plain under quota routing) and the routing\ndecision records . If the binding step after a served\n","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Account Routing Policies","lvl3":""}},
2720
2721
  {"objectID":"2b5d2865be217ed908e64f9d07acbe019108e95f210f6c14f031cf8cb99ece6f","title":"3. Environment Variables","url":"/docs/features/claude-proxy-config-reference#3-environment-variables","content":"| Variable | Purpose | Used By |\n| -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |\n| | Anthropic API key. Used as a fallback credential when no OAuth accounts are found. | Proxy routes, Anthropic provider |\n| | OAuth access token for Anthropic (alternative to stored tokens). | Anthropic provider, providerConfig |\n| | Alias for . Checked as a fallback. | Anthropic provider, providerConfig |\n| ","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"3. Environment Variables","lvl3":""}},
2721
2722
  {"objectID":"3f1a3fc9d7711064037deec5635e85b2dc713d3d9c019df22c659f47215812b8","title":"Proxy Env File Resolution Order","url":"/docs/features/claude-proxy-config-reference#proxy-env-file-resolution-order","content":"When the proxy starts, it loads env vars from a file using this priority:\nCLI flag — explicit path, required to exist.\nenvironment variable — explicit path, required to exist.\n— loaded automatically if the file exists (created by ).\nNothing — proxy starts without extra env vars; telemetry remains disabled unless env vars are already set in the shell, and the proxy emits a startup log explaining how to enable it unless output is suppressed.\n\nThe flag is baked into the launchd plist by , so the service always loads from the same file across reboots. The three runtime routing variables above and routing interpolation are reread transactionally; other env settings remain startup-only.\n\nPriority for Anthropic credentials (checked in order by the proxy routes):\nTokenStore compound keys -- entries in .\nLegacy credentials file -- (only if no compound keys exist).\nenv var -- Only if no Anthropic TokenStore entries or legacy credential are present.\n\n filters these sources before loading or refresh. Legacy and environment fallbacks are never activated merely because existing TokenStore accounts are disabled, cooling, or unavailable.","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Proxy Env File Resolution Order","lvl3":""}},
2722
2723
  {"objectID":"80e1b4619dc934235aae772511dd334605525b9512cb0a98374bc61d27f8903a","title":"4. Claude Code Settings","url":"/docs/features/claude-proxy-config-reference#4-claude-code-settings","content":"When the proxy starts, it automatically writes to :\n\n| Key | Value | Description |\n| -------------------- | ---------------------- | --------------------------------------------------------------------------- |\n| | | Tells Claude Code to route all Anthropic API requests through the proxy. |\n| | | Enables tool search in Claude Code (required for full proxy compatibility). |\n\nLifecycle:\nOn -- Both keys are written (or merged into existing settings).\nOn (Ctrl+C / SIGTERM) -- Both keys are removed. Other env keys in the settings file are preserved.\nFail-open guard -- A foreground proxy's detached guard removes stale settings only after confirming its parent died and no replacement is healthy. launchd-managed proxies do not spawn this cleanup guard; they use a separate updater-only worker.\nSafety -- If the has been changed to a different value (e.g., another proxy), the cleanup will not overwrite it.\n\nAfter starting the proxy, restart Claude Code for the new settings to take effect.","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"4. Claude Code Settings","lvl3":""}},
@@ -2733,7 +2734,7 @@
2733
2734
  {"objectID":"1f9c54ae3c81768bfaa6e88d9f81a747763a20a23a509555e2788f162f1cf591","title":"Example: Multiple Gemini Tiers","url":"/docs/features/claude-proxy-config-reference#example-multiple-gemini-tiers","content":"Falls back through progressively cheaper models.","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Example: Multiple Gemini Tiers","lvl3":""}},
2734
2735
  {"objectID":"5840622d0ea485a87032dd159d8a9cbd6131eb881e89a729988affdcd5b9bead","title":"Example: Vertex AI as Primary Fallback (Enterprise)","url":"/docs/features/claude-proxy-config-reference#example-vertex-ai-as-primary-fallback-enterprise","content":"Uses enterprise-grade providers (Vertex AI, Bedrock) as fallbacks. Requires the corresponding provider credentials to be configured in environment variables.","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Example: Vertex AI as Primary Fallback (Enterprise)","lvl3":""}},
2735
2736
  {"objectID":"74ca24307bc047392fb4124352609014774fc677af2d9376c5938df57a696379","title":"Example: Full Multi-Tier Setup","url":"/docs/features/claude-proxy-config-reference#example-full-multi-tier-setup","content":"This configuration:\nPools two Claude accounts with 1:3 weighting (Max gets 3x traffic).\nPasses Sonnet 4 requests directly to Anthropic.\nRedirects Haiku requests to Gemini Flash.\nFalls back to Gemini Pro, then GPT-4o when Claude accounts are exhausted.\nApplies cloaking to OAuth accounts (header scrubbing, session identity, system prompt injection, word obfuscation).","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Example: Full Multi-Tier Setup","lvl3":""}},
2736
- {"objectID":"91305febbac17a5231ac83b4db34414208e82c2cdd970bed86e20d7e2c78837b","title":"Proxy Endpoints","url":"/docs/features/claude-proxy-config-reference#proxy-endpoints","content":"For reference, the running proxy exposes these HTTP endpoints:\n\n| Method | Path | Description |\n| ------ | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| | | Anthropic-compatible chat completions (main endpoint). |\n| | | List available models. |\n| | | Token counting endpoint. |\n| | | Health check. Returns . |\n| | | Detailed status with per-account stats, total attempts, completed requests, and error rates. On a gated proxy, account identity is released only to a caller holding the update-control token. |\n| | | Fresh per-account limits from Anthropic's usage API. for one, for stored state. Operator-only: refused for borrowed traffic. |\n| | | Peer protocol version, capabilities and grant state. Authenticated by share token; touches no account. |\n| | | What t","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Proxy Endpoints","lvl3":""}},
2737
+ {"objectID":"91305febbac17a5231ac83b4db34414208e82c2cdd970bed86e20d7e2c78837b","title":"Proxy Endpoints","url":"/docs/features/claude-proxy-config-reference#proxy-endpoints","content":"For reference, the running proxy exposes these HTTP endpoints:\n\n| Method | Path | Description |\n| ------ | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| | | Anthropic-compatible chat completions (main endpoint). |\n| | | List available models. |\n| | | Token counting endpoint. |\n| | | Health check. Returns . ","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Proxy Endpoints","lvl3":""}},
2737
2738
  {"objectID":"bec09144f0ab1ea551bccd0bdd6b2dd27cc720f1632906c914e99e0fe2c5445b","title":"Log Rotation","url":"/docs/features/claude-proxy-config-reference#log-rotation","content":"Log files (, , ) and old body-capture directories are automatically cleaned up to prevent unbounded growth.\n\n| Parameter | Value | Description |\n| ---------------- | ---------------- | ---------------------------------------------------------- |\n| Max age | 7 days | Files older than 7 days are deleted |\n| Max total size | 500 MB | If remaining files exceed 500 MB, oldest are deleted first |\n| Cleanup triggers | Startup + hourly | Runs once at proxy start, then every 60 minutes |\n\nThe function performs two passes:\nAge pass -- delete all files with older than the cutoff.\nSize pass -- if remaining files exceed the size limit, delete oldest first until under the cap.\n\nLog rotation is non-fatal. If cleanup fails, the proxy continues operating normally.","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Log Rotation","lvl3":""}},
2738
2739
  {"objectID":"60db6f645aa9587d509f86c0dedf99d01d34cd5177e137ae73d06df0230f888a","title":"Rate Limit Headers from Anthropic","url":"/docs/features/claude-proxy-config-reference#rate-limit-headers-from-anthropic","content":"The proxy captures and uses Anthropic's quota headers for per-account utilization tracking:\n\n| Header | Format | Description |\n| -------------------------------------------- | --------------- | -------------------------------------- |\n| | float (0.0-1.0) | 5-hour rolling session utilization |\n| | string | Session status (e.g., , ) |\n| | integer (epoch) | When the 5-hour window resets |\n| | float (0.0-1.0) | 7-day rolling weekly utilization |\n| | string | Weekly status |\n| | integer (epoch) | When the 7-day window resets |\n| | float | Fallback percentage threshold |\n| | string | Overage status |\n\nThese headers are parsed by in and cached in memory with debounced persistence to . The command displays per-account 5h and 7d utilization when available.","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Rate Limit Headers from Anthropic","lvl3":""}},
2739
2740
  {"objectID":"dc2f752ec02a63cb7cf4810d683b161d74dd2e3a77abcade53c22f1ec17ca88e","title":"Token Refresh","url":"/docs/features/claude-proxy-config-reference#token-refresh","content":"The proxy coordinates background, pre-request, and on-401 refresh paths:\nBackground check — One non-overlapping cycle runs every 30 seconds and considers only allowed, enabled accounts within 5 minutes of expiry.\nPre-request check — Before each request, if , refresh inline via (fallback: ).\nOn-401 retry — If Anthropic returns a 401, refresh and retry within the bounded account retry budget before rotating.\n\nConcurrent callers sharing a rotating refresh token reuse one in-flight result. , , , and refresh responses are credential rejections and disable the account until explicit login. Network failures, refresh s, and responses are transient and receive a bounded auth cooldown. Automatic token persistence preserves manual disable metadata.","hierarchy":{"lvl0":"Features","lvl1":"Claude Proxy Configuration Reference","lvl2":"Token Refresh","lvl3":""}},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "12.24.1",
3
+ "version": "12.25.0",
4
4
  "packageManager": "pnpm@10.15.1",
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": {