Skip to content

responses.create() hangs indefinitely with GPT-5 models while direct REST API call completes successfully #2725

@pietroperona

Description

@pietroperona

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

When using the Responses API with GPT-5 models (specifically gpt-5-nano-2025-08-07) via the Python SDK, the call client.responses.create() hangs indefinitely and eventually times out after ~30 seconds.
The same request, when made directly via the REST API (curl), completes successfully in about 12 seconds with "status": "completed".

This indicates the issue is likely within the Python SDK implementation, not the OpenAI backend.

To Reproduce

Working REST API call (completes in ~12 seconds)

curl https://api.openai.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-5-nano-2025-08-07",
    "instructions": "Analyze the following newsletters and produce a 400-word abstract with 5 key bullet points.",
    "input": "Sample newsletter content here...",
    "store": true
  }'

Result: Completes in ~12 seconds with "status": "completed" and full output available.

Failing Python SDK call (times out after 30+ seconds)

import asyncio
from openai import AsyncOpenAI

async def test():
    client = AsyncOpenAI(api_key="sk-...")

    response = await client.responses.create(
        model="gpt-5-nano-2025-08-07",
        instructions="Analyze the provided content and summarize it.",
        input="Sample newsletter content here...",
        max_output_tokens=600,
        store=True,
    )

    print(f"Initial response: id={response.id}, status={response.status}")

    for _ in range(30):
        await asyncio.sleep(1)
        response = await client.responses.retrieve(response.id)
        print(f"Status: {response.status}")
        if response.status == "completed":
            print("Completed successfully")
            return

    raise TimeoutError("Timed out after 30 seconds")

asyncio.run(test())

Result: The call times out after 30+ seconds; status never becomes "completed".

Code snippets

OS

14.6

Python version

3.12

Library version

2.6.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions