GPT-5-Mini Responses API — output_text
Empty (Model Output Structure Bug)
Issue Description
When using gpt-5-mini
with the OpenAI Responses API, the output_text
field returns an empty string (""
) even though the API call succeeds.
This is not an SDK parsing issue — the model’s response currently contains only a reasoning
item and no message
item, so output_text
cannot be populated.
Expected Behavior
response.output_text
should contain the model’s generated text, same as gpt-4o-mini
.
Actual Behavior
-
response.output_text
→""
(empty) -
response.output[0].type
→"reasoning"
-
No
ResponseOutputMessage
is returned — only aResponseReasoningItem
.
Reproduction
from openai import AsyncOpenAI
client = AsyncOpenAI()
response = await client.responses.create(
model="gpt-5-mini",
input=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Say hello in one sentence."}
],
max_output_tokens=50,
)
print(f"output_text: '{response.output_text}'") # Empty!
print(f"output[0] type: {response.output[0].type}") # reasoning
Comparison Table
Model | output_text | output[0].type | Status |
---|---|---|---|
gpt-5-mini | "" |
reasoning | ![]() |
gpt-4o-mini | "Hello! How can I assist you today?" |
message | ![]() |
Root Cause
The gpt-5-mini
model omits a message
output item in some responses, returning only reasoning
.
Since output_text
is built from message
items, it will be empty unless text output is explicitly requested.
Temporary Workaround
Force the output format to text
so the model returns a message
item:
response = await client.responses.create(
model="gpt-5-mini",
input=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Say hello in one sentence."}
],
text={"format": {"type": "text"}},
max_output_tokens=200,
)
print(response.output_text) # Works now
Verified Fix Results
With the workaround:
-
output_text
is populated correctly -
output
contains bothreasoning
andmessage
items -
Matches expected behavior from
gpt-4o-mini
Environment
-
OS: Windows 11
-
Python: 3.11
-
OpenAI Python SDK: Latest
-
Affected Model:
gpt-5-mini
(likely othergpt-5
family models) -
Works Fine On:
gpt-4o-mini