Skip to main content
POST
/
litellm
/
cohere
/
v1
/
tokenize
Tokenize text (LiteLLM - Cohere format)
curl --request POST \
  --url http://localhost:8080/litellm/cohere/v1/tokenize \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "command-r-plus",
  "text": "<string>"
}
'
{
  "tokens": [
    123
  ],
  "token_strings": [
    "<string>"
  ],
  "meta": {
    "api_version": {
      "version": "<string>"
    }
  }
}

Body

application/json
model
string
required

Model whose tokenizer should be used

Example:

"command-r-plus"

text
string
required

Text to tokenize (1-65536 characters)

Required string length: 1 - 65536

Response

Successful response

tokens
integer[]

Token IDs

token_strings
string[]

Token strings

meta
object

Metadata returned by the tokenize endpoint