.txt API
Structured outputs API that enforces JSON Schema, regex, and grammar constraints on LLM responses.
- Tool type
- Structured-output API for LLMs
- Made for
- Developers and inference teams
- Runs on
- Hosted API and self-hosted servers
- Calls go to api.dottxt.ai; self-hosting uses vLLM, SGLang, or TensorRT-LLM.
What it does
api.dottxt.ai accepts a prompt, a model name, and an output schema written as JSON Schema, a regular expression, or a context-free grammar, and returns model output that conforms to that schema. Because the constraint is applied during generation, callers receive output that matches the schema without retry loops or defensive parsing. The endpoint follows the OpenAI chat-completions request format, with the schema supplied in a response_format field.
Developers can call the endpoint through the dottxt Python package, the OpenAI Python client, the TypeScript AI SDK, or raw HTTP with a bearer key. The quickstart shows extracting a contact record with required name and email fields from free text. Teams already running vLLM, SGLang, or TensorRT-LLM can use dottxt as a drop-in replacement for those servers, and inference providers can build on the dotjson, dotgrammar, and dotlambda libraries.
This fits developers building pipelines that need predictable structured output from LLMs, and teams that self-host inference. Access begins with an API key requested through the quickstart. Schema validity is enforced, but the factual accuracy of extracted values is still the caller's responsibility.
What it can do
- Constrains LLM output to a supplied JSON Schema
- Supports regular expressions and context-free grammars as output constraints
- OpenAI-compatible chat completions endpoint with a response_format schema field
- Command-line generate command that returns schema-validated JSON
- Drop-in replacement for vLLM, SGLang, and TensorRT-LLM inference servers
- Function-calling output via the dotlambda library
Works with
- vLLM
- SGLang
- TensorRT-LLM
- OpenAI Python client
- Vercel AI SDK (@ai-sdk/openai)
Example workflows
- Extract a contact record from text
- Input: free text such as 'John Smith <[email protected]>, VP Engineering' and a contact JSON schema with required name and email. Steps: install dottxt, set the API key, send the schema via the generate command or response_format. Output: a JSON object matching the schema.
- Swap in constrained decoding on a self-hosted server
- Input: an existing vLLM, SGLang, or TensorRT-LLM deployment. Steps: replace the inference server with the dottxt drop-in, keep the existing client code, send JSON-schema or grammar-constrained requests. Output: schema-conforming responses from the same serving stack.
Before you choose
- Pricing is described as pay-per-token; unit rates, billing cadence and model-specific costs are not stated on the homepage.
- Self-hosting requires an existing vLLM, SGLang, or TensorRT-LLM deployment; the drop-in path is not available on the hosted API alone.
- Output validity is guaranteed against the schema, not the factual correctness of the extracted values.
Listed under
Get started
Request API access through the quickstart, then set DOTTXT_API_KEY.
- Request API access through the quickstart form, then create an API key.
- Install the dottxt package (pip install dottxt) and set DOTTXT_API_KEY in your environment.
- Define a JSON Schema or Pydantic model and run a first extraction with the generate command or the Python client.
Plans and prices
The homepage describes pay-per-token billing; rates, units and plans are not listed there. Check https://dottxt.ai/pricing.
We couldn’t find published prices for .txt API. See their pricing page ↗
Sources for this overview
Product pages, documentation, and pricing checked 29 Oct 2026. Each source supports part of the overview; availability and prices can change.
- .txt - Structured Outputs for Production LLMs ↗dottxt.ai
- Quickstart - dottxt docs ↗docs.dottxt.ai
Ratings and reviews
No ratings for .txt API yet.
What’s changed
Free accountSignals
Free accountData and security
Free accountCompare with similar tools
Free accountWhere this comes from
How we research- Company website
- dottxt.ai: product, pricing and policy pages
- YC directory mirror
- Batch and company name
- Social accounts
- Accounts the company links, and its posts on X
- Human review
- Checked by a person
- knowledge_base
Last checked 29 Oct 2026. Every field keeps its source and date; unknown means we couldn’t confirm it.