# Vercel AI SDK

Rizamo's tools in an AI SDK agent, from the @rizamo/ai-sdk package or the MCP server.

Two ways in. Keep your [API key](/authentication#api-keys) in `RIZAMO_API_KEY` for both.

## The @rizamo/ai-sdk package [#the-rizamoai-sdk-package]

Typed tools for posts, media, accounts, analytics and the inbox, with no MCP connection to manage.

```bash
npm install @rizamo/ai-sdk ai zod @ai-sdk/anthropic
```

```ts
import { anthropic } from "@ai-sdk/anthropic";
import { createRizamoTools } from "@rizamo/ai-sdk";
import { generateText, isStepCount } from "ai";

const { text } = await generateText({
  model: anthropic("claude-sonnet-5-5"),
  tools: createRizamoTools(),
  stopWhen: isStepCount(10),
  prompt: "List my Instagram accounts, then save a draft for the first one: 'Doors open at 10.'",
});
console.log(text);
```

| Tool | What it does |
| --- | --- |
| `listProfiles`, `listAccounts` | The profiles and connected accounts, with their ids |
| `createPost` | A post for one or more accounts: a draft, or scheduled when given a time |
| `getPost` | A post and each target's status |
| `addMedia` | An image or video from a public URL |
| `getAnalytics` | Views, reach, engagements and followers over the last days |
| `listThreads` | Comments and messages, newest first |
| `publishPost`, `replyToThread` | Reach the networks at once, so only with `createRizamoTools({ publish: true, reply: true })` |

When Rizamo refuses a call, the tool returns `{ error, code, status }` with a message that says what to change. Source: [rizamohq/rizamo-ai-sdk](https://github.com/rizamohq/rizamo-ai-sdk).

## The MCP server [#the-mcp-server]

`@ai-sdk/mcp` turns Rizamo's MCP server into AI SDK tools: every tool your key's scopes reach.

```bash
npm install ai @ai-sdk/mcp @ai-sdk/anthropic
```

```ts
import { anthropic } from "@ai-sdk/anthropic";
import { createMCPClient } from "@ai-sdk/mcp";
import { generateText, isStepCount } from "ai";

const rizamo = await createMCPClient({
  transport: {
    type: "http",
    url: "https://mcp.rizamo.com/mcp",
    headers: { Authorization: `Bearer ${process.env.RIZAMO_API_KEY}` },
  },
});

try {
  const { text } = await generateText({
    model: anthropic("claude-sonnet-5-5"),
    tools: await rizamo.tools(),
    stopWhen: isStepCount(10),
    prompt: "Save a draft for our Instagram: 'Doors open at 10.'",
  });
  console.log(text);
} finally {
  await rizamo.close();
}
```

Any model the AI SDK supports works in place of Claude.
