Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use when writing structured-generation code with the Outlines Python library (from_transformers/from_openai model init, Generator or model(prompt, output_type), typing.Literal/Regex/JsonSchema output types, str return you parse yourself): emit the current v1 API idiom — the exact calls cheaper models emit in the removed pre-v1 form.
.claude/skills/outlines-v1-api/SKILL.md| Model | Eval pass | Runs |
|---|---|---|
| gemini-3.6-flash | 100% | 1 |
| Model | Lift | Δ tokens | Δ turns | Cases | Verified |
|---|---|---|---|---|---|
| gemini-3.6-flashbest | +73% | +92% | 0% | 22 | 54d ago |
| gemini-3.5-flash | pending re-run | — | |||
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-10 | ✗→✓ | ▲ Improved | — | — |
| case-21 | ✗→✓ | ▲ Improved | — | — |
| case-13 | ✗→✓ | ▲ Improved | — | — |
| case-16 | ✗→✓ | ▲ Improved | — | — |
| case-12 | ✗→✓ | ▲ Improved | — | — |
Enforces the CURRENT (v1) Outlines public API whenever you write code that uses the outlines library for structured LLM generation — JSON/Pydantic, choice, regex, integer, or free text. The pre-v1 API (outlines.models.transformers("name"), outlines.generate.json(...)) was removed; emit the v1 form below. Apply to any request to "use outlines" / "generate structured output with outlines."
from_<backend> factory — the model constructors were renamed to afrom_ prefix. Use outlines.from_transformers(...), outlines.from_openai(...), outlines.from_vllm(...), outlines.from_llamacpp(...), outlines.from_ollama(...), outlines.from_gemini(...), outlines.from_anthropic(...). Never outlines.models.<backend>(...) — the outlines.models constructor namespace is gone.
outlines.from_transformers takes two objects: a loaded transformers model AND its tokenizer —outlines.from_transformers(AutoModelForCausalLM.from_pretrained(name), AutoTokenizer.from_pretrained(name)). It does NOT accept a model-name string.
outlines.from_openai takes a client object then the model id: outlines.from_openai(openai.OpenAI(), "gpt-4o").generate module is gone. Two forms:result = model(prompt, output_type).from outlines import Generator → generator = Generator(model, output_type) →result = generator(prompt). Never outlines.generate.json(...) / .choice(...) / .regex(...) / .text(...) / .integer(...) — the whole outlines.generate module was removed.
NOT via a v0 helper:
BaseModel subclass, a @dataclass, a TypedDict, oroutlines.types.JsonSchema(schema_string).
typing.Literal["a", "b", "c"] or an Enum — never a Python list of strings.outlines.types.Regex(r"...") — a raw pattern wrapped in Regex.int / float.None.str. Parse it yourself — it is not an already-built object.For a pydantic model: obj = MyModel.model_validate_json(result). For a JsonSchema: json.loads(result). Do NOT write result.name / iterate result.items as if the return were the parsed instance.
model(prompt, output_type, max_new_tokens=256, stop_strings=".", temperature=0.7, top_p=0.9, seed=10). The keywords map to the backend's own inference API.
for chunk in model.stream(prompt, output_type): .... Many inputs at once: model.batch([prompt1, prompt2], output_type). Generators expose the same __call__, stream, batch.
Model init (BEFORE = removed v0 → AFTER = v1):
python# BEFORE model = outlines.models.transformers("microsoft/Phi-3-mini-4k-instruct") # AFTER from transformers import AutoModelForCausalLM, AutoTokenizer name = "microsoft/Phi-3-mini-4k-instruct" model = outlines.from_transformers( AutoModelForCausalLM.from_pretrained(name), AutoTokenizer.from_pretrained(name), )
JSON / Pydantic:
python# BEFORE generator = outlines.generate.json(model, User) user = generator(prompt) # v0 returned a User instance print(user.name) # AFTER result = model(prompt, User) # v1 returns a raw str user = User.model_validate_json(result) print(user.name)
Choice:
python# BEFORE gen = outlines.generate.choice(model, ["positive", "negative", "neutral"]) # AFTER from typing import Literal label = model(prompt, Literal["positive", "negative", "neutral"])
Regex + integer:
python# BEFORE phone = outlines.generate.regex(model, r"[0-9]{3}-[0-9]{3}-[0-9]{4}")(prompt) count = outlines.generate.integer(model)(prompt) # AFTER from outlines.types import Regex phone = model(prompt, Regex(r"[0-9]{3}-[0-9]{3}-[0-9]{4}")) count = model(prompt, int)
Reusable generator + keyword params:
pythongenerator = outlines.Generator(model, Product) result = generator(prompt, max_new_tokens=200, stop_strings=".") product = Product.model_validate_json(result)
from_ factory around the provider client:outlines.from_openai(openai.OpenAI(), "gpt-4o"), outlines.from_gemini(...). There is no outlines.models.openai(...).
outlines.types.JsonSchema(schema_string)and pass that as the output type; the result is still a str to json.loads.
None (or build Generator(model) with no type); still a str.BaseModel whose fields are nested models orlist[...]; you still pass that one class and parse the returned str once.
outlines.from_transformers(model_obj, tokenizer_obj). DON'T outlines.models.transformers("name").model(prompt, Schema) / Generator(model, Schema)).DON'T call outlines.generate.json/choice/regex/integer.
typing.Literal[...]/Enum for choices. DON'T pass a list of strings.outlines.types.Regex(r"..."). DON'T pass a bare pattern to a generate.* helper.Model.model_validate_json(result)). DON'T read attributes off the return value.max_new_tokens=, stop_strings=, seed= as keywords. DON'T pass them positionally.outlines.models.transformers("microsoft/Phi-3-...") — removed; use from_transformerswith a model object + tokenizer object.
outlines.generate.json(model, Schema) — the generate module is gone.generate.choice(model, ["a","b"]) instead of Literal["a","b"].user.name) — v1 returns a str; call.model_validate_json first.
generator(prompt, 256, ".")) instead of max_new_tokens=256, stop_strings=".".outlines.from_<backend>(...) (transformers = model obj + tokenizer obj).model(prompt, output_type) or Generator(model, output_type) — no outlines.generate.*.str and parsed (.model_validate_json / json.loads).| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-02 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +73 percentage points is the difference between those two pass rates over the 22 comparable cases.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
| Model | Method | Date | Lift |
|---|---|---|---|
| gemini-3.5-flash | verified | 7/9/2026 | +46% |
Other measured skills in the registry, with their headline benchmark lift.