Skip to content

logprobs and refusal validation error for non-OpenAI model providers #1616

@nguyennampfiev

Description

@nguyennampfiev

Describe the question

When running an agent, it responses fail validation because logprobs is missing from streamed responses.
This seems related to PR #1226 / #1246, which was merged after July 28, 2025,

Debug information

  • openai-agents== 0.2.9
  • openai==1.101.0
  • Python 3.11

Repro steps

session = SQLiteSession("conversation_123")

agent = Agent(
    name="Assistant",
    instructions="Reply very concisely.",
    model=OpenAIResponsesModel(
        model="openai/gpt-oss-20b",
        openai_client=AsyncOpenAI(
            base_url="http://0.0.0.0:8000/v1",
            api_key="not-needed",
        ),
    ),
)

result = await Runner.run(
    agent,
    "What city is the Golden Gate Bridge in?",
    session=session
)
print(result.final_output)  # "San Francisco"

result = await Runner.run(
    agent,
    "What state is it in?",
    session=session
)
print(result.final_output)  # "California"

result = Runner.run_sync(
    agent,
    "What's the population?",
    session=session
)
print(result.final_output)

Error Trace:

Error getting response: Error code: 400 - {
  'error': {
    'message': "3 validation errors for ValidatorIterator
    0.ResponseOutputTextParam.logprobs
      Input should be iterable [type=iterable_type, input_value=None, input_type=NoneType]
    0.ResponseOutputRefusalParam.refusal
      Field required [type=missing, input_value={'annotations': [], 'text': '...'}, input_type=dict]
    0.ResponseOutputRefusalParam.type
      Input should be 'refusal' [type=literal_error, input_value='output_text', input_type=str]",
    'type': 'BadRequestError',
    'code': 400
  }
}

Expected behavior

logprobs should default to [] (as fixed in PR #1246), so missing fields don’t cause validation errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions