Tokenize
vLLM: turn a text into the model's token ids with the tokenizer that POST /v1/completions counts with, and count them. With return_token_strs, also each token's text. The API asks no Inference, so the route costs no tokens and never starts a GPU.
bearerAuthorizationBearer <token>An API key: Authorization: Bearer sk-acs-..., or a key of the old platform, acs-bm-.... A User makes and revokes keys in the App.
application/json- body
model?stringThe Base model whose tokenizer to use: an id from GET /v1/models, such as llama-8b. Left out, the model that GET /v1/models marks default.
^[^\u0000]*$prompt*stringvLLM: the text to tokenize, at most 65536 bytes as UTF-8.
^[^\u0000]*$add_special_tokens?booleanvLLM: add the model's special tokens, such as BOS, as POST /v1/completions does with the same field.
return_token_strs?booleanvLLM: also return each token's text in token_strs, as a Completion's tokens and top_logprobs show it.
TokenizeResponse
application/json- response
count*integerThe number of tokens: the count that POST /v1/completions holds for this prompt.
max_model_len*integerThe model's context: its prompt and generated tokens together.
tokens*array<integer>The token ids, in order.
token_strs*array<string>|With return_token_strs, the text of each token, the way a Completion's tokens and top_logprobs keys show it. A token that holds part of a character's UTF-8 bytes reads �. Otherwise null.
curl -X POST 'https://api.infra.acsresearch.org/v1/tokenize' \ -H 'Authorization: Bearer <API_KEY>' \ -H 'Content-Type: application/json' \ -d '{ "prompt": "string"}'{ "count": 0, "max_model_len": 0, "tokens": [ 0 ], "token_strs": [ "string" ]}Get Quota GET
Return your tokens of this UTC month: how many you may spend (`quota`), how many your Completions spent or hold (`used`), how many are left (`left`), and when the count starts again (`refills_at`). The API checks each request's Hold against these numbers. A Hold larger than `left` gets 429 `budget_exceeded`, unless the API first lowers `max_tokens` to fit: POST /v1/completions does, and so does a Job request that leaves `max_tokens` out. With `group_by=client`, the answer also splits this month's Completions by client label: the `X-Title` header of the request that sent them, else the first product of its `User-Agent`. The route asks no Inference and costs no tokens.
Detokenize POST
vLLM: turn the model's token ids back into text. The API asks no Inference, so the route costs no tokens and never starts a GPU.