Skip to content

AI||Updated |3 min read

OpenAI Python SDK v3.6.0 Adds Compute Units to Usage Tracking

The latest OpenAI Python SDK release v3.6.0 introduces compute_units tracking in API response usage, enabling developers to monitor computational resource consumption alongside token counts.

By Sameer Khan

OpenAI released version 3.6.0 of their official Python SDK on August 28, 2026. This update adds a new compute_units field to usage objects returned by API responses, providing developers with insight into computational resource consumption beyond traditional token counting.

What's New in v3.6.0

The v3.6.0 release introduces compute_units as an optional integer field in the usage statistics for both Chat Completions and Responses API calls. The release notes list it as "add compute_units to Responses and Chat Completions usage"1. The field's docstring, added in commit 52421d1 and generated from OpenAI's OpenAPI spec, reads: "Compute units for the request. Currently null when available."2

Technical Details

The compute_units field appears in three key usage classes:

  1. CompletionUsage (for chat completions)
  2. ResponseUsage (for responses API)
  3. BetaResponseUsage (for beta endpoints)

Each class now includes:

compute_units: Optional[int] = None
"""Compute units for the request. Currently null when available."""

The field is typed as Optional[int] with a minimum value of 0 when present, reflecting that it may return null (None in Python) when compute unit data isn't available for a particular request2.

Usage Example

Here's how to access the new field in your code:

from openai import OpenAI

client = OpenAI()

# Chat Completions example
response = client.chat.completions.create(
    model="gpt-5.2",
    messages=[{"role": "user", "content": "Explain quantum computing"}]
)

usage = response.usage
print(f"Tokens: {usage.total_tokens}")
print(f"Compute units: {usage.compute_units}")  # May be None

# Responses API example
response = client.responses.create(
    model="gpt-5.2",
    input="Explain quantum computing"
)

usage = response.usage
print(f"Tokens: {usage.total_tokens}")
print(f"Compute units: {usage.compute_units}")  # May be None

Why This Matters

While token counts have traditionally been the primary metric for API usage and cost estimation, compute units provide additional insight into the actual computational resources consumed by a request. This can be particularly valuable for:

  1. Cost optimization: Understanding the computational efficiency of different prompts or model parameters
  2. Performance profiling: Identifying requests that consume disproportionate computational resources
  3. Capacity planning: Better estimating infrastructure needs when deploying models that report compute units
  4. Research: Studying the relationship between token usage and actual computational work

Current Limitations

The field's docstring says it is "Currently null when available"3. The SDK types it as Optional[int], so code that reads it should handle None.

Verdict

The v3.6.0 update is a forward-looking addition that prepares developers for future enhancements to OpenAI's usage tracking capabilities. While the docstring describes the field as currently null when available, its inclusion in the SDK allows developers to future-proof their code by accessing the field now, ensuring compatibility when OpenAI activates compute unit reporting.

Developers should update to v3.6.0 to gain access to this new field, and should handle None values, since the docstring describes the field as currently null when available. The change is backward-compatible and poses no risk to existing implementations.


Evidence Summary

  • Release version: v3.6.0 (published 2026-08-28)
  • Source: GitHub release notes and commit history
  • Key change: Addition of compute_units field to usage types
  • Current state: docstring reads "Currently null when available."

Footnotes

  1. OpenAI openai-python release v3.6.0 ↩

  2. OpenAI openai-python commit 52421d1 ↩ ↩2

  3. The type docstring added in OpenAI openai-python commit 52421d1, generated from OpenAI's OpenAPI spec. The v3.6.0 release notes do not contain this text. ↩