#2844·stagehand

docs: openaiEndpointFormat chat example for Chat Completions-only hosts

Author: cursor[bot]Created Aug 28, 2026Updated Aug 28, 2026

Is your feature request related to a problem? Please describe.

The custom endpoints docs show model.baseURL for OpenAI-shaped hosts. Default wire is still Responses (openaiEndpointFormat omitted). A Chat Completions-only host then fails in a way that looks like a bad baseURL.

PR #2347 added openaiEndpointFormat: "chat". That flag is easy to miss next to baseURL.

Describe the solution you'd like

A worked example next to the existing OpenAI baseURL snippet that sets openaiEndpointFormat: "chat" for a Chat Completions-only host.

PZERO is a live OpenAI-compatible host. Catalog: GET https://api.pzero.studio/v1/models. Default text id: deepseek-v4-flash. Prepaid Bearer key (pzero_…). POST /v1/chat/completions is the working path. POST /v1/responses exists (401 without a key, not 404) but this host is Chat Completions-first for agent tools.

typescript
import { Stagehand } from "@browserbasehq/stagehand";

const stagehand = new Stagehand({
  env: "LOCAL",
  model: {
    modelName: "openai/deepseek-v4-flash",
    apiKey: process.env.PZERO_API_KEY,
    baseURL: "https://api.pzero.studio/v1",
    openaiEndpointFormat: "chat",
  },
});

modelName keeps the openai/ provider prefix. baseURL is the /v1 root, not /v1/chat/completions. Omit openaiEndpointFormat and Stagehand talks Responses.

Do not point Stagehand STT/TTS or embeddings at this host unless those routes are verified.

Describe alternatives you've considered

A custom llmClient with @ai-sdk/openai-compatible also works. The model object is the shorter path already documented for OpenAI baseURL.

Are you willing to contribute to implementing this feature or fix?

  • Yes, I can submit a PR
  • Yes, but I need guidance
  • No, I cannot contribute at this time

No first-party plugin asked. If a named vendor subsection is too much, the gotcha is openaiEndpointFormat: "chat"; the block is a worked example for searchers.