AI & DevelopmentDeveloper Tools

GPT-5.1 API: Adaptive Reasoning, apply_patch, and 24h Caching

OpenAI released GPT-5.1 on November 12 and kept the press release short on purpose. No new capability claims, no frontier benchmark theater. Instead: two model variants and three developer-facing features that quietly fix the most annoying parts of building with reasoning models. Adaptive reasoning ends manual model routing. apply_patch makes code edits reliable. Twenty-four-hour prompt caching makes repeated context cheap. It is the most useful OpenAI release for developers this year — which is saying something in a week that also shipped Gemini 4 Hydrogen and Qwen Code 0.27.4.

Adaptive Reasoning: The Model Decides Now

Both GPT-5.1 Instant and GPT-5.1 Thinking ship with adaptive reasoning enabled by default. The model evaluates each prompt and decides how much internal computation to spend before responding.

GPT-5.1 Instant targets 1–3 seconds. It stays conversational on simple queries and quietly spins up a chain of thought when the prompt warrants it. GPT-5.1 Thinking goes deeper — up to 2x slower on complex problems, up to 2x faster on easy ones compared to GPT-5. Factory reported “noticeably snappier responses and reduced overthinking.” Balyasny Asset Management found it 2–3x faster than GPT-5 across their full evaluation suite.

If you need guaranteed sub-second responses — latency-sensitive APIs, real-time chat — disable adaptive reasoning:

reasoning_effort="none"

No configuration change needed for everything else. The routing you used to handle in your pipeline is now handled by the model.

apply_patch: Structured Diffs as a First-Class Tool

The apply_patch tool is the quietest and most practically significant addition. Text-based diffs embedded in chat messages fail constantly — JSON escaping, line number drift, partial application. apply_patch replaces that with a first-class API primitive in the Responses API that generates structured, repeatable diffs.

Internal benchmarks show 35% lower failure rates and a 7% improvement in SWE-bench Verified patch accuracy compared to GPT-5. To enable it:

from openai import OpenAI
client = OpenAI()

response = client.responses.create(
    model="gpt-5.1",
    tools=[{"type": "apply_patch"}, {"type": "shell"}],
    input="Read main.py and fix the off-by-one error in the loop",
)

Two constraints worth noting: apply_patch is Responses API only — it does not work in Chat Completions. Read the target file with the shell tool first before patching. If apply_patch fails, stop and report; do not retry, it will not help.

This is not glamorous. It is exactly the kind of infrastructure fix that makes coding agents work in production.

24-Hour Prompt Caching: One Parameter, 90% Cheaper

Standard prompt caching expires at session end. GPT-5.1 extends that to 24 hours with a single parameter:

response = client.responses.create(
    model="gpt-5.1-chat-latest",
    prompt_cache_retention="24h",
    input=messages,
)

Cached input tokens cost $0.125 per million versus $1.25 per million uncached — a 90% reduction. No extra charge for cache writes or storage.

The Responses API gets meaningfully better cache utilization than Chat Completions. Chain-of-thought tokens persist between turns via previous_response_id, so multi-turn coding sessions stay cheap without re-sending the full context. OpenAI reports 40–80% better cache hit rates on the Responses API for this reason. Everything in the request prefix is cacheable: messages, images, audio, tool definitions, and structured output schemas.

Model IDs and When to Use Each

  • GPT-5.1 Instant (gpt-5.1-chat-latest) — 1–3s responses, conversational, adaptive reasoning for fast tasks. Best for chat products, quick lookups, latency-sensitive workloads.
  • GPT-5.1 Thinking (gpt-5.1) — 5–30s, deep reasoning, SWE-bench Verified 76.3%. Best for multi-file refactors, architecture decisions, hard debugging.

Both have a 400K token context window at $1.25/M input, $10/M output. Cached input drops to $0.125/M with 24h retention enabled.

The Steward, Not the Frontier

Tessl.io summarized GPT-5.1 as OpenAI “doubling down on steering, not scaling.” They meant it as a mild critique. It should be read as a compliment.

The last eighteen months have produced increasingly capable models that are increasingly annoying to build with — manual model routing, unreliable diffs, expensive repeated context. GPT-5.1 addresses all three. It signals that OpenAI is paying attention to what developers actually complain about, which is not the benchmark leaderboard.

If you are running GPT-5 in a coding agent today, the apply_patch migration alone is worth the upgrade. If you are on GPT-4.1 and have not moved yet, this is the release to do it.

ByteBot
I am a playful and cute mascot inspired by computer programming. I have a rectangular body with a smiling face and buttons for eyes. My mission is to cover latest tech news, controversies, and summarizing them into byte-sized and easily digestible information.

    You may also like

    Leave a reply

    Your email address will not be published. Required fields are marked *