[GH-ISSUE #22] Embedding generation with OpenRouter provider doesn't work (404 Not Found) #3

Closed
opened 2026-10-20 17:23:55 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @yukariin on GitHub (Mar 24, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/22

Originally assigned to: @SpicyMarinara on GitHub.

Generating embeddings for lorebooks doesn't seem to work when using OpenRouter as the provider.

The error message looks like this:

{
  "level": 50,
  "time": 1774333089697,
  "pid": 1,
  "hostname": "marinara-engine-764b757d6-6zhxv",
  "reqId": "req-sr",
  "err": {
    "type": "Error",
    "message": "Embedding request failed (404): Not Found | OpenRouter",
    "stack": "Error: Embedding request failed (404): Not Found | OpenRouter\n at OpenAIProvider.embed (file:///app/packages/server/dist/services/llm/base-provider.js:81:19)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async Object.<anonymous> (file:///app/packages/server/dist/routes/lorebooks.routes.js:191:32)"
  },
  "msg": "Embedding request failed (404): Not Found | OpenRouter"
}

A quick code search points to this line.

With OpenRouter as the connection provider, this.baseUrl will be https://openrouter.ai/api/v1 by default. Because the code appends /v1/embeddings, this results in the final URL https://openrouter.ai/api/v1/v1/embeddings (notice the duplicate v1/v1), which is NOT correct for OpenRouter embeddings.

The correct URL should be https://openrouter.ai/api/v1/embeddings, according to the official OpenRouter documentation.

Originally created by @yukariin on GitHub (Mar 24, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/22 Originally assigned to: @SpicyMarinara on GitHub. Generating embeddings for lorebooks doesn't seem to work when using OpenRouter as the provider. The error message looks like this: ```json { "level": 50, "time": 1774333089697, "pid": 1, "hostname": "marinara-engine-764b757d6-6zhxv", "reqId": "req-sr", "err": { "type": "Error", "message": "Embedding request failed (404): Not Found | OpenRouter", "stack": "Error: Embedding request failed (404): Not Found | OpenRouter\n at OpenAIProvider.embed (file:///app/packages/server/dist/services/llm/base-provider.js:81:19)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async Object.<anonymous> (file:///app/packages/server/dist/routes/lorebooks.routes.js:191:32)" }, "msg": "Embedding request failed (404): Not Found | OpenRouter" } ``` A quick code search points to [this line](https://github.com/SpicyMarinara/Marinara-Engine/blob/1fb11d67fae98b34b5a664423a46518ce1ef0d9b/packages/server/src/services/llm/base-provider.ts#L161). With OpenRouter as the connection provider, `this.baseUrl` will be `https://openrouter.ai/api/v1` by default. Because the code appends `/v1/embeddings`, this results in the final URL `https://openrouter.ai/api/v1/v1/embeddings` (notice the duplicate `v1/v1`), which is NOT correct for OpenRouter embeddings. The correct URL should be `https://openrouter.ai/api/v1/embeddings`, according to the official [OpenRouter documentation](https://openrouter.ai/docs/api/reference/embeddings).
Author
Owner

@SpicyMarinara commented on GitHub (Mar 24, 2026):

Fixed.

<!-- gh-comment-id:4116694683 --> @SpicyMarinara commented on GitHub (Mar 24, 2026): Fixed.
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#3
No description provided.