TanStack AI with DEVUP AI
Use TanStack AI on DEVUP AI models. Its openaiCompatible adapter points chat at DEVUP AI with any catalog model ID.
System Architecture
How TanStack AI Connects to DEVUP AI
1. Client
TanStack AI
Your TypeScript app
2. Gateway
DEVUP OpenAI-compatible API
POST /v1/chat/completions
3. Inference
Model
DeepSeek-V4-Pro
4. Response
Response
Stream events, tool calls and typed objects
Configuration
Quick Setup
bash
npm install @tanstack/ai @tanstack/ai-openai zodtypescript
import { chat } from "@tanstack/ai";
import { openaiCompatible } from "@tanstack/ai-openai/compatible";
const devupai = openaiCompatible({
name: "devupai",
baseURL: "https://api.devupai.com/v1",
apiKey: process.env.DEVUP_API_KEY ?? "",
models: ["deepseek-ai/DeepSeek-V4-Pro"],
});
const text = await chat({
adapter: devupai("deepseek-ai/DeepSeek-V4-Pro"),
messages: [{ role: "user", content: "Reply with exactly: Salam DEVUP" }],
stream: false,
});
console.log(text);Tools
Server Tools with zod
typescript
import { toolDefinition } from "@tanstack/ai";
import { z } from "zod";
const getOrderStatus = toolDefinition({
name: "getOrderStatus",
description: "Look up the delivery status of an order by its ID.",
inputSchema: z.object({ orderId: z.string() }),
}).server(async ({ orderId }) => ({ orderId, status: "shipped" }));
const toolCalls: string[] = [];
let answer = "";
for await (const chunk of chat({
adapter: devupai("deepseek-ai/DeepSeek-V4-Pro"),
messages: [{ role: "user", content: "What is the status of order A-100?" }],
tools: [getOrderStatus],
})) {
if (chunk.type === "TOOL_CALL_START") toolCalls.push(chunk.toolCallName);
if (chunk.type === "TEXT_MESSAGE_CONTENT") answer += chunk.delta;
}
console.log(toolCalls, answer);Capabilities
Supported Capabilities
Text and streaming
chat returns a stream of events by default, or the full text with stream: false.
Server tools
Define a tool with toolDefinition and a zod schema, implement it with .server, and pass it in tools.
Structured output
Pass a zod schema as outputSchema and chat returns the validated object.
Local DZD billing
Metered billing in Algerian Dinar with BaridiMob, Edahabia, and CIB local payment support.