Skip to main content
Use this page for the simplest Responses API workflow: send text in input and read text back from the response. Start here if you want a plain text answer before adding tools, schema enforcement, or multimodal inputs.

Minimal Request

from openai import OpenAI

client = OpenAI(
    base_url="https://api.naga.ac/v1",
    api_key="YOUR_API_KEY",
)

response = client.responses.create(
    model="gpt-4.1-mini",
    input="Write one sentence about graceful degradation.",
)

print(response.output_text)

Minimal Response

{
  "object": "response",
  "status": "completed",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "Graceful degradation keeps a system useful even when some components fail.",
          "annotations": [],
          "logprobs": []
        }
      ]
    }
  ]
}
If you only need the final text, response.output_text is the simplest accessor in the official OpenAI SDKs.

Response Shape At A Glance

response
status
output[]
message
role
content[]
output_text
reasoning
function_call
function_call_output
image-generation item

Instructions vs Input Items

Use instructions for high-level developer guidance and input for the actual request payload.
{
  "model": "gpt-4.1-mini",
  "instructions": "Respond in two concise bullet points.",
  "input": "Explain the difference between caching and buffering."
}
You can also send structured input items instead of a plain string:
{
  "model": "gpt-4.1-mini",
  "input": [
    {
      "type": "message",
      "role": "developer",
      "content": "Answer like an SRE writing internal notes."
    },
    {
      "type": "message",
      "role": "user",
      "content": "Explain retry storms."
    }
  ]
}
Use a plain string for simple one-shot prompts. Use structured message items when you need multiple turns, multimodal content, or fine-grained control over roles.

Important Mental Model

Do not assume the final answer always lives at output[0].content[0].text. The output array may also contain:
  • reasoning items
  • function calls
  • function call outputs
  • image-generation items
If you use official OpenAI SDKs, output_text is the simplest convenience accessor when you only care about concatenated text output.

Common mistakes

  • assuming output[0] is always the final assistant answer
  • using input string format when you actually need multiple messages or multimodal parts
  • mixing request instructions into user content when instructions would be clearer