Responses API
POST /v1/responses implements the OpenAI Responses API — the newer interface
used by the OpenAI Agents SDK and Codex-style tools.
resp = client.responses.create( model="gpt-5.6-luna", instructions="You are a helpful assistant.", input="Explain recursion in one sentence.",)print(resp.output_text)Streaming
Section titled “Streaming”with client.responses.stream( model="gpt-5.6-luna", input="Write a limerick about a cat.",) as stream: for event in stream: if event.type == "response.output_text.delta": print(event.delta, end="", flush=True)Events include response.created, response.output_text.delta and
response.completed.
Reasoning effort
Section titled “Reasoning effort”resp = client.responses.create( model="gpt-5.6-luna", input="Plan a 3-day trip to Rome.", reasoning={"effort": "low"},)Structured output
Section titled “Structured output”resp = client.responses.create( model="gpt-5.6-luna", input="Name the capital of Japan.", text={"format": { "type": "json_schema", "name": "city", "strict": True, "schema": { "type": "object", "properties": {"city": {"type": "string"}, "country": {"type": "string"}}, "required": ["city", "country"], "additionalProperties": False, }, }},)print(resp.output_text)The Responses API is available for GPT models. For Claude and Gemini models use Chat Completions or their native formats.