---
title: "Tokenize text with the specified model"
method: POST
path: "/v1/tokenize-text"
tags: ["v1"]
---

# Tokenize text with the specified model

`POST /v1/tokenize-text`

## Request body

- TokenizeRequest
  - `model` string — The model to tokenize with.
  - `text` string — The text content to be tokenized.
  - `user` string, nullable — Optional user identifier.

## Response `200`

Success

- TokenizeResponse
  - `token_ids` TokenizeResponseToken[], required — A list of tokens.
    - `string_token` string, required — The string of the token.
    - `token_bytes` integer[], required — The bytes that constituted the token.
    - `token_id` integer, required — The integer representation of the token for the model.

## Other responses

- `400` — Bad request. The request is invalid or an invalid API key is provided.

---

[API](https://skmtc.net/x/apis/xai-s-rest-api.md) · [All operations](https://skmtc.net/x/apis/xai-s-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/x/xai-s-rest-api/versions/8f6014272113/schema)
