ray.serve.llm.LLMRouter.tokenize#

async LLMRouter.tokenize(body: TokenizeCompletionRequest, request: fastapi.Request) starlette.responses.Response#

Tokenize text into token IDs.

This endpoint tokenizes the provided text prompt and returns the token IDs, counts, and optionally token strings.

Note: This is a vLLM specific endpoint.

Parameters:
  • body – The tokenize request containing the text to tokenize.

  • request – The raw FastAPI request object.

Returns:

A response object with token IDs and metadata.