Mastering Response Parameters

Working with the OpenAI Responses API

James Chapman

AI Curriculum Manager, DataCamp

Model Selection

response = client.responses.create(
    model="gpt-5-mini",
    input="What is recursion?",
)
1 https://platform.openai.com/docs/models
Working with the OpenAI Responses API

Model Selection

response = client.responses.create(
    model="gpt-5-mini",
    input="What is recursion?",
)
  • Rule-of-thumb: use the cheapest model that meets the other requirements
Model Speed Cost Best For
gpt-5-nano Rapid Ultra-Low Low-latency apps
gpt-5-mini Fast Low Simple tasks, Q&A
gpt-5 Moderate Higher Complex reasoning
1 https://platform.openai.com/docs/models
Working with the OpenAI Responses API

LLMs and Tokens

  • Tokens: units of text that help the AI understand and interpret text

$$

The sentence, "How can the OpenAI API deliver business value?" with each token highlighted in a different color.

1 https://platform.openai.com/tokenizer
Working with the OpenAI Responses API

LLMs and Tokens

 

  • Non-reasoning LLMs: Generates the tokens with the highest probability of following the prompt

non_reasoning_output.gif

Working with the OpenAI Responses API

LLMs and Tokens

reasoning_output.gif

Working with the OpenAI Responses API

Reasoning Effort

response = client.responses.create(
    model="gpt-5-mini",
    input="Explain LLMs to a 6yr old.",

reasoning={"effort": "minimal"}
)
Working with the OpenAI Responses API

Reasoning Effort

response = client.responses.create(
    model="gpt-5-mini",
    input="Explain LLMs to a 6yr old.",
    reasoning={"effort": "minimal"}
)
Effort Best For
minimal Trivial or mechanical tasks.
low Simple tasks prioritizing speed and cost.
medium Default for balanced reasoning and efficiency.
high Complex, multi-step, or logic-heavy tasks.
Working with the OpenAI Responses API

Reasoning Summaries

response = client.responses.create(
    model="gpt-5-mini",
    input="Explain LLMs to a 6yr old.",
    reasoning={
        "effort": "medium",

"summary": "auto"
} )
Working with the OpenAI Responses API

Limiting Output Tokens

response = client.responses.create(
    model="gpt-5-mini",
    input="Explain LLMs to a 6yr old.",
    reasoning={"effort": "minimal"},

max_output_tokens=500
)
  • max_output_tokens includes the reasoning tokens
Working with the OpenAI Responses API

Summary

  • Simpler Tasks → start with small models, minimal reasoning, and few tokens
  • Complex Tasks → start with medium model sizes and reasoning, then fine-tune

parameter_link.jpg

Working with the OpenAI Responses API

Let's practice!

Working with the OpenAI Responses API

Preparing Video For Download...