Split text for embeddings: turn text/Markdown into RAG-ready chunks — token-based sizing, heading-aware boundaries, overlap, heading path and page metadata per chunk. The standard step before a vector DB.
export KEY=bigapi_… # your key, once per terminal
curl -X POST https://api.bigapi.dev/v1/text/chunk -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"text":"# Doc...","maxTokens":512,"overlap":50}'
New keys come with 100 free operations, no signup: curl -X POST https://api.bigapi.dev/v1/keys. Failed calls cost nothing.
| Name | Meaning |
|---|---|
text | Text or Markdown to split into chunks for embeddings (or upload a file instead). Default: none, send text or a file |
file | Multipart only: a .txt or .md file instead of the text field. Default: none, send text or a file |
maxTokens | Chunk size in tokens, 50 to 8000. 512 suits most embedding models; use the limit of your model if it is smaller. Default: 512 |
overlap | Tokens repeated at the start of the next chunk so no sentence loses its context; at most half of maxTokens. Default: 0 |
splitOn | heading starts a new chunk at every heading so chunks follow the chapters; paragraph fills chunks paragraph by paragraph up to maxTokens. Allowed: heading, paragraphDefault: "heading" |
Returns application/json. Response headers carry the cost (X-BigAPI-Cost) and notes about your input (X-BigAPI-Warnings).
Connect BiGapi as an MCP server: https://api.bigapi.dev/mcp (hosted) or npx -y @bigapi/mcp (local). Then ask in plain words; the agent finds text_chunk on its own.