TanStack / TanStack/ai

createOpenaiChat example from docs produce type error

Open
#392 0 comments 0 reactions 1 assignee View on GitHub

@AlemTuzlak is already working on this.

Since Sep 17, 2026.

waiting-on: maintainer
Dominant language
TypeScript
Stars
3.1k
Forks
331
Avg merge
1d 22h
Merged PRs (30d)
160

Description

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.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.