Skip to content

OpenAI API Error: service_tier extra input forbidden when using Computer Use AgentΒ #670

Closed
@pbanuru

Description

@pbanuru

When using a Computer Use Agent with Stagehand (following the docs), the agent fails with a 400 error from the OpenAI API:

BadRequestError: 400 [{'type': 'extra_forbidden', 'loc': ('body', 'service_tier'), 'msg': 'Extra inputs are not permitted', 'input': 'auto'}]

To Reproduce

  1. Start with the codebase from npx create-browser-app (integration guide).
  2. Replace the main function body in index.ts with the following code:
    await stagehand.page.goto("https://www.google.com");
    
    const agent = stagehand.agent({
      provider: "openai",
      model: "computer-use-preview",
      instructions: `You are a helpful assistant that can use a web browser.
      Do not ask follow up questions, the user will trust your judgement.`,
      options: {
        apiKey: process.env.OPENAI_API_KEY,
      },
    });
    
    await agent.execute("Apply for a library card at the San Francisco Public Library");
  3. Observe the error in the logs:
    Error getting action from OpenAI: BadRequestError: 400 [{'type': 'extra_forbidden', 'loc': ('body', 'service_tier'), 'msg': 'Extra inputs are not permitted', 'input': 'auto'}]
    

Expected behavior
The agent should execute the task without running into an error

Logs

[redacted]@[redacted] [redacted] % npm start

> start
> tsx index.ts

[2025-04-16 14:06:45.845 -0700] INFO: launching local browser
    category: "init"
    headless: false
[2025-04-16 14:06:45.845 -0700] INFO: local browser launch options
    category: "init"
    localLaunchOptions: "{\"viewport\":{\"width\":1920,\"height\":1080}}"
[2025-04-16 14:06:56.808 -0700] INFO: local browser started successfully.
    category: "init"
[2025-04-16 14:06:57.639 -0700] INFO: Creating agent instance
    category: "agent"
[2025-04-16 14:06:57.639 -0700] INFO: Executing agent task: Apply for a library card at the San Francisco Public Library
    category: "agent"
[2025-04-16 14:06:57.655 -0700] INFO: Cursor injected for visual feedback
    category: "agent"
[2025-04-16 14:06:57.655 -0700] INFO: Taking screenshot and sending to agent
    category: "agent"
[2025-04-16 14:06:57.728 -0700] INFO: Executing agent task: Apply for a library card at the San Francisco Public Library
    category: "agent"
Error getting action from OpenAI: BadRequestError: 400 [{'type': 'extra_forbidden', 'loc': ('body', 'service_tier'), 'msg': 'Extra inputs are not permitted', 'input': 'auto'}]
    at Function.generate ([redacted]/node_modules/openai/src/error.ts:72:14)
    at OpenAI.makeStatusError ([redacted]/node_modules/openai/src/core.ts:462:21)
    at OpenAI.makeRequest ([redacted]/node_modules/openai/src/core.ts:526:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
  status: 400,
  headers: {
    'alt-svc': 'h3=":443"; ma=86400',
    'cf-cache-status': 'DYNAMIC',
    'cf-ray': '[redacted]',
    connection: 'keep-alive',
    'content-length': '232',
    'content-type': 'application/json',
    date: 'Wed, 16 Apr 2025 21:06:58 GMT',
    'openai-organization': '[redacted]',
    'openai-processing-ms': '441',
    'openai-version': '2020-10-01',
    server: 'cloudflare',
    'set-cookie': '[redacted]',
    'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
    'x-content-type-options': 'nosniff',
    'x-request-id': '[redacted]'
  },
  request_id: '[redacted]',
  error: {
    message: "[{'type': 'extra_forbidden', 'loc': ('body', 'service_tier'), 'msg': 'Extra inputs are not permitted', 'input': 'auto'}]",
    type: 'invalid_request_error',
    param: null,
    code: null
  },
  code: null,
  param: null,
  type: 'invalid_request_error'
}
[2025-04-16 14:06:58.425 -0700] ERROR: Error executing step: 400 [{'type': 'extra_forbidden', 'loc': ('body', 'service_tier'), 'msg': 'Extra inputs are not permitted', 'input': 'auto'}]
    category: "agent"
[2025-04-16 14:06:58.425 -0700] ERROR: Error executing agent task: 400 [{'type': 'extra_forbidden', 'loc': ('body', 'service_tier'), 'msg': 'Extra inputs are not permitted', 'input': 'auto'}]
    category: "agent"

🀘 Thanks so much for using Stagehand! Reach out to us on Slack if you have any feedback: https://stagehand.dev/slack

[redacted]@[redacted] [redacted] % 
...

Environment:

  • Stagehand version: 2.1.0
  • OpenAI SDK version: 4.95.0
  • Node version: v22.14.0
  • OS: macOS 15.1.1

Metadata

Metadata

Assignees

No one assigned

    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