POST
/
v1
/
chunk
/
slumber
curl --request POST \
  --url https://api.chonkie.ai/v1/chunk/slumber \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form tokenizer_or_token_counter=gpt2 \
  --form chunk_size=1024 \
  --form candidate_size=32 \
  --form min_characters_per_chunk=12 \
  --form return_type=chunks
[
  {
    "text": "<string>",
    "start_index": 123,
    "end_index": 123,
    "token_count": 123
  }
]

Authorizations

Authorization
string
header
required

Your API Key from the Chonkie Cloud dashboard

Body

multipart/form-data
file
file

The file to chunk.

tokenizer_or_token_counter
string
default:gpt2

Tokenizer used for initial splitting and size estimation.

chunk_size
integer
default:1024

Target maximum tokens per chunk for the generative model.

candidate_size
integer
default:32

Number of tokens around a potential split point examined by the generative model.

min_characters_per_chunk
integer
default:12

Minimum number of characters required for a valid chunk.

return_type
enum<string>
default:chunks

Whether to return chunks as Chunk objects or plain text strings.

Available options:
texts,
chunks

Response

200 - application/json
Successful Response: A list of `Chunk` objects.
text
string

The actual text content of the chunk.

start_index
integer

The starting character index of the chunk within the original input text.

end_index
integer

The ending character index (exclusive) of the chunk within the original input text.

token_count
integer

The number of tokens in this specific chunk, according to the tokenizer used.