docs: openaiEndpointFormat chat example for Chat Completions-only hosts

Open Beginner friendly
#2,844 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
documentation

Research direction

Start at the custom endpoints documentation page and locate the existing OpenAI baseURL snippet. Add a nearby worked example using the supplied model configuration and openaiEndpointFormat: "chat" for a Chat Completions-only host; done means the example clearly shows the /v1 baseURL and chat setting.

Written by the indexing model from the issue text.

Description

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.

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.

Dominant language
TypeScript
Stars
24.6k
Forks
1.7k
Avg merge
4d 2h
Merged PRs (30d)
62

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from browserbase/stagehand

All issues in browserbase/stagehand

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.