Mastra logoFramework

Mastra with DEVUP AI

Build TypeScript agents with Mastra on DEVUP AI models. Connect a Mastra Agent to DEVUP AI through @ai-sdk/openai-compatible.

System Architecture

How Mastra Connects to DEVUP AI

1. Client
Mastra
Your TypeScript agent
2. Gateway
DEVUP OpenAI-compatible API
POST /v1/chat/completions
3. Inference
Model
DeepSeek-V4-Pro
4. Response
Response
Text, tool calls and typed objects

Configuration

Quick Setup

bash
npm install @mastra/core @ai-sdk/openai-compatible zod
typescript
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { Agent } from "@mastra/core/agent";

const devupai = createOpenAICompatible({
  name: "devupai",
  baseURL: "https://api.devupai.com/v1",
  apiKey: process.env.DEVUP_API_KEY,
});

const agent = new Agent({
  id: "assistant",
  name: "Assistant",
  instructions: "Be concise.",
  model: devupai("deepseek-ai/DeepSeek-V4-Pro"),
});

const result = await agent.generate("Reply with exactly: Salam DEVUP");
console.log(result.text);

Tools

Tools Defined with zod

typescript
import { createTool } from "@mastra/core/tools";
import { z } from "zod";

const getOrderStatus = createTool({
  id: "getOrderStatus",
  description: "Look up the delivery status of an order by its ID.",
  inputSchema: z.object({ orderId: z.string() }),
  execute: async ({ orderId }) => ({ orderId, status: "shipped" }),
});

const supportAgent = new Agent({
  id: "support",
  name: "Support",
  instructions: "Answer order questions with the getOrderStatus tool.",
  model: devupai("deepseek-ai/DeepSeek-V4-Pro"),
  tools: { getOrderStatus },
});

const orderResult = await supportAgent.generate("What is the status of order A-100?");
console.log(orderResult.toolCalls.map((call) => call.payload.toolName), orderResult.text);

Capabilities

Supported Capabilities

Generation and streaming

agent.generate returns the full reply; agent.stream yields text as it is generated.

Tool calling

Define tools with createTool and a zod input schema; the agent calls them when it needs their data.

Structured output

Pass a zod schema as structuredOutput and read the validated object from the result.

Local DZD billing

Metered billing in Algerian Dinar with BaridiMob, Edahabia, and CIB local payment support.

Ready to Build with Mastra on DEVUP AI?