Skip to content

OpenAI backend passes invalid reasoning_effort to non-reasoning models #270

Closed

Description

@avinash2692

Description

The OpenAI backend unconditionally passes reasoning_effort parameter to all models, but only reasoning models support this parameter. This causes a 400 error when using models like gpt-4o with reasoning_effort in model_options.

Error

openai.BadRequestError: Error code: 400 - {'error': {'message': 'Unrecognized request argument supplied: reasoning_effort', 'type': 'invalid_request_error', 'param': None, 'code': None}}

Reproduction

import os
import mellea

m = mellea.start_session(
    backend_name="openai",
    base_url="https://api.openai.com/v1/",
    model_id="gpt-4o",
    api_key=os.getenv("OPENAI_API_KEY"),
    model_options={"reasoning_effort": "none"},
)
r = m.chat("hi")
print(r.content)

File Reference

mellea/backends/openai.py:639

Activity

  1. self-assigned this
    on Dec 24, 2025
  2. boazdavid commented on Dec 25, 2025

    @boazdavid

    note that it should also work without hte reasoning_effort:

    m = mellea.start_session(
        backend_name="openai",
        base_url="https://api.openai.com/v1/",
        model_id="gpt-4o",
        api_key=os.getenv("OPENAI_API_KEY"),
    )
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions