Skip to content

createOpenaiChat example from docs produce type error #392

@Xhale1

Description

@Xhale1

TanStack AI version

v0.8.1

Framework/Library version

Nodejs 24.14.0

Describe the bug and the steps to reproduce it

The docs example here produces a type error.

import { createOpenaiChat } from "@tanstack/ai-openai";

// Type error here
const adapter = createOpenaiChat(process.env.OPENAI_API_KEY!, {
  // ... your config options
});

The docs suggest createOpenaiChat can be called to create an adapter with just an api key, however the code and type error suggest that the first argument should be a model, not an api key.

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://codesandbox.io/p/devbox/xt8q39

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

No, because I do not know how

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

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