Skip to main content

Overview

OpenAI Responses API is the newer, recommended API for reasoning models (o-series) and advanced features like code execution. It provides better support for multi-turn conversations and built-in tools. Model Class: OpenAIResponsesModel

Authentication

export OPENAI_API_KEY="sk-..."

Examples

from upsonic import Agent, Task
from upsonic.models.openai import OpenAIResponsesModel

model = OpenAIResponsesModel(model_name="o1-preview")
agent = Agent(model=model)

task = Task("Hello, how are you?")
result = agent.do(task)
print(result.output)

Parameters

ParameterTypeDescriptionDefaultSource
max_tokensintMaximum tokens to generateModel-specificBase
seedintRandom seed for deterministic outputsNoneBase
stop_sequenceslist[str]Sequences that stop generationNoneBase
timeoutfloatRequest timeout in seconds600Base
extra_headersdict[str, str]Additional HTTP headersNoneBase
extra_bodyobjectAdditional request body paramsNoneBase
openai_reasoning_effort'low' | 'medium' | 'high'Computational effort for reasoningNoneSpecific
openai_reasoning_summary'detailed' | 'concise'Reasoning summary detail levelNoneSpecific
openai_send_reasoning_idsboolSend reasoning part IDs in historyFalseSpecific
openai_truncation'disabled' | 'auto'Context window truncation strategy’auto’Specific
openai_text_verbosity'low' | 'medium' | 'high'Text response verbosityNoneSpecific
openai_previous_response_id'auto' | strContinue from previous responseNoneSpecific
openai_include_code_execution_outputsboolInclude code interpreter outputsFalseSpecific
openai_include_web_search_sourcesboolInclude web search sourcesFalseSpecific
openai_builtin_toolsSequence[...]Built-in tools to enableNoneSpecific