[GH-ISSUE #3405] [Feature]: Add raw provider endpoints for extension utility calls #1843

Closed
opened 2026-10-21 05:43:11 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @kaldigo on GitHub (Jul 9, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3405

Originally assigned to: @SpicyMarinara on GitHub.

What problem does this solve?

Extensions sometimes need to make small, non-mutating model calls without going through the full chat generation pipeline.

/api/generate/dryRun is useful for previewing Marinara generation, but it still requires a chat and can include chat/preset/prompt assembly behavior. For extension workflows such as style checking, scoring, classification, or lightweight text transformation, it would be cleaner to send explicit raw messages to a saved provider connection and receive the model response without chat history, lore, agents, tools, persistence, or prompt mutation.

Embeddings have a similar gap: provider embedding support exists internally for lorebooks/memory recall, but there is no generic non-mutating endpoint for extensions or utility callers to request embeddings from a saved connection.

Proposed solution

Add low-level, non-mutating raw provider endpoints under /api/generate:

  • POST /api/generate/raw

    • Accepts a saved connectionId.
    • Accepts explicit messages.
    • Uses the connection's configured chat model and provider settings.
    • Supports non-streaming and streaming responses.
    • Does not persist chat messages, swipes, prompt caches, agent runs, tools, or webhook side effects.
    • Supports abort via POST /api/generate/raw/abort.
  • POST /api/generate/raw/embeddings

    • Accepts a saved connectionId.
    • Accepts text input.
    • Resolves embeddings from the selected connection's configured embedding settings, including embeddingModel, embeddingBaseUrl, embeddingConnectionId, and local sidecar behavior where supported.
    • Does not mutate lorebooks, memory, chat state, or prompt state.

This would give extensions a safe primitive for model utility calls while keeping provider configuration server-side.

Alternatives considered

  • Reusing /api/generate/dryRun: this still requires chat context and is designed around Marinara prompt assembly rather than raw provider calls.
  • Running a custom agent manually: agents add agent scaffolding, lore/context defaults, result-type handling, and may write agent output metadata depending on invocation path.
  • Exposing arbitrary base URL/API key inputs: this would be riskier and unnecessary because saved connections already contain provider configuration.

Additional context

This is useful for extension workflows like style linting, prose checks, scoring, classification, and RAG-style helper calls where the caller wants explicit control over the prompt and no chat-generation side effects.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @kaldigo on GitHub (Jul 9, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3405 Originally assigned to: @SpicyMarinara on GitHub. ## What problem does this solve? Extensions sometimes need to make small, non-mutating model calls without going through the full chat generation pipeline. `/api/generate/dryRun` is useful for previewing Marinara generation, but it still requires a chat and can include chat/preset/prompt assembly behavior. For extension workflows such as style checking, scoring, classification, or lightweight text transformation, it would be cleaner to send explicit raw messages to a saved provider connection and receive the model response without chat history, lore, agents, tools, persistence, or prompt mutation. Embeddings have a similar gap: provider embedding support exists internally for lorebooks/memory recall, but there is no generic non-mutating endpoint for extensions or utility callers to request embeddings from a saved connection. ## Proposed solution Add low-level, non-mutating raw provider endpoints under `/api/generate`: - `POST /api/generate/raw` - Accepts a saved `connectionId`. - Accepts explicit `messages`. - Uses the connection's configured chat model and provider settings. - Supports non-streaming and streaming responses. - Does not persist chat messages, swipes, prompt caches, agent runs, tools, or webhook side effects. - Supports abort via `POST /api/generate/raw/abort`. - `POST /api/generate/raw/embeddings` - Accepts a saved `connectionId`. - Accepts text input. - Resolves embeddings from the selected connection's configured embedding settings, including `embeddingModel`, `embeddingBaseUrl`, `embeddingConnectionId`, and local sidecar behavior where supported. - Does not mutate lorebooks, memory, chat state, or prompt state. This would give extensions a safe primitive for model utility calls while keeping provider configuration server-side. ## Alternatives considered - Reusing `/api/generate/dryRun`: this still requires chat context and is designed around Marinara prompt assembly rather than raw provider calls. - Running a custom agent manually: agents add agent scaffolding, lore/context defaults, result-type handling, and may write agent output metadata depending on invocation path. - Exposing arbitrary base URL/API key inputs: this would be riskier and unnecessary because saved connections already contain provider configuration. ## Additional context This is useful for extension workflows like style linting, prose checks, scoring, classification, and RAG-style helper calls where the caller wants explicit control over the prompt and no chat-generation side effects. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
Author
Owner

@SpicyMarinara commented on GitHub (Jul 9, 2026):

Very useful stuff, thank you!

<!-- gh-comment-id:4927459348 --> @SpicyMarinara commented on GitHub (Jul 9, 2026): Very useful stuff, thank you!
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#1843
No description provided.