[PR #988] [CLOSED] Add encode and decode API endpoints #41670

Closed
opened 2026-04-24 21:31:15 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/988
Author: @samdevbr
Created: 11/3/2023
Status: Closed

Base: mainHead: main


📝 Commits (3)

  • 3759bac creating /api/encode and /api/decode endpoints
  • 8eebd85 documenting /api/encode and /api/decode endpoints
  • ee6777e Merge branch 'jmorganca:main' into main

📊 Changes

3 files changed (+190 additions, -0 deletions)

View changed files

📝 api/types.go (+22 -0)
📝 docs/api.md (+74 -0)
📝 server/routes.go (+94 -0)

📄 Description

While working on a POC project for the company I work at I've come across the need for encoding and decoding prompts.

We are building a long-term memory POC and that requires token management, as of now we cannot predict how long the token list of a prompt might be.

This PR creates the following endpoints:

  • /api/encode
  • /api/decode

Both endpoints together with the existing ones will give us the flexibility to smartly manage prompt tokens.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/988 **Author:** [@samdevbr](https://github.com/samdevbr) **Created:** 11/3/2023 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (3) - [`3759bac`](https://github.com/ollama/ollama/commit/3759bac2672f6214ea01198352a9761e242d492e) creating `/api/encode` and `/api/decode` endpoints - [`8eebd85`](https://github.com/ollama/ollama/commit/8eebd85352a3ed80c57e18863b906cfec270d4cf) documenting `/api/encode` and `/api/decode` endpoints - [`ee6777e`](https://github.com/ollama/ollama/commit/ee6777e4523e53258d05f645b779b33ba9f24c76) Merge branch 'jmorganca:main' into main ### 📊 Changes **3 files changed** (+190 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `api/types.go` (+22 -0) 📝 `docs/api.md` (+74 -0) 📝 `server/routes.go` (+94 -0) </details> ### 📄 Description While working on a POC project for the company I work at I've come across the need for encoding and decoding prompts. We are building a long-term memory POC and that requires token management, as of now we cannot predict how long the token list of a prompt might be. This PR creates the following endpoints: - `/api/encode` - `/api/decode` Both endpoints together with the existing ones will give us the flexibility to smartly manage prompt tokens. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-24 21:31:15 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#41670