[GH-ISSUE #3260] [Engine] add missing llama.cpp server endpoints (/tokenize, /completion, /embedding, /metrics) #1319

Closed
opened 2026-11-04 01:50:19 +07:00 by bsakaguchi · 5 comments
Owner

Originally created by @jeremyoha450 on GitHub (Oct 19, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3260

Posible to add more of the llama outputs, etc? (i've add some myself. but other might like them too)

Token and template routes

POST /tokenize is missing upstream. A local patch adds it, plus /v1/tokenize, with with_pieces.
POST /detokenize is missing upstream. A local patch adds it, plus /v1/detokenize.
POST /apply-template is missing upstream. A local patch adds it, plus /v1/apply-template, including response_format schema text and input_tokens.
There is no llama.cpp-compatible add_special / BOS handling on tokenize.
There is no /tokenize of a chat message list without a separate apply-template call.

Native generation

POST /completion is missing, including the native stream fields content, stop, stop_type, tokens_predicted, tokens_evaluated, tokens_cached, and generation_settings.
POST /completions is missing.
POST /infill is missing.
POST /v1/completions is missing (legacy non-chat completions).

Embeddings and adapters

POST /embedding is missing.
POST /embeddings is missing.
POST /v1/embeddings is missing.
GET /lora-adapters is missing.
POST /lora-adapters is missing.

Slots and metrics

POST /slots/{id}?action=erase is missing. Save and restore exist.
Prometheus text on GET /metrics is missing. Strata’s /metrics is a different JSON document.
The llama.cpp timings object is missing from chat chunks: prompt_ms, predicted_ms, prompt_per_token_ms, predicted_per_token_ms, prompt_per_second, predicted_per_second.

Originally created by @jeremyoha450 on GitHub (Oct 19, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/3260 Posible to add more of the llama outputs, etc? (i've add some myself. but other might like them too) Token and template routes POST /tokenize is missing upstream. A local patch adds it, plus /v1/tokenize, with with_pieces. POST /detokenize is missing upstream. A local patch adds it, plus /v1/detokenize. POST /apply-template is missing upstream. A local patch adds it, plus /v1/apply-template, including response_format schema text and input_tokens. There is no llama.cpp-compatible add_special / BOS handling on tokenize. There is no /tokenize of a chat message list without a separate apply-template call. Native generation POST /completion is missing, including the native stream fields content, stop, stop_type, tokens_predicted, tokens_evaluated, tokens_cached, and generation_settings. POST /completions is missing. POST /infill is missing. POST /v1/completions is missing (legacy non-chat completions). Embeddings and adapters POST /embedding is missing. POST /embeddings is missing. POST /v1/embeddings is missing. GET /lora-adapters is missing. POST /lora-adapters is missing. Slots and metrics POST /slots/{id}?action=erase is missing. Save and restore exist. Prometheus text on GET /metrics is missing. Strata’s /metrics is a different JSON document. The llama.cpp timings object is missing from chat chunks: prompt_ms, predicted_ms, prompt_per_token_ms, predicted_per_token_ms, prompt_per_second, predicted_per_second.
bsakaguchi 2026-11-04 01:50:19 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 19, 2026):

Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:

  • Add the Strata version (Settings > About, or strata --version).
  • Add your graphics card with its VRAM, your RAM and your operating system.

Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment /reopen.

Details: CONTRIBUTING.md

<!-- gh-comment-id:6276828334 --> @github-actions[bot] commented on GitHub (Oct 19, 2026): Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing: - [ ] Add the Strata version (Settings > About, or `strata --version`). - [ ] Add your graphics card with its VRAM, your RAM and your operating system. Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment `/reopen`. Details: [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md)
Author
Owner

@Niko1221 commented on GitHub (Oct 21, 2026):

Thanks for the list. Some of it is planned (the legacy /v1/completions, /tokenize and /embedding routes are on the API list; PR #2278 covers part). /metrics as Prometheus text and /slots/{id}?action=erase are small. If you can share your local patch as a PR, we will review it. Which of the routes do you use most? That tells us what to do first.

<!-- gh-comment-id:6308092461 --> @Niko1221 commented on GitHub (Oct 21, 2026): Thanks for the list. Some of it is planned (the legacy `/v1/completions`, `/tokenize` and `/embedding` routes are on the API list; PR #2278 covers part). `/metrics` as Prometheus text and `/slots/{id}?action=erase` are small. If you can share your local patch as a PR, we will review it. Which of the routes do you use most? That tells us what to do first.
Author
Owner

@Niko1221 commented on GitHub (Oct 22, 2026):

Thanks — following up: which of the routes do you use most, and can you share your local patch as a PR? That tells us what to do first; nothing else is needed from you.

<!-- gh-comment-id:6337179883 --> @Niko1221 commented on GitHub (Oct 22, 2026): Thanks — following up: which of the routes do you use most, and can you share your local patch as a PR? That tells us what to do first; nothing else is needed from you.
Author
Owner

@jeremyoha450 commented on GitHub (Oct 22, 2026):

ive only done Three routes, added to the server.py after the pull:
POST /tokenize and /v1/tokenize — text in, token ids out (with optional with_pieces).
POST /detokenize and /v1/detokenize — token ids in, text out.
POST /apply-template and /v1/apply-template — same render as a chat request, including response_format schema text, and optional input_tokens.
They sit next to /v1/messages/count_tokens in the routing block, and the three methods are _tokenize, _detokenize and _apply_template.Nothing else was changed in that file. The guards (repeat_stop_tokens, reasoning_loop_recovery) and reasoning_effort are config keys, not edits to .

the other i couldnt do as it involved too much editing other files

if you could do as much as you can it would be nice. i know a few other people wanted this as well they commented on previous posts i did before they wer closed/deleted.

<!-- gh-comment-id:6341102727 --> @jeremyoha450 commented on GitHub (Oct 22, 2026): ive only done Three routes, added to the server.py after the pull: POST /tokenize and /v1/tokenize — text in, token ids out (with optional with_pieces). POST /detokenize and /v1/detokenize — token ids in, text out. POST /apply-template and /v1/apply-template — same render as a chat request, including response_format schema text, and optional input_tokens. They sit next to /v1/messages/count_tokens in the routing block, and the three methods are _tokenize, _detokenize and _apply_template.Nothing else was changed in that file. The guards (repeat_stop_tokens, reasoning_loop_recovery) and reasoning_effort are config keys, not edits to . the other i couldnt do as it involved too much editing other files if you could do as much as you can it would be nice. i know a few other people wanted this as well they commented on previous posts i did before they wer closed/deleted.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 25, 2026):

Closing this issue because it still did not follow the format after 5 days. That is housekeeping, not a rejection.

To bring it back: fix the title (area prefix) and the missing parts, then comment /reopen. A check runs and reopens it, or tells you what is still missing. See CONTRIBUTING.md.

<!-- gh-comment-id:6395803999 --> @github-actions[bot] commented on GitHub (Oct 25, 2026): Closing this issue because it still did not follow the format after 5 days. That is housekeeping, not a rejection. To bring it back: fix the title (area prefix) and the missing parts, then comment `/reopen`. A check runs and reopens it, or tells you what is still missing. See [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
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
Niko1221/Strata#1319
No description provided.