Fix reasoning_effort error for GPT-5.1/5.2 in local mode

Merged
SH
8mo ago
+5-0

Summary

  • GPT-5.1 and GPT-5.2 reject reasoning_effort: "minimal" β€” valid values are none, low, medium, high, xhigh
  • Sets reasoning_effort: "low" for GPT-5.1/5.2 models in the local mode LLM client (litellm path)
  • Other GPT-5 variants (e.g. gpt-5-nano) are unaffected β€” they don't get reasoning_effort set

Context

Users on v0 SDK hitting this error when using GPT-5.2:

Unsupported value: 'reasoning_effort' does not support 'minimal' with this model.
Supported values are: 'none', 'low', 'medium', 'high', and 'xhigh'.

This matches the fix already shipped in the v3 TypeScript core (aisdk.ts) which differentiates GPT-5.1/5.2 from other GPT-5 models.

Note: For API mode (BROWSERBASE) users, the reasoning_effort is set server-side. Users hitting this in API mode should upgrade to stagehand>=3.6.0 which connects to a server with the fix.

Test plan

  • Unit logic verified for GPT-5.2 ("low"), GPT-5.1 ("low"), GPT-5-nano (no override), GPT-4o (no override)
  • E2E tested locally: extract + observe with openai/gpt-5.2 in LOCAL mode passes
  • 57 unit tests pass (1 pre-existing failure unrelated)

πŸ€– Generated with Claude Code


Summary by cubic

Fixes OpenAI errors for gpt-5.1 and gpt-5.2 in local mode by setting reasoning_effort to "low" instead of the unsupported "minimal". Prevents failed requests when using these models via the local litellm client.

  • Bug Fixes
    • Apply reasoning_effort: "low" only for gpt-5.1 and gpt-5.2 in local (litellm) mode.
    • Other GPT-5 variants (e.g., gpt-5-nano) are unchanged.
    • For API mode, this is handled server-side; upgrade to stagehand>=3.6.0 if you still see the error.