Welcome to Outlines! - Outlines
Skip to content
Initializing search
dottxt-ai/outlines
See it in action
Quick install
Features
Supported inference APIs, libraries & servers
Who is using Outlines?
Outlines people
About .txt
Acknowledgements
Guide
Features
Model Inputs
Output Types
Generator
Error Handling
Utilities
Advanced
API Reference
caching
exceptions
generator
grammars
inputs
models
processors
templates
types
utils
Examples
Community
Blog
See it in action
Quick install
Features
Supported inference APIs, libraries & servers
Who is using Outlines?
Outlines people
About .txt
Acknowledgements
LLMs are powerful but their outputs are unpredictable. Most solutions attempt to fix bad outputs after generation using parsing, regex, or fragile code that breaks easily.
Outlines guarantees structured outputs during generation — directly from any LLM.
Works with any model - Same code runs across OpenAI, Ollama, vLLM, and more
Simple integration - Just pass your desired output type: model(prompt, output_type)
Guaranteed valid structure - No more parsing headaches or broken JSON
Provider independence - Switch models without changing code
Rich structure definition - Use Json Schema, regular expressions or context-free grammars
Get Started<br>View Examples<br>API Reference<br>GitHub
🚀 Building the future of structured generation
We're working with select partners to develop new interfaces to structured generation.
⚡ Try the Dottxt API
Want guaranteed structured generation without running your own models? The Dottxt API delivers 100% schema-compliant outputs via a simple REST API — no GPU, no setup.
Request API access →
🔍 Audit your schema
Share one schema and we show you what breaks under generation, the constraints that fix it, and compliance rates before and after. Need XML, FHIR, custom schemas or grammars? Let's talk.
Sign up →
See it in action
from pydantic import BaseModel<br>from typing import Literal<br>import outlines<br>import openai
class Customer(BaseModel):<br>name: str<br>urgency: Literal["high", "medium", "low"]<br>issue: str
client = openai.OpenAI()<br>model = outlines.from_openai(client, "gpt-4o")
customer = model(<br>"Alice needs help with login issues ASAP",<br>Customer<br># ✓ Always returns valid Customer object<br># ✓ No parsing, no errors, no retries
Quick install
pip install outlines
Features
Reliable - Guaranteed schema compliance -- always valid JSON.
Feature-rich - Supports a large proportion of the JSON Schema spec, along with regex and context-free grammars.
Fast - Microseconds of overhead vs seconds of retries. Compilation happens once, not every request.
Simple - Outlines is a low-abstraction library. Write code the way you normally do with LLMs. No agent frameworks needed.
Supported inference APIs, libraries & servers
vLLM
vLLM offline
Transformers
llama.cpp
Ollama
MLX-LM
SgLang
TGI
OpenAI
Anthropic
Gemini
Dottxt
Who is using Outlines?
Hundreds of organisations and the main LLM serving frameworks (vLLM, TGI, LoRAX, xinference, SGLang) use Outlines. Prominent companies and organizations that use Outlines include:
Organizations are included either because they use Outlines as a dependency in a public repository, or because of direct communication between members of the Outlines team and employees at these organizations.
Still not convinced, read what people say about us. And make sure to take a look at what the community is building!
Outlines people
Outlines would not be what it is today without a community of dedicated developers:
About .txt
Outlines is built with ❤️ by .txt.
.txt solves the critical problem of reliable structured output generation for large language models. Our commercially-licensed libraries ensure 100% compliance with JSON Schema, regular expressions and context-free grammars while adding only microseconds of latency. Unlike open-source alternatives, we offer superior reliability, performance, and enterprise support.
Acknowledgements
Outlines was originally developed at @NormalComputing by @remilouf and @BrandonTWillard. It is now maintained by .txt.
2026-04-13
2023-11-12
GitHub