Skip to content

Any way to get this app to work with Sillytavern? #306

Closed

Description

@Sakura23151

To be more exact, I have an API Key from Openrouter and want to use it with SillyTavern, but it doesn't 'connect'.

Here's the sillytavern log to be exact:

]
Instantiated the tokenizer for gpt-3.5-turbo
FetchError: request to https://openrouter.ai/api/v1/models failed, reason:
at ClientRequest. (file:///H:/SillyTavern/stlauncher/SillyTavern-Launcher/SillyTavern/node_modules/node-fetch/src/index.js:108:11)
at ClientRequest.emit (node:events:508:28)
at emitErrorEvent (node:_http_client:108:11)
at TLSSocket.socketErrorListener (node:_http_client:575:5)
at TLSSocket.emit (node:events:508:28)
at emitErrorNT (node:internal/streams/destroy:170:8)
at emitErrorCloseNT (node:internal/streams/destroy:129:3)
at process.processTicksAndRejections (node:internal/process/task_queues:89:21) {
type: 'system',
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
erroredSysCall: undefined
}
FetchError: request to https://openrouter.ai/api/v1/models failed, reason:
at ClientRequest. (file:///H:/SillyTavern/stlauncher/SillyTavern-Launcher/SillyTavern/node_modules/node-fetch/src/index.js:108:11)
at ClientRequest.emit (node:events:508:28)
at emitErrorEvent (node:_http_client:108:11)
at TLSSocket.socketErrorListener (node:_http_client:575:5)
at TLSSocket.emit (node:events:508:28)
at emitErrorNT (node:internal/streams/destroy:170:8)
at emitErrorCloseNT (node:internal/streams/destroy:129:3)
at process.processTicksAndRejections (node:internal/process/task_queues:89:21) {
type: 'system',
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
erroredSysCall: undefined
}

If it helps, that is..

Activity

  1. therealaleph commented on Apr 27, 2026

    @therealaleph
    Owner

    @Sakura23151 — SillyTavern + OpenRouter + mhrv-rs has two known friction points to debug:

    1. SillyTavern needs explicit proxy env vars (Node.js node-fetch doesn't always respect system proxy)

    # Windows PowerShell
    $env:HTTPS_PROXY="http://127.0.0.1:8085"
    $env:HTTP_PROXY="http://127.0.0.1:8085"
    node start.js  # or whatever launches SillyTavern
    
    # Or in SillyTavern's config (config.yaml):
    proxy: 'http://127.0.0.1:8085'

    If you're using SillyTavern-Launcher, the launcher might bypass these. Try setting env vars at the OS level (System Properties → Environment Variables) so they propagate.

    2. OpenRouter might be hitting Cloudflare anti-bot

    openrouter.ai is hosted on Cloudflare. Apps Script's IP source is Google datacenter — same datacenter-IP heuristic that flags Instagram/some Cloudflare-protected sites. Cloudflare may issue Turnstile challenge that node-fetch can't solve.

    Diagnostic:

    After setting env vars and starting SillyTavern, check mhrv-rs log. Look for:

    INFO SOCKS5 CONNECT -> openrouter.ai:443
    INFO dispatch openrouter.ai:443 -> MITM + Apps Script relay (TLS detected)
    INFO relay POST https://openrouter.ai/api/v1/models
    
    • If you see relay POST lines → request reaches Apps Script. The ETIMEDOUT is then either Cloudflare blocking Apps Script's IP, or Apps Script timing out. Try curl -v https://openrouter.ai/api/v1/models -x http://127.0.0.1:8085 -H "Authorization: Bearer YOUR_KEY" from a separate shell to see the actual response.
    • If you DON'T see SOCKS5 CONNECT → SillyTavern isn't going through mhrv-rs. The env-var path didn't take. Verify with node -e "console.log(process.env.HTTPS_PROXY)" before launching SillyTavern.

    Workarounds:

    If Cloudflare is blocking Apps Script's IP (likely):

    1. Add openrouter.ai to passthrough_hosts in mhrv-rs config.json — traffic skips Apps Script and goes direct (or via upstream_socks5). This won't help if openrouter.ai is also filtered by your ISP.
    2. Full mode + VPS — VPS makes the request from a non-Google IP, Cloudflare more likely to let it through (clean residential is better, datacenter VPS is hit-or-miss).

    The Cloudflare-vs-datacenter-IP issue is documented in #119 and #249. OpenRouter likely falls in this same bucket.

    Try the env-var fix + look at mhrv-rs log first. The log lines tell us which scenario you're in.


    [reply via Anthropic Claude | reviewed by @therealaleph]

  2. Sakura23151 commented on Apr 27, 2026

    @Sakura23151
    Author

    @Sakura23151 — SillyTavern + OpenRouter + mhrv-rs has two known friction points to debug:

    1. SillyTavern needs explicit proxy env vars (Node.js node-fetch doesn't always respect system proxy)

    Windows PowerShell

    $env:HTTPS_PROXY="http://127.0.0.1:8085"
    $env:HTTP_PROXY="http://127.0.0.1:8085"
    node start.js # or whatever launches SillyTavern

    Or in SillyTavern's config (config.yaml):

    proxy: 'http://127.0.0.1:8085'
    If you're using SillyTavern-Launcher, the launcher might bypass these. Try setting env vars at the OS level (System Properties → Environment Variables) so they propagate.

    2. OpenRouter might be hitting Cloudflare anti-bot

    openrouter.ai is hosted on Cloudflare. Apps Script's IP source is Google datacenter — same datacenter-IP heuristic that flags Instagram/some Cloudflare-protected sites. Cloudflare may issue Turnstile challenge that node-fetch can't solve.

    Diagnostic:

    After setting env vars and starting SillyTavern, check mhrv-rs log. Look for:

    INFO SOCKS5 CONNECT -> openrouter.ai:443
    INFO dispatch openrouter.ai:443 -> MITM + Apps Script relay (TLS detected)
    INFO relay POST https://openrouter.ai/api/v1/models
    
    • If you see relay POST lines → request reaches Apps Script. The ETIMEDOUT is then either Cloudflare blocking Apps Script's IP, or Apps Script timing out. Try curl -v https://openrouter.ai/api/v1/models -x http://127.0.0.1:8085 -H "Authorization: Bearer YOUR_KEY" from a separate shell to see the actual response.
    • If you DON'T see SOCKS5 CONNECT → SillyTavern isn't going through mhrv-rs. The env-var path didn't take. Verify with node -e "console.log(process.env.HTTPS_PROXY)" before launching SillyTavern.

    Workarounds:

    If Cloudflare is blocking Apps Script's IP (likely):

    1. Add openrouter.ai to passthrough_hosts in mhrv-rs config.json — traffic skips Apps Script and goes direct (or via upstream_socks5). This won't help if openrouter.ai is also filtered by your ISP.
    2. Full mode + VPS — VPS makes the request from a non-Google IP, Cloudflare more likely to let it through (clean residential is better, datacenter VPS is hit-or-miss).

    The Cloudflare-vs-datacenter-IP issue is documented in #119 and #249. OpenRouter likely falls in this same bucket.

    Try the env-var fix + look at mhrv-rs log first. The log lines tell us which scenario you're in.

    [reply via Anthropic Claude | reviewed by @therealaleph]

    Nope it doesn't work, and the ISP has indeed blocked OPenrouter.ai, so the only way to get around it is 'full tunnel' mode with a VPS.

    I'm sorry, what do you mean by 'residential'? May I ask how one even uses a VPS with this thing? And wouldn't it be better to use a VPS + the Reality protocol on V2RAY instead, @therealaleph ?

  3. therealaleph commented on Apr 27, 2026

    @therealaleph
    Owner

    @Sakura23151 — happy to explain. ISP-blocked + datacenter-IP filtered is exactly the case Full mode is designed for.

    "Residential" vs "datacenter" IP

    • Datacenter IP = a server in a hosting provider's data center (Hetzner, DigitalOcean, AWS, OVH, etc.). Cloudflare/Google/Instagram's anti-bot heuristics treat these IPs as "probably automated/scraping" and either Turnstile-challenge them or outright block them.
    • Residential IP = a normal home internet IP from a consumer ISP (Comcast, Verizon, BT, etc.). These look like real users to anti-bot systems. Far less likely to get challenged.
    • "Clean residential" = a residential IP not yet flagged from prior abuse.

    For OpenRouter (Cloudflare-protected), going from a Hetzner datacenter VPS might work, might hit a captcha. A friend/family member's home internet via tunnel-node would work consistently.

    How to use a VPS with mhrv-rs (Full mode)

    mhrv-rs ships a tunnel-node Docker image. You run it on your VPS; it accepts TLS connections from your mhrv-rs client and forwards every flow out to the destination from the VPS. Your local mhrv-rs client tunnels via Apps Script → tunnel-node → origin.

    Quick steps (~5 min if you have a VPS):

    1. Get a VPS — Hetzner CX11 (€4/mo), DigitalOcean ($6/mo basic), or any cloud with Docker support. Pick a region close to OpenRouter (US-East works well).

    2. On the VPS, install Docker + run tunnel-node:

      docker run -d --name mhrv-tunnel \
        --restart unless-stopped \
        -p 8443:8443 \
        -e MHRV_AUTH_KEY="$(openssl rand -hex 32)" \
        ghcr.io/therealaleph/mhrv-tunnel-node:latest
      docker logs mhrv-tunnel  # grab the auth key it prints
    3. In mhrv-rs config, switch to Full mode + add tunnel-node URL:

      {
        "mode": "full",
        "tunnel_url": "https://YOUR_VPS_IP:8443",
        "tunnel_auth_key": "PASTE_FROM_STEP_2",
        "ssl_verify": false  // self-signed cert from tunnel-node
      }
    4. Restart mhrv-rs. Now OpenRouter requests go: SillyTavern → mhrv-rs → Apps Script (TLS-tunneled) → tunnel-node on your VPS → openrouter.ai. Cloudflare sees your VPS IP, not a Google datacenter IP. Much higher pass rate.

    If your VPS IP also gets challenged by Cloudflare (datacenter IP), the next step is residential — friend's home box, or services like NordVPN's "Meshnet" / Tailscale to route via someone's residential connection.

    Reality vs mhrv-rs

    Reality (V2RAY/Xray) is a great protocol — different design point. It uses TLS-in-TLS with TLS handshake mimicry (steals a real CDN cert via SNI redirect). It needs:

    • A VPS running V2RAY/Xray server with Reality config
    • A "stealth" SNI to mimic (e.g. www.cloudflare.com)
    • All traffic goes through your VPS

    Trade-offs vs mhrv-rs:

    • Reality is faster for steady-state traffic — direct VPS connection, no Apps Script overhead
    • mhrv-rs is more censorship-resistant for bootstrap — no VPS needed for read-only Google traffic (google_only mode); domain-fronts via Google itself
    • mhrv-rs Full mode + VPS ≈ Reality + VPS for performance — both go user → VPS → origin once you've got the VPS

    If you already have the VPS running and just want OpenRouter to work, Reality is honestly probably the simpler path. mhrv-rs's value is mostly for the no-VPS-needed bootstrap case. With Full mode + VPS you're using mhrv-rs as essentially a SOCKS5 proxy with extra encapsulation steps.

    My recommendation for your use case (SillyTavern + OpenRouter, ISP blocks OpenRouter):

    • If you have/want a VPS anyway: Reality or Trojan via V2RAY is the cleanest fit. Set HTTPS_PROXY env var to V2RAY's local SOCKS5 port, done.
    • If you don't want a VPS but need OpenRouter: mhrv-rs passthrough_hosts: ["openrouter.ai"] + an upstream_socks5 pointed at any free SOCKS5 you trust (less reliable, free SOCKS5 are flaky)
    • mhrv-rs Full mode + VPS works but is heavier than necessary for this specific use case

    Hope this clarifies. The OpenRouter-via-mhrv-rs friction is real and not really a project bug — it's the architecture mismatch (Apps Script's IP set is hostile to Cloudflare-protected sites).


    [reply via Anthropic Claude | reviewed by @therealaleph]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions