{ "openapi": "3.1.0", "info": { "title": "Chonkie API", "description": "🦛 Chonkie running on the Internet! 🌎 Get chunks via POST HTTP calls~", "version": "0.1.0" }, "servers": [ { "url": "https://api.chonkie.ai", "description": "Chonkie Cloud API" } ], "security": [ { "BearerAuth": [] } ], "paths": { "/v1/auth/validate": { "post": { "summary": "Validate API Key", "description": "Validates the provided API key. Use this endpoint to check if your API key is valid and active.", "operationId": "validate_auth_v1_auth_validate_post", "responses": { "200": { "description": "API key is valid and active", "content": { "application/json": { "schema": {}, "example": { "message": "Token is valid!", "status": 200 } } } }, "401": { "description": "Invalid or expired API key", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorRES" }, "example": { "message": "Token is invalid!", "status": 401 } } } } } } }, "/v1/chunk/token": { "post": { "summary": "Token Chunker", "description": "Chunk the given text using the Token Chunker.", "operationId": "get_token_chunks_v1_chunk_token_post", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TokenChunkerREQ" } } } }, "responses": { "200": { "description": "Successful Response: A list of chunk objects.", "content": { "application/json": { "schema": { "title": "ChunkResponse", "type": "array", "items": { "$ref": "#/components/schemas/Chunk" }, "description": "A list containing chunk objects, each detailing a segment of the original text." } } } }, "401": { "description": "Invalid or expired API key", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorRES" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorRES" } } } } } } }, "/v1/chunk/word": { "post": { "summary": "Word Chunker", "description": "Chunk the given text using the Word Chunker.", "operationId": "get_word_chunks_v1_chunk_word_post", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WordChunkerREQ" } } } }, "responses": { "200": { "description": "Successful Response: A list of chunk objects.", "content": { "application/json": { "schema": { "title": "ChunkResponse", "type": "array", "items": { "$ref": "#/components/schemas/Chunk" }, "description": "A list containing chunk objects, each detailing a segment of the original text." } } } }, "401": { "description": "Invalid or expired API key", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorRES" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorRES" } } } } } } }, "/v1/chunk/sentence": { "post": { "summary": "Sentence Chunker", "description": "Chunk the given text using the Sentence Chunker.", "operationId": "get_sentence_chunks_v1_chunk_sentence_post", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SentenceChunkerREQ" } } } }, "responses": { "200": { "description": "Successful Response: A list of chunk objects.", "content": { "application/json": { "schema": { "title": "ChunkResponse", "type": "array", "items": { "$ref": "#/components/schemas/Chunk" }, "description": "A list containing chunk objects, each detailing a segment of the original text." } } } }, "401": { "description": "Invalid or expired API key", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorRES" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorRES" } } } } } } }, "/v1/chunk/recursive": { "post": { "summary": "Recursive Chunker", "description": "Chunk the given text using the Recursive Chunker.", "operationId": "get_recursive_chunks_v1_chunk_recursive_post", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RecursiveChunkerREQ" } } } }, "responses": { "200": { "description": "Successful Response: A list of chunk objects.", "content": { "application/json": { "schema": { "title": "ChunkResponse", "type": "array", "items": { "$ref": "#/components/schemas/Chunk" }, "description": "A list containing chunk objects, each detailing a segment of the original text." } } } }, "401": { "description": "Invalid or expired API key", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorRES" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorRES" } } } } } } }, "/v1/chunk/semantic": { "post": { "summary": "Semantic Chunker", "description": "Chunk the given text using the Semantic Chunker.", "operationId": "get_semantic_chunks_v1_chunk_semantic_post", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SemanticChunkerREQ" } } } }, "responses": { "200": { "description": "Successful Response: A list of chunk objects.", "content": { "application/json": { "schema": { "title": "ChunkResponse", "type": "array", "items": { "$ref": "#/components/schemas/Chunk" }, "description": "A list containing chunk objects, each detailing a segment of the original text." } } } }, "401": { "description": "Invalid or expired API key", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorRES" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorRES" } } } } } } }, "/v1/chunk/sdpm": { "post": { "summary": "SDPM Chunker", "description": "Chunk the given text using the SDPM Chunker.", "operationId": "get_sdpm_chunks_v1_chunk_sdpm_post", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SDPMChunkerREQ" } } } }, "responses": { "200": { "description": "Successful Response: A list of chunk objects.", "content": { "application/json": { "schema": { "title": "ChunkResponse", "type": "array", "items": { "$ref": "#/components/schemas/Chunk" }, "description": "A list containing chunk objects, each detailing a segment of the original text." } } } }, "401": { "description": "Invalid or expired API key", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorRES" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorRES" } } } } } } }, "/v1/chunk/late": { "post": { "summary": "Late Chunker", "description": "Chunk the given text using the Late Chunker.", "operationId": "get_late_chunks_v1_chunk_late_post", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LateChunkerREQ" } } } }, "responses": { "200": { "description": "Successful Response: A list of chunk objects.", "content": { "application/json": { "schema": { "title": "ChunkResponse", "type": "array", "items": { "$ref": "#/components/schemas/Chunk" }, "description": "A list containing chunk objects, each detailing a segment of the original text." } } } }, "401": { "description": "Invalid or expired API key", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorRES" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorRES" } } } } } } } }, "components": { "securitySchemes": { "BearerAuth": { "type": "http", "scheme": "bearer", "description": "Your API Key from the [Chonkie Cloud dashboard](https://cloud.chonkie.ai/keys)" } }, "schemas": { "Chunk": { "title": "Chunk", "description": "Represents a single chunk of text with metadata.", "type": "object", "properties": { "text": { "type": "string", "title": "Text", "description": "The actual text content of the chunk." }, "start_index": { "type": "integer", "title": "Start Index", "description": "The starting character index of the chunk within the original input text." }, "end_index": { "type": "integer", "title": "End Index", "description": "The ending character index (exclusive) of the chunk within the original input text." }, "token_count": { "type": "integer", "title": "Token Count", "description": "The number of tokens in this specific chunk, according to the tokenizer used." } }, "required": [ "text", "start_index", "end_index", "token_count" ] }, "ErrorRES": { "properties": { "message": { "type": "string", "title": "Message" }, "status": { "type": "integer", "title": "Status", "default": 500 } }, "type": "object", "required": [ "message" ], "title": "ErrorRES", "description": "Error response for the Chonkie API." }, "HTTPValidationError": { "properties": { "detail": { "items": { "$ref": "#/components/schemas/ValidationError" }, "type": "array", "title": "Detail" } }, "type": "object", "title": "HTTPValidationError" }, "LateChunkerREQ": { "title": "LateChunkerREQ", "description": "Data to pass to the Late Chunker.", "type": "object", "required": [ "text", "args" ], "properties": { "text": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" } ], "title": "Text", "description": "The input text or list of texts to be chunked." }, "args": { "type": "object", "title": "Chunker Arguments", "required": [ "chunk_size" ], "properties": { "embedding_model": { "type": "string", "title": "Embedding Model", "default": "sentence-transformers/all-minilm-l6-v2" }, "mode": { "type": "string", "title": "Mode", "default": "sentence" }, "chunk_size": { "type": "integer", "title": "Chunk Size", "default": 512 }, "min_sentences_per_chunk": { "type": "integer", "title": "Min Sentences Per Chunk", "default": 1 }, "min_characters_per_sentence": { "type": "integer", "title": "Min Characters Per Sentence", "default": 1 }, "approximate": { "type": "boolean", "title": "Approximate", "default": true }, "delim": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" } ], "title": "Delim", "default": [ "\n", ".", "!", "?" ] }, "include_delim": { "anyOf": [ { "type": "string", "enum": [ "prev", "next" ] }, { "type": "null" } ], "title": "Include Delim", "default": "prev" } }, "additionalProperties": false } } }, "RecursiveChunkerREQ": { "title": "RecursiveChunkerREQ", "description": "Data to pass to the Recursive Character Text Splitter.", "type": "object", "required": [ "text", "args" ], "properties": { "text": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" } ], "title": "Text", "description": "The input text or list of texts to be chunked." }, "args": { "type": "object", "title": "Chunker Arguments", "required": [ "chunk_size" ], "properties": { "tokenizer_or_token_counter": { "type": "string", "title": "Tokenizer Or Token Counter", "default": "gpt2" }, "chunk_size": { "type": "integer", "title": "Chunk Size", "default": 512 }, "rules": { "additionalProperties": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" }, { "additionalProperties": true, "type": "object" }, { "items": { "additionalProperties": true, "type": "object" }, "type": "array" } ] }, "type": "object", "title": "Rules", "default": { "levels": [ { "delimiters": ["\n\n","\n","\r\n"], "include_delim": "prev", "whitespace": false }, { "delimiters": [".","?","!"], "include_delim": "prev", "whitespace": false }, { "delimiters": [ ",", ";", ":", "...", "-", "(", ")", "[", "]", "{", "}", "<", ">", "|", "~", "`", "'", "\"" ], "include_delim": "prev", "whitespace": false }, { "include_delim": "prev", "whitespace": true }, { "include_delim": "prev", "whitespace": false } ] } }, "min_characters_per_chunk": { "type": "integer", "title": "Min Characters Per Chunk", "default": 1 }, "return_type": { "type": "string", "title": "Return Type", "default": "chunks" } }, "additionalProperties": false } } }, "SDPMChunkerREQ": { "title": "SDPMChunkerREQ", "description": "Data to pass to the SDPM Chunker.", "type": "object", "required": [ "text", "args" ], "properties": { "text": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" } ], "title": "Text", "description": "The input text or list of texts to be chunked." }, "args": { "type": "object", "title": "Chunker Arguments", "required": [ "chunk_size" ], "properties": { "embedding_model": { "type": "string", "title": "Embedding Model", "default": "minishlab/potion-base-8M" }, "threshold": { "anyOf": [ { "type": "string", "const": "auto" }, { "type": "number" }, { "type": "integer" } ], "title": "Threshold", "default": "auto" }, "mode": { "type": "string", "title": "Mode", "default": "window" }, "chunk_size": { "type": "integer", "title": "Chunk Size", "default": 512 }, "similarity_window": { "type": "integer", "title": "Similarity Window", "default": 1 }, "min_sentences": { "type": "integer", "title": "Min Sentences", "default": 1 }, "min_characters_per_sentence": { "type": "integer", "title": "Min Characters Per Sentence", "default": 1 }, "threshold_step": { "type": "number", "title": "Threshold Step", "default": 0.01 }, "delim": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" } ], "title": "Delim", "default": [ "\n", ".", "!", "?" ] }, "skip_window": { "type": "integer", "title": "Skip Window", "default": 1 }, "return_type": { "type": "string", "title": "Return Type", "default": "chunks" } }, "additionalProperties": false } } }, "SemanticChunkerREQ": { "title": "SemanticChunkerREQ", "description": "Data to pass to the Semantic Chunker.", "type": "object", "required": [ "text", "args" ], "properties": { "text": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" } ], "title": "Text", "description": "The input text or list of texts to be chunked." }, "args": { "type": "object", "title": "Chunker Arguments", "required": [ "chunk_size" ], "properties": { "embedding_model": { "type": "string", "title": "Embedding Model", "default": "minishlab/potion-base-8M" }, "threshold": { "anyOf": [ { "type": "string", "const": "auto" }, { "type": "number" }, { "type": "integer" } ], "title": "Threshold", "default": "auto" }, "chunk_size": { "type": "integer", "title": "Chunk Size", "default": 512 }, "similarity_window": { "type": "integer", "title": "Similarity Window", "default": 1 }, "min_sentences": { "type": "integer", "title": "Min Sentences", "default": 1 }, "min_chunk_size": { "type": "integer", "title": "Min Chunk Size", "default": 2 }, "min_characters_per_sentence": { "type": "integer", "title": "Min Characters Per Sentence", "default": 1 }, "threshold_step": { "type": "number", "title": "Threshold Step", "default": 0.01 }, "delim": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" } ], "title": "Delim", "default": [ "\n", ".", "!", "?" ] }, "include_delim": { "anyOf": [ { "type": "string", "enum": [ "prev", "next" ] }, { "type": "null" } ], "title": "Include Delim", "default": "prev" }, "return_type": { "type": "string", "title": "Return Type", "default": "chunks" } }, "additionalProperties": false } } }, "SentenceChunkerREQ": { "title": "SentenceChunkerREQ", "description": "Data to pass to the Sentence Chunker.", "type": "object", "required": [ "text", "args" ], "properties": { "text": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" } ], "title": "Text", "description": "The input text or list of texts to be chunked." }, "args": { "type": "object", "title": "Chunker Arguments", "required": [ "chunk_size" ], "properties": { "tokenizer_or_token_counter": { "type": "string", "title": "Tokenizer Or Token Counter", "default": "gpt2" }, "chunk_size": { "type": "integer", "title": "Chunk Size", "default": 512 }, "chunk_overlap": { "type": "integer", "title": "Chunk Overlap", "default": 0 }, "min_sentences_per_chunk": { "type": "integer", "title": "Min Sentences Per Chunk", "default": 1 }, "min_characters_per_sentence": { "type": "integer", "title": "Min Characters Per Sentence", "default": 1 }, "approximate": { "type": "boolean", "title": "Approximate", "default": true }, "delim": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" } ], "title": "Delim", "default": [ "\n", ".", "!", "?" ] }, "include_delim": { "anyOf": [ { "type": "string", "enum": [ "prev", "next" ] }, { "type": "null" } ], "title": "Include Delim", "default": "prev" }, "return_type": { "type": "string", "title": "Return Type", "default": "chunks" } }, "additionalProperties": false } } }, "TokenChunkerREQ": { "title": "TokenChunkerREQ", "description": "Data to pass to the Token Chunker.", "type": "object", "required": [ "text", "args" ], "properties": { "text": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" } ], "title": "Text", "description": "The input text or list of texts to be chunked." }, "args": { "type": "object", "title": "Chunker Arguments", "required": [ "tokenizer", "chunk_size", "chunk_overlap", "return_type" ], "properties": { "tokenizer": { "type": "string", "title": "Tokenizer", "default": "gpt2" }, "chunk_size": { "type": "integer", "title": "Chunk Size", "default": 512 }, "chunk_overlap": { "type": "integer", "title": "Chunk Overlap", "default": 0 }, "return_type": { "type": "string", "title": "Return Type", "default": "chunks" } }, "additionalProperties": false } } }, "ValidationError": { "properties": { "loc": { "items": { "anyOf": [ { "type": "string" }, { "type": "integer" } ] }, "type": "array", "title": "Location" }, "msg": { "type": "string", "title": "Message" }, "type": { "type": "string", "title": "Error Type" } }, "type": "object", "required": [ "loc", "msg", "type" ], "title": "ValidationError" }, "WordChunkerREQ": { "title": "WordChunkerREQ", "description": "Data to pass to the Word Chunker.", "type": "object", "required": [ "text", "args" ], "properties": { "text": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" } ], "title": "Text", "description": "The input text or list of texts to be chunked." }, "args": { "type": "object", "title": "Chunker Arguments", "required": [ "chunk_size", "chunk_overlap", "return_type" ], "properties": { "tokenizer_or_token_counter": { "type": "string", "title": "Tokenizer Or Token Counter", "default": "gpt2" }, "chunk_size": { "type": "integer", "title": "Chunk Size", "default": 512 }, "chunk_overlap": { "type": "integer", "title": "Chunk Overlap", "default": 0 }, "return_type": { "type": "string", "title": "Return Type", "default": "chunks" } }, "additionalProperties": false } } } } } }