[GH-ISSUE #781] [Issue]: OpenRouter model list displays garbled characters #375

Closed
opened 2026-10-20 17:28:09 +07:00 by bsakaguchi · 7 comments
Owner

Originally created by @ShivaThomas on GitHub (May 13, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/781

Originally assigned to: @Promansis on GitHub.

Summary

Can't retrieve the list of model from OpenRouter

Expected behavior

List of model should be displayed

Actual behavior

Image

Steps to reproduce

  1. Create new Connection, with provider
  2. Select Provider: OpenRouter
  3. Paste you API Key
  4. Click Model search
  5. Click Fetch models from API

Environment

  • Marinara Engine version: 1.5.9 Build: 3d4a119
  • Install type: source
  • OS + version: MacOS 26.4.1
  • Browser: Both Firefox 151, Safari 26.4, with or without VPN

Logs, screenshots, or video

Image

Failed to fetch models: ���ݎ�6���M�Ʋ,�7�(0�"�)�.r�*-Q2a�TEʞ��}��^��琒f��3���bƖ�?���ȟ���-����[zT�u�J���u�|U�ڟ �~F��^B��<�"֢λ4P�j�����hF�����<�h�b�&k!��;W��%ym ����5�� Xz��+F �p>���( ^�tR��p%� ����-�8GTF~nM}z�f�����L̎$��+.��L�7k����UDզ� �%c)���+x]�� �� $8�E�"�1ZIR��.�>��4IU��dmL��AP j2UC�

Additional context

Same issue as #646

I tried the following workaround, without success:
Manually set a model name: deepseek/deepseek-v4-pro
Clicked on "Test Connection" and "Send Test Message"

Image

OpenAI chat() non-stream response: Failed to parse JSON response (Unexpected token '', "��"... is not valid JSON). Body starts with: ���R�.���B0��Bb��Bb��Bb��Bb��Bb��Bb��Bb��Bb���TAn�0�ʆ�\dW����I9E��F\Y�)R�Rv�@@�=�� ��.��v��I�p8;;K�Ih%�b���r<�����h���7d�����ò��G�?�D��{���

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @ShivaThomas on GitHub (May 13, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/781 Originally assigned to: @Promansis on GitHub. ## Summary Can't retrieve the list of model from OpenRouter ## Expected behavior List of model should be displayed ## Actual behavior <img width="748" height="491" alt="Image" src="https://github.com/user-attachments/assets/75013510-0fde-498e-83e7-7540db833d5c" /> ## Steps to reproduce 1. Create new Connection, with provider 2. Select Provider: OpenRouter 3. Paste you API Key 4. Click Model search 5. Click Fetch models from API ## Environment - Marinara Engine version: 1.5.9 Build: 3d4a119 - Install type: source - OS + version: MacOS 26.4.1 - Browser: Both Firefox 151, Safari 26.4, with or without VPN ## Logs, screenshots, or video <img width="748" height="491" alt="Image" src="https://github.com/user-attachments/assets/75013510-0fde-498e-83e7-7540db833d5c" /> Failed to fetch models: ���ݎ�6�_��M�Ʋ,�7�(0�"�)�.r�*-Q2a�TEʞ�`�}��^��琒f��3���bƖ�?���ȟ���-����[zT�u�J���u�|U�ڟ �~F��^B��<�"֢λ4P�j�����hF�����<�h�b�&k!��;W��%ym ��`��5�� Xz��+F �p>_���( ^�tR��p%� ����-�8GTF~nM}z�f�����L̎$��+.��L�7k����UDզ� �%c)���+x]�� �� $8�E�"�1ZIR��.�>��4IU��dmL��AP j2UC� ## Additional context Same issue as #646 I tried the following workaround, without success: Manually set a model name: deepseek/deepseek-v4-pro Clicked on "Test Connection" and "Send Test Message" <img width="754" height="384" alt="Image" src="https://github.com/user-attachments/assets/13457fa2-3dcc-446f-b173-86afa2b494a3" /> OpenAI chat() non-stream response: Failed to parse JSON response (Unexpected token '', "��"... is not valid JSON). Body starts with: ���R�.���B0��Bb��Bb��Bb��Bb��Bb��Bb��Bb��Bb���TAn�0�ʆ�\dW����I9E��F\Y�)R�Rv�@@�=�� ��.��v��I�p8;;K�Ih%�b���r<�����h���7d�����ò��G�?�D��{��� ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:28:09 +07:00
Author
Owner

@LukaTheHero commented on GitHub (May 13, 2026):

Couldn't reproduce on my end. The garbled body starts with 0x1F 0x8B which is the gzip magic header — so the response is staying gzip-compressed when our server reads it. Node's built-in fetch (undici) is supposed to auto-decompress Content-Encoding, and it does on my install even when I mimic our exact request path. So the trigger is something in your environment.

To narrow this down, could you share:

  1. node --version from where you launch Marinara.

  2. Any proxy / VPN active? Even if you've already toggled VPN, please run env | grep -i proxy and paste the output, plus the name of your VPN client if any.

  3. From the same machine: curl -sv https://openrouter.ai/api/v1/models -o /tmp/or.bin 2>&1 | head -30 — paste the response headers section. Then file /tmp/or.bin and paste that too. That tells us what compression your network path actually negotiates.

  4. Save this as test-fetch.mjs and run node test-fetch.mjs with the same Node you use to start Marinara:

    const r = await fetch("https://openrouter.ai/api/v1/models");
    console.log("content-encoding:", r.headers.get("content-encoding"));
    const buf = Buffer.from(await r.arrayBuffer());
    console.log("first 4 bytes hex:", buf.slice(0, 4).toString("hex"));
    console.log("first 60 chars:", buf.slice(0, 60).toString("utf8"));
    

    If the first 4 bytes are 1f8b, undici isn't auto-decompressing for your install — that's the actual bug to fix.

Once I have those, I can either fix the root cause or ship a defensive workaround that decompresses ourselves.

<!-- gh-comment-id:4441905631 --> @LukaTheHero commented on GitHub (May 13, 2026): Couldn't reproduce on my end. The garbled body starts with `0x1F 0x8B` which is the gzip magic header — so the response is staying gzip-compressed when our server reads it. Node's built-in fetch (undici) is supposed to auto-decompress Content-Encoding, and it does on my install even when I mimic our exact request path. So the trigger is something in your environment. To narrow this down, could you share: 1. `node --version` from where you launch Marinara. 2. Any proxy / VPN active? Even if you've already toggled VPN, please run `env | grep -i proxy` and paste the output, plus the name of your VPN client if any. 3. From the same machine: `curl -sv https://openrouter.ai/api/v1/models -o /tmp/or.bin 2>&1 | head -30` — paste the response headers section. Then `file /tmp/or.bin` and paste that too. That tells us what compression your network path actually negotiates. 4. Save this as `test-fetch.mjs` and run `node test-fetch.mjs` with the **same Node you use to start Marinara**: ```js const r = await fetch("https://openrouter.ai/api/v1/models"); console.log("content-encoding:", r.headers.get("content-encoding")); const buf = Buffer.from(await r.arrayBuffer()); console.log("first 4 bytes hex:", buf.slice(0, 4).toString("hex")); console.log("first 60 chars:", buf.slice(0, 60).toString("utf8")); ``` If the first 4 bytes are `1f8b`, undici isn't auto-decompressing for your install — that's the actual bug to fix. Once I have those, I can either fix the root cause or ship a defensive workaround that decompresses ourselves.
Author
Owner

@grinmaul commented on GitHub (May 13, 2026):

Couldn't reproduce on my end. The garbled body starts with 0x1F 0x8B which is the gzip magic header — so the response is staying gzip-compressed when our server reads it. Node's built-in fetch (undici) is supposed to auto-decompress Content-Encoding, and it does on my install even when I mimic our exact request path. So the trigger is something in your environment.

To narrow this down, could you share:

  1. node --version from where you launch Marinara.

node --version
v26.1.0

  1. Any proxy / VPN active? Even if you've already toggled VPN, please run env | grep -i proxy and paste the output, plus the name of your VPN client if any.
  2. From the same machine: curl -sv https://openrouter.ai/api/v1/models -o /tmp/or.bin 2>&1 | head -30 — paste the response headers section. Then file /tmp/or.bin and paste that too. That tells us what compression your network path actually negotiates.

curl -sv https://openrouter.ai/api/v1/models -o /tmp/or.bin 2>&1 | head -30

  • Trying [2606:4700::6812:373]:443...
  • Immediate connect fail for 2606:4700::6812:373: Network is unreachable
  • connect to 2606:4700::6812:373 port 443 from :: port 0 failed: Success
  • Trying [2606:4700::6812:273]:443...
  • Immediate connect fail for 2606:4700::6812:273: Network is unreachable
  • connect to 2606:4700::6812:273 port 443 from :: port 0 failed: Success
  • Host openrouter.ai:443 was resolved.
  • IPv6: 2606:4700::6812:373, 2606:4700::6812:273
  • IPv4: 104.18.2.115, 104.18.3.115
  • Trying 104.18.2.115:443...
  • ALPN: curl offers h2,http/1.1
    } [5 bytes data]
  • TLSv1.3 (OUT), TLS handshake, Client hello (1):
    } [1568 bytes data]
  • SSL Trust Anchors:
  • CAfile: /etc/ssl/certs/ca-certificates.crt
    { [5 bytes data]
  • TLSv1.3 (IN), TLS handshake, Server hello (2):
    { [1210 bytes data]
  • TLSv1.3 (IN), TLS change cipher, Change cipher spec (1):
    { [1 bytes data]
  • TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
    { [19 bytes data]
  • TLSv1.3 (IN), TLS handshake, Unknown (25):
    { [1834 bytes data]
  • TLSv1.3 (IN), TLS handshake, CERT verify (15):
    { [78 bytes data]
  • TLSv1.3 (IN), TLS handshake, Finished (20):
    { [52 bytes data]
  • TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
  1. Save this as test-fetch.mjs and run node test-fetch.mjs with the same Node you use to start Marinara:
    const r = await fetch("https://openrouter.ai/api/v1/models");
    console.log("content-encoding:", r.headers.get("content-encoding"));
    const buf = Buffer.from(await r.arrayBuffer());
    console.log("first 4 bytes hex:", buf.slice(0, 4).toString("hex"));
    console.log("first 60 chars:", buf.slice(0, 60).toString("utf8"));

node test-fetch.mjs
content-encoding: gzip
first 4 bytes hex: 7b226461
first 60 chars: {"data":[{"id":"anthropic/claude-opus-4.7-fast","canonical_s

If the first 4 bytes are 1f8b, undici isn't auto-decompressing for your install — that's the actual bug to fix.

Once I have those, I can either fix the root cause or ship a defensive workaround that decompresses ourselves.

<!-- gh-comment-id:4442763588 --> @grinmaul commented on GitHub (May 13, 2026): > Couldn't reproduce on my end. The garbled body starts with `0x1F 0x8B` which is the gzip magic header — so the response is staying gzip-compressed when our server reads it. Node's built-in fetch (undici) is supposed to auto-decompress Content-Encoding, and it does on my install even when I mimic our exact request path. So the trigger is something in your environment. > > To narrow this down, could you share: > > 1. `node --version` from where you launch Marinara. node --version v26.1.0 > 2. Any proxy / VPN active? Even if you've already toggled VPN, please run `env | grep -i proxy` and paste the output, plus the name of your VPN client if any. > 3. From the same machine: `curl -sv https://openrouter.ai/api/v1/models -o /tmp/or.bin 2>&1 | head -30` — paste the response headers section. Then `file /tmp/or.bin` and paste that too. That tells us what compression your network path actually negotiates. curl -sv https://openrouter.ai/api/v1/models -o /tmp/or.bin 2>&1 | head -30 * Trying [2606:4700::6812:373]:443... * Immediate connect fail for 2606:4700::6812:373: Network is unreachable * connect to 2606:4700::6812:373 port 443 from :: port 0 failed: Success * Trying [2606:4700::6812:273]:443... * Immediate connect fail for 2606:4700::6812:273: Network is unreachable * connect to 2606:4700::6812:273 port 443 from :: port 0 failed: Success * Host openrouter.ai:443 was resolved. * IPv6: 2606:4700::6812:373, 2606:4700::6812:273 * IPv4: 104.18.2.115, 104.18.3.115 * Trying 104.18.2.115:443... * ALPN: curl offers h2,http/1.1 } [5 bytes data] * TLSv1.3 (OUT), TLS handshake, Client hello (1): } [1568 bytes data] * SSL Trust Anchors: * CAfile: /etc/ssl/certs/ca-certificates.crt { [5 bytes data] * TLSv1.3 (IN), TLS handshake, Server hello (2): { [1210 bytes data] * TLSv1.3 (IN), TLS change cipher, Change cipher spec (1): { [1 bytes data] * TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8): { [19 bytes data] * TLSv1.3 (IN), TLS handshake, Unknown (25): { [1834 bytes data] * TLSv1.3 (IN), TLS handshake, CERT verify (15): { [78 bytes data] * TLSv1.3 (IN), TLS handshake, Finished (20): { [52 bytes data] * TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1): > 4. Save this as `test-fetch.mjs` and run `node test-fetch.mjs` with the **same Node you use to start Marinara**: > const r = await fetch("https://openrouter.ai/api/v1/models"); > console.log("content-encoding:", r.headers.get("content-encoding")); > const buf = Buffer.from(await r.arrayBuffer()); > console.log("first 4 bytes hex:", buf.slice(0, 4).toString("hex")); > console.log("first 60 chars:", buf.slice(0, 60).toString("utf8")); > node test-fetch.mjs content-encoding: gzip first 4 bytes hex: 7b226461 first 60 chars: {"data":[{"id":"anthropic/claude-opus-4.7-fast","canonical_s > > > > > > > > If the first 4 bytes are `1f8b`, undici isn't auto-decompressing for your install — that's the actual bug to fix. > > Once I have those, I can either fix the root cause or ship a defensive workaround that decompresses ourselves.
Author
Owner

@LukaTheHero commented on GitHub (May 13, 2026):

I'll get back to you the second I'm home. But I believe another dev reproduced and solved the issue already

<!-- gh-comment-id:4442897818 --> @LukaTheHero commented on GitHub (May 13, 2026): I'll get back to you the second I'm home. But I believe another dev reproduced and solved the issue already
Author
Owner

@grinmaul commented on GitHub (May 13, 2026):

I'll get back to you the second I'm home. But I believe another dev reproduced and solved the issue already

Not sure if it matters, my problem is with Venice api, i don't have openrouter, but figured its the same issue since my responses from Venice look the same as the above.

<!-- gh-comment-id:4443095198 --> @grinmaul commented on GitHub (May 13, 2026): > I'll get back to you the second I'm home. But I believe another dev reproduced and solved the issue already Not sure if it matters, my problem is with Venice api, i don't have openrouter, but figured its the same issue since my responses from Venice look the same as the above.
Author
Owner

@ShivaThomas commented on GitHub (May 13, 2026):

Wow, that fast investigation! 🥰 Thank you @Promansis and @grinmaul!

  1. node --version from where you launch Marinara.
    node --version v26.0.0
  1. Any proxy / VPN active? Even if you've already toggled VPN, please run env | grep -i proxy and paste the output, plus the name of your VPN client if any.
    "env | grep -I proxy" returns empty.
    VPN is ProtonVPN.
  1. From the same machine: curl -sv https://openrouter.ai/api/v1/models -o /tmp/or.bin 2>&1 | head -30 — paste the response headers section. Then file /tmp/or.bin and paste that too. That tells us what compression your network path actually negotiates.>
* Host openrouter.ai:443 was resolved.
* IPv6: (none)
* IPv4: 104.18.3.115, 104.18.2.115
*   Trying 104.18.3.115:443...
* Connected to openrouter.ai (104.18.3.115) port 443
* ALPN: curl offers h2,http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
} [318 bytes data]
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* (304) (IN), TLS handshake, Server hello (2):
{ [122 bytes data]
* (304) (IN), TLS handshake, Unknown (8):
{ [19 bytes data]
* (304) (IN), TLS handshake, Certificate (11):
{ [2535 bytes data]
* (304) (IN), TLS handshake, CERT verify (15):
{ [79 bytes data]
* (304) (IN), TLS handshake, Finished (20):
{ [36 bytes data]
* (304) (OUT), TLS handshake, Finished (20):
} [36 bytes data]
* SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256 / [blank] / UNDEF
* ALPN: server accepted h2
* Server certificate:
*  subject: CN=openrouter.ai
*  start date: Apr 24 22:57:54 2026 GMT
*  expire date: Jul 23 23:57:50 2026 GMT
*  subjectAltName: host "openrouter.ai" matched cert's "openrouter.ai"
*  issuer: C=US; O=Google Trust Services; CN=WE1

/tmp/or.bin: JSON data

  1. Save this as test-fetch.mjs and run node test-fetch.mjs with the same Node you use to start Marinara:
    content-encoding: gzip
    first 4 bytes hex: 7b226461
    first 60 chars: {"data":[{"id":"anthropic/claude-opus-4.7-fast","canonical_s
<!-- gh-comment-id:4445308555 --> @ShivaThomas commented on GitHub (May 13, 2026): Wow, that fast investigation! 🥰 Thank you @Promansis and @grinmaul! > > 1. `node --version` from where you launch Marinara. node --version v26.0.0 > > 2. Any proxy / VPN active? Even if you've already toggled VPN, please run `env | grep -i proxy` and paste the output, plus the name of your VPN client if any. "env | grep -I proxy" returns empty. VPN is ProtonVPN. > > 3. From the same machine: `curl -sv https://openrouter.ai/api/v1/models -o /tmp/or.bin 2>&1 | head -30` — paste the response headers section. Then `file /tmp/or.bin` and paste that too. That tells us what compression your network path actually negotiates.> ``` * Host openrouter.ai:443 was resolved. * IPv6: (none) * IPv4: 104.18.3.115, 104.18.2.115 * Trying 104.18.3.115:443... * Connected to openrouter.ai (104.18.3.115) port 443 * ALPN: curl offers h2,http/1.1 * (304) (OUT), TLS handshake, Client hello (1): } [318 bytes data] * CAfile: /etc/ssl/cert.pem * CApath: none * (304) (IN), TLS handshake, Server hello (2): { [122 bytes data] * (304) (IN), TLS handshake, Unknown (8): { [19 bytes data] * (304) (IN), TLS handshake, Certificate (11): { [2535 bytes data] * (304) (IN), TLS handshake, CERT verify (15): { [79 bytes data] * (304) (IN), TLS handshake, Finished (20): { [36 bytes data] * (304) (OUT), TLS handshake, Finished (20): } [36 bytes data] * SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256 / [blank] / UNDEF * ALPN: server accepted h2 * Server certificate: * subject: CN=openrouter.ai * start date: Apr 24 22:57:54 2026 GMT * expire date: Jul 23 23:57:50 2026 GMT * subjectAltName: host "openrouter.ai" matched cert's "openrouter.ai" * issuer: C=US; O=Google Trust Services; CN=WE1 ``` /tmp/or.bin: JSON data > > 4. Save this as `test-fetch.mjs` and run `node test-fetch.mjs` with the **same Node you use to start Marinara**: content-encoding: gzip first 4 bytes hex: 7b226461 first 60 chars: {"data":[{"id":"anthropic/claude-opus-4.7-fast","canonical_s
Author
Owner

@ShivaThomas commented on GitHub (May 13, 2026):

Please note that once I manually paste a model id, as illustrated under "Additional context" in my first message, the connection works during RP. It's only the Connection screen and the listing of models that have this issue.

<!-- gh-comment-id:4445329967 --> @ShivaThomas commented on GitHub (May 13, 2026): Please note that once I manually paste a model id, as illustrated under "Additional context" in my first message, the connection works during RP. It's only the Connection screen and the listing of models that have this issue.
Author
Owner

@Trijo56 commented on GitHub (May 14, 2026):

I put in my api and model and it won't recognize the msg output when I try sending a msg (model is openrouter/free btw)

<!-- gh-comment-id:4448659664 --> @Trijo56 commented on GitHub (May 14, 2026): I put in my api and model and it won't recognize the msg output when I try sending a msg (model is openrouter/free btw)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#375
No description provided.