[GH-ISSUE #6257] [Feature]: Expose the built-in token estimator to Personal Extensions #3493

Closed
opened 2026-10-21 06:03:38 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @minikkeuen on GitHub (Sep 16, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6257

Originally assigned to: @SpicyMarinara on GitHub.

What problem does this solve?

Personal Extensions currently do not have a public API for using Marinara's built-in text token estimator.

Extensions that need to display or calculate token estimates have to implement their own estimation logic. This can produce estimates that differ from Marinara's own UI and requires extension authors to duplicate and maintain token estimation logic independently.

Proposed solution

Expose Marinara's built-in text token estimator through the Personal Extension API.

For example:

const tokens = marinara.estimateTextTokens(text);

The API would be available to Browser, Full Page, and Server Personal Extensions so they can use the same estimation logic as Marinara itself.

Alternatives considered

Personal Extensions could implement their own token estimation logic, but this duplicates core behavior and can become inconsistent when Marinara's estimator changes.

Extensions could also use an external tokenizer, but that adds unnecessary dependencies and would not necessarily match Marinara's built-in estimates.

Additional context

This would be useful for extensions that display token counts, context usage, or other token-related information.

The API only needs to expose the estimate result; extensions do not need access to the estimator's internal implementation details.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @minikkeuen on GitHub (Sep 16, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6257 Originally assigned to: @SpicyMarinara on GitHub. ## What problem does this solve? Personal Extensions currently do not have a public API for using Marinara's built-in text token estimator. Extensions that need to display or calculate token estimates have to implement their own estimation logic. This can produce estimates that differ from Marinara's own UI and requires extension authors to duplicate and maintain token estimation logic independently. ## Proposed solution Expose Marinara's built-in text token estimator through the Personal Extension API. For example: const tokens = marinara.estimateTextTokens(text); The API would be available to Browser, Full Page, and Server Personal Extensions so they can use the same estimation logic as Marinara itself. ## Alternatives considered Personal Extensions could implement their own token estimation logic, but this duplicates core behavior and can become inconsistent when Marinara's estimator changes. Extensions could also use an external tokenizer, but that adds unnecessary dependencies and would not necessarily match Marinara's built-in estimates. ## Additional context This would be useful for extensions that display token counts, context usage, or other token-related information. The API only needs to expose the estimate result; extensions do not need access to the estimator's internal implementation details. ## Template check - [ ] I DID NOT read this template and provide the requested details.
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#3493
No description provided.