Skip to main content
Use TanStack AI when you want type-safe chat flows in React, Solid, Preact, Vue, Svelte, or server-side TypeScript.

Install

npm install @tanstack/ai @tanstack/ai-openai

Configure the adapter

import { chat } from "@tanstack/ai";
import { openaiCompatible } from "@tanstack/ai-openai/compatible";

const phaseo = openaiCompatible({
	name: "phaseo",
	baseURL: "https://api.phaseo.ai/v1",
	apiKey: process.env.PHASEO_API_KEY!,
	models: ["openai/gpt-5-nano", "anthropic/claude-sonnet-4.5"],
});

const stream = chat({
	adapter: phaseo("openai/gpt-5-nano"),
	messages: [{ role: "user", content: "Reply with only: ok" }],
});

Notes

  • Declare the Phaseo model ids you plan to use in the models array.
  • The OpenAI-compatible adapter defaults to Chat Completions. Use direct API calls for Responses-only features.
  • If a model does not support tools or images in your workflow, declare narrower capabilities in TanStack AI so TypeScript catches unsupported calls earlier.
Last modified on July 9, 2026