Documentation IndexFetch the complete documentation index at: /docs/llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
Try Z.ai's GLM-5.2 model today. To learn more, see the FriendliAI Blog.
cURL
curl --request POST \ --url http://localhost:8000/v1/tokenize \ --header 'Content-Type: application/json' \ --data ' { "prompt": "What is generative AI?" } '
import requestsurl = "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 mainimport ( "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.
Input text prompt to tokenize.
"What is generative AI?"
Routes the request to a specific adapter.
"(adapter-route)"
Successfully tokenized the text.
A list of token IDs.
Contact support