Inference
Container Tokenization
Convert text input into token IDs.
POST
Tokenization
Convert text input into token IDs.
Last modified on June 9, 2026
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
Try GLM-5.3 and GLM-5.3-Flash today. To learn more, see the FriendliAI Blog.
curl --request POST \
--url http://localhost:8000/v1/tokenize \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "What is generative AI?"
}
'import requests
url = "http://localhost:8000/v1/tokenize"
payload = { "prompt": "What is generative AI?" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({prompt: 'What is generative AI?'})
};
fetch('http://localhost:8000/v1/tokenize', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:8000/v1/tokenize"
payload := strings.NewReader("{\n \"prompt\": \"What is generative AI?\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"tokens": [
128000,
3923,
374,
1803,
1413,
15592,
30
]
}Convert text input into token IDs.
curl --request POST \
--url http://localhost:8000/v1/tokenize \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "What is generative AI?"
}
'import requests
url = "http://localhost:8000/v1/tokenize"
payload = { "prompt": "What is generative AI?" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({prompt: 'What is generative AI?'})
};
fetch('http://localhost:8000/v1/tokenize', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:8000/v1/tokenize"
payload := strings.NewReader("{\n \"prompt\": \"What is generative AI?\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"tokens": [
128000,
3923,
374,
1803,
1413,
15592,
30
]
}Was this page helpful?