OpenAI Java SDK 4.114 Adds Spend-Limit and Compaction Fields
The Java client now models hard-limit email settings and Responses compaction metadata; teams still need to distinguish alerts from enforcement.
On this page

A typed SDK release can look like a feature launch when its changelog mentions “spend alerts” and “compaction.” OpenAI Java SDK 4.114.0 adds fields for hard-spend-limit email settings and more Responses compaction metadata. It does not by itself announce that the platform has just gained these controls: the API already documents spend limits and compaction. The useful change is that Java applications can represent the relevant settings and response data with current generated types. [1] [2]
The release notes list two additions: email settings for organization and project hard spend limits, and safety-identifier support on conversation creation and response compaction. A compaction response can also expose its safety identifier and service tier when present. The release is dated November 26, 2026. The merged pull request describes the generated fields and says the SDK was updated to clarify how these values are sent and returned. [1] [2]
An alert is not a circuit breaker
OpenAI’s API documentation separates a spend alert from a hard spend limit. An alert sends a notification so an operator can investigate or adjust usage; it does not stop traffic. A hard limit can reject affected API requests with a 429 and a specific billing-related error code once tracked usage reaches the configured amount. Enforcement is not instantaneous, so usage may go slightly beyond the threshold before requests are rejected. [3]
That difference should shape the Java application around the SDK. Alert recipients need to receive and act on the notification, while runtime code should classify spend-limit errors and choose a service response: pause background generation, route to a lower-cost workflow, ask for an owner decision, or return an explicit availability message. Repeating the same request after an organization or project limit is reached will not restore service. The API’s own guide recommends checking error.code to distinguish an organization cap, project cap, account usage limit and exhausted prepaid credits. [3]
The billing fields do not make spend accounting synchronous. Requests already in flight, accounting propagation and concurrent work can complicate a hard stop. Set operational alerts early enough to leave time to respond; keep the hard limit as a backstop, not as a substitute for a budget or queue policy. For background generation, include a stop condition and a way for a human to see why work paused. Our guide to partial failures in LLM applications covers the recovery side of those responses.
Compaction keeps context moving, not readable
Responses compaction addresses a different operational pressure: long conversations can outgrow a practical context window. The compaction endpoint returns a smaller context that carries forward prior state, including an encrypted compaction item that is intentionally opaque. Applications can continue by sending the returned output forward as-is, or use previous_response_id chaining when the response history is stored server-side. [4] [5]
The Java SDK’s added fields preserve safety-related identity across those calls. A stable safety identifier can be passed into the conversation and compaction request; the compacted response may include the identifier and the service tier used. That metadata is useful for attribution and monitoring, but it does not reveal the hidden compacted content or prove that the application retained every tool instruction it needs. Test a representative conversation before using compaction in production, and continue to pass required tools and configuration when resuming from a standalone compacted context. [2] [4] [5]
OpenAI documents server-side compaction as compatible with zero-data-retention when Responses requests set store=false; its standalone compaction endpoint is stateless and ZDR-friendly. The returned compacted window is the canonical next context window: pruning pieces from it can discard state the service retained. That is a useful contract, but applications still need to decide when to compact, how to preserve their own state outside the model context, and what to do if compaction or the following call fails. [4]
What to check after upgrading
Upgrade the Java client, then inspect the generated request serialization and response parsing for the fields your code uses. Keep omitted values distinct from explicit null where the API uses that difference. Confirm your alerts go to maintained operational recipients, and exercise a development project with a low threshold before relying on billing behavior in a production workflow. For compaction, test both the stateless returned-context path and the stored-history path, including tool declarations and safety identifiers. [2] [3] [5]
The release is small but practical for teams already using the Java client: fewer untyped workarounds for billing notifications and Responses compaction metadata. The bigger engineering decisions remain at the API boundary. An alert can warn without stopping work; a hard cap can stop requests after a delay; and compacted context remains a machine-readable continuity mechanism rather than a human-readable transcript. Treat each mechanism according to its actual behavior. [1] [3] [4]
Frequently asked questions
Does an OpenAI spend alert stop API requests?
No. A spend alert sends a notification while traffic continues. A hard spend limit can reject affected requests with a 429 after tracked spend reaches the threshold, although enforcement is not instantaneous and usage can slightly exceed the configured amount.
What does the Java SDK 4.114 compaction support add?
The release adds safety-identifier fields when creating conversations and compacting Responses, and exposes the safety identifier and service tier when present in a compaction response. The compacted state remains an opaque API payload, not a readable summary.



/* Comments */
Comments are offline right now — we reconnect automatically, nothing is lost.