> ## Documentation Index
> Fetch the complete documentation index at: https://phaseo.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# TanStack AI

> 将 Phaseo 与 TanStack AI 的 OpenAI 兼容适配器配合使用。

如果你想在 React、Solid、Preact、Vue、Svelte 或服务端 TypeScript 中构建类型安全的聊天流，可使用 TanStack AI。

## 安装

```bash theme={null}
npm install @tanstack/ai @tanstack/ai-openai
```

## 配置适配器

```ts theme={null}
import { chat } from "@tanstack/ai";
import { openaiCompatible } from "@tanstack/ai-openai/compatible";

const phaseo = openaiCompatible({
	name: "phaseo",
	baseURL: "https://api.phaseo.app/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" }],
});
```

## 说明

* 在 `models` 数组中声明计划使用的 Phaseo 模型 ID。
* OpenAI 兼容适配器默认使用 Chat Completions。Responses 专属功能请直接调用 API。
* 如果模型在工作流中不支持工具或图像，请在 TanStack AI 中声明更窄的能力，以便 TypeScript 更早发现不支持的调用。

## 相关内容

* [OpenAI SDK](./openai-sdk.mdx)
* [工具调用](../tool-calling.mdx)
* [模型](../../api-reference/endpoint/models.mdx)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.